GATEverse
← GATE CSE 1988

Q10iib

NATMarks unknown

Given below is solution for the critical section problem of two processes P0P_0 and P1P_1 sharing the following variables: var flag :array [0..1] of boolean; (initially false) turn: 0 .. 1; The program below is for process Pi(i=0  or  1)P_{i} (i=0\;\text{or}\; 1) where process Pj(j=1  or  0)P_{j} (j=1\; \text{or}\; 0) being the other one. repeat flag[i]:= true; while turn != i do begin while flag [j] do skip turn:=i; end critical section flag[i]:=false; until false Determine of the above solution is correct. If it is incorrect, demonstrate with an example how it violates the conditions.

Sign in to save attempts.

Loading…