[理工] [OS] 97台大電機
suppose we have two processes with indices 0 and 1. Assume that count is a
shared variable between the two processes with initial value zero. (Suppose
count is implemented without limit in its range.) Also each process with index
p has a local variable ticket[p] with initial value zero We have the following
mutual-exclusion algorithm for the two processes in a distributed system.
while(ture){
ticket[p] = count = count+1;
while(ticket[1-p] != 0 && ticket[1-p] < ticket[p]);
CS
ticket[p] = 0;
RS
}
請問這分別滿足mutual exclusion, progress, bounded waiting嗎?
97台大電機
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.166.117.109
補充一下洪捷的解答
滿足mutual exclusion, bounded waiting
不滿足progress
請問這要怎麼判斷?
有高手會解這題嗎?
謝謝
※ 編輯: mqazz1 來自: 140.118.110.186 (07/31 20:53)
推
08/01 00:37, , 1F
08/01 00:37, 1F
→
08/01 00:38, , 2F
08/01 00:38, 2F
推
08/01 00:49, , 3F
08/01 00:49, 3F
推
08/01 00:57, , 4F
08/01 00:57, 4F
其實我一開始也是覺得mutual exclusion不滿足 其他兩個滿足= =
我已經把回文都看完了 題目的確是少打了atomic..
感謝大家的回覆
※ 編輯: mqazz1 來自: 140.118.110.186 (08/01 10:03)
推
08/01 12:51, , 5F
08/01 12:51, 5F
討論串 (同標題文章)