Anonymous user menu

Gatte2001_2.22

Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
 

repeat
flag[i]=true;
turn=j;
while (P) do no-op;
Enter critical section, perform actions, then
exit critical section
Flag[i]=false;
Perform other non-critical section actions.
Until false;

For the program to guarantee mutual exclusion, the predicate P in the while loop should be
(a) flag[j]=true and turn=i
(b) flag[j]=true and turn=j
(c) flag[i]=true and turn=j
(d) flag[i]=true and turn=i

Answer

Discuss

0Comment