O A Producer-Consumer Example ta eaa Producer Consumer R tail R head R Producer posting Item x: Consumer Load rtail,(tail) Load rhead,(head) Store(Rtail),X spin: Load R stail,(tail R R+1 if rhead==Rtail goto spin tail Store(tail,rtail Load r,(rhead shearhead+1 Store(head), rhead process(r) 假设指令都是顺序执行的 Problems? 2021/2/11 计算机体系结构A Producer-Consumer Example 2021/2/11 计算机体系结构 18 假设指令都是顺序执行的 Producer posting Item x: Load Rtail, (tail) Store (Rtail), x Rtail=Rtail+1 Store (tail), Rtail Consumer: Load Rhead, (head) spin: Load Rtail, (tail) if Rhead==Rtail goto spin Load R, (Rhead) Rhead=Rhead+1 Store (head), Rhead process(R) Producer Consumer tail head Rtail Rtail Rhead R Problems?