正在加载图片...
O A Producer-Consumer Example continued Producer posting item x Consumer Load Rtail,(tail) Load rhead,(head) IStore(rtail),X spin Load R taill Rtail=rtail +1 if rhead==Rtail goto spin sTore(tail),rtail Load R,(Ri head head Rhead+1 Can the tail pointer get updated Store(head), rhead before the item x is stored process (r) Programmer assumes that if 3 happens after 2, then 4 happens after 1. Problem sequences are 2,3,4,1 4,1,2,3 2021/2/11 计算机体系结构 19A Producer-Consumer Example continued 2021/2/11 计算机体系结构 19 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) Can the tail pointer get updated before the item x is stored? Programmer assumes that if 3 happens after 2, then 4 happens after 1. Problem sequences are: 2, 3, 4, 1 4, 1, 2, 3 1 2 3 4
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有