GATEverse
← GATE CSE 1991

Q11,b

NATMarks unknown

Consider the following scheme for implementing a critical section in a situation with three processes Pi,PjP_i, P_j and PkP_k. Pi; repeat flag[i] := true; while flag [j] or flag[k] do case turn of j: if flag [j] then begin flag [i] := false; while turn != i do skip; flag [i] := true; end; k: if flag [k] then begin flag [i] := false, while turn != i do skip; flag [i] := true end end critical section if turn = i then turn := j; flag [i] := false non-critical section until false; Is there a situation in which a waiting process can never enter the critical section? If so, explain and suggest modifications to the code to solve this problem

Sign in to save attempts.

Loading…