[理工] [os] test-and-set 92中原

看板Grad-ProbAsk作者 (BT)時間14年前 (2011/08/31 17:52), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
The algorithm uses the test-and-set instruction is shown in the following.(12%)  waiting[i] = true;  key = true;  while(waiting[i] and key) do key = test-and-set(lock);  waiting[i] = false; CRITICAL SECTION  j=i+1 mod n;  while ((j<>i) and (not waiting[j])) doj=j+1 mod n;  if j=i then     lock=false;     else waiting[j]=false; 想問第三題,Can we remove waiting[i]=false statement? Why? 可否舉個例子給我看... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.193.80.151
文章代碼(AID): #1ENWHwo4 (Grad-ProbAsk)
文章代碼(AID): #1ENWHwo4 (Grad-ProbAsk)