Is the following solution correct to solve the critical sect…
Is the following solution correct to solve the critical section problem? Please briefly explain.Proc (int i) {L1: while (TRUE){L2: compute;L3: while (turn != i);L4: critical_section;L5: turn = (i+1) mod 2;L6: }}shared int turn;turn = 1;fork(proc, 1, 0);fork(proc, 1, 1);
Read Details