Consider the methods used by processes and for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables and are randomly assigned.
Which one of the following statements describes the properties achieved?
GATE CSE 2010Operating System › Process Synchronization & ConcurrencyVerified
GATE CSE 2010 PYQ: Consider the methods used by processes P 1 P1 P 1 and P 2 P2 P 2 for accessing their critical sections…
- AMutual exclusion but not progressCorrect answer
- BProgress but not mutual exclusion
- CNeither mutual exclusion nor progress
- DBoth mutual exclusion and progress
Answer
(A) Mutual exclusion but not progress
Approach
Treat the two shared booleans as encoding a turn. The key is to identify exactly when each process can leave its busy-wait loop. P1 enters only when S1 != S2, and P2 enters only when S1 == S2. These conditions are complementary, so at most one process can enter the critical section. However, after leaving the CS, each process flips the variables so that the turn passes to the other process. This is strict alternation: if the other process is not interested, the interested process can remain blocked forever, violating progress.
The two entry conditions are complementary, so mutual exclusion is guaranteed. But the post-critical-section assignments make the processes alternate strictly. If the process whose turn it is does not want to enter, the other process cannot proceed even though the critical section is free. Hence progress is violated. The correct option is A.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.