Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.
Method used by P1 | Method used by P2 |
while (S1 == S2); Critica1 Section S1 = S2; | while (S1 != S2); Critica1 Section S2 = not (S1); |
P1 | P2 |
while (S1 == S2); Critica1 Section S1 = S2; | while (S1 != S2); Critica1 Section S2 = Not (S1); |