CS FundamentalsHardGATE CS

Two processes each run `flag[i] = true; while (flag[j]); CS; flag[i] = false;` (no turn variable). Which statement is correct?

  1. A. Mutual exclusion can be violated
  2. B. It satisfies all three requirements
  3. C. Only bounded waiting fails
  4. D. Mutual exclusion holds, but both can set their flags and then wait forever (deadlock)

Correct answer: D. Mutual exclusion holds, but both can set their flags and then wait forever (deadlock)

Once a process passes the loop, the other's flag was false at that point and its own flag blocks the other. But if both set flag = true before checking, both spin forever.

More Operating Systems questions

Exams that ask this topic