Question: In the given programs for P1 and P2, tell if it is properly synchronizing the processes. Does this solution implements Mutual exclusion and progress? If
In the given programs for P1 and P2, tell if it is properly synchronizing the processes. Does this solution implements Mutual exclusion and progress? If not, explain your theory with an example of preemption sequence. turn is a shared variable and initial value for turn = 0;
| P1 | P2 |
| While(1){ turn = 1; if(turn == 0){ CRITICAL_SECTION } turn = 0; } | While(1){ turn = 0; if(turn == 1){ CRITICAL_SECTION } turn = 1; } |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
