Below is another modification to Petersons algorithm Does it
Below is another modification to Peterson’s algorithm. Does it solve the critical section problem?
do
{ flag[i] = true; turn = j;
while (!(flag[j] || turn == j)) ;
/* critical section code */ flag[i] = false;
/* remainder section */ } while (true)
Solution
No, the above petersons alogorithm is not used to solve the crirical section prolem because it have to execute until false.
repeat
flag[i]:=true;
while flag[j]
do if turn = j
then begin
flag[i]:=false;
while turn = j do no-op;
flag[i]:=true;
end;
critical section
turn := j;
flag[i]:=false;
remainder section
until false;
![Below is another modification to Peterson’s algorithm. Does it solve the critical section problem? do { flag[i] = true; turn = j; while (!(flag[j] || turn == j) Below is another modification to Peterson’s algorithm. Does it solve the critical section problem? do { flag[i] = true; turn = j; while (!(flag[j] || turn == j)](/WebImages/15/below-is-another-modification-to-petersons-algorithm-does-it-1025395-1761530828-0.webp)