var flag: array[0..1] of Boolean; (initailly false)
turn: 0..1; (initailly 1)
The following program is for process Pi (i = 0 or 1),
with Pj (j = 1 or 0) being the other process
repeat
flag[i]:=ture;
while turn < > i
do begin
while flag[j] do no-op;
turn:=i;
end
//critical section
flag[i]:=false;
//remainder section
until fasle;
類似像這樣給code然後要求證明
mutual exclusive、progress、bounded waiting
這三個的題目蠻多的 變化也很多
想問說這類的題目有沒有什麼解題技巧?
如果沒有的話 純解這題也可以
謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.230.126.34