Consider the following two-process synchronization solution.
Process 0: Entry: loop while(turn==1); (critical section) Exit: turn=1;
Process 1: Entry: loop while(turn==0); (critical section) Exit: turn=0;The shared variable turn is initialized to zero. Which one of the following is TRUE?
- AThis is a correct two-process synchronization solution
- BThis solution violates mutual exclusion requirement
- This solution violates progress requirement
- DThis solution violates bounded wait requirement
Explanation
This strict-alternation scheme DOES guarantee mutual exclusion (only the process matching the current 'turn' value can proceed). But it VIOLATES progress: if Process 0 wants to enter its critical section again but Process 1 has no interest in entering (isn't running, or doesn't want to), Process 0 is still forced to wait for turn to become 0 again via Process 1 — even though no other process is competing. This unnecessary waiting-for-a-disinterested-process is exactly a progress violation.
Source: GATE CS 2016 (Session 2 / Set B) (2016)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.