Project ForgeSign up free
Operating Systems
Process Synchronization
GATE 2010
Expert

Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, given below. The initial values of shared boolean variables S1 and S2 are randomly assigned. Method used by P1: `while(S1==S2); Critical Section; S1=S2;` Method used by P2: `while(S1!=S2); Critical Section; S2=not(S1);` Which one of the following statements describes the properties achieved?

  • Mutual exclusion but not progress
  • BProgress but not mutual exclusion
  • CNeither mutual exclusion nor progress
  • DBoth mutual exclusion and progress

Explanation

P1's guard (S1==S2) and P2's guard (S1!=S2) are exact logical negations of each other evaluated on the SAME shared state at any instant — so exactly one of the two can ever be satisfied at once, guaranteeing mutual exclusion. But progress can fail: if P1 is blocked waiting on a stale (S1==S2) snapshot and P2 has already finished executing (or never runs again), P1 can wait forever even though the critical section is genuinely free — a violation of progress.

Source: GATE CS 2010 (2010)

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.

Start revising free