CS FundamentalsModerateGATE CS

Which property does Peterson's algorithm guarantee for two processes, assuming loads and stores are atomic and NOT reordered?

  1. A. Mutual exclusion only; it can deadlock
  2. B. Mutual exclusion, progress and bounded waiting
  3. C. Mutual exclusion and progress, but a process can starve
  4. D. Progress and bounded waiting, but not mutual exclusion

Correct answer: B. Mutual exclusion, progress and bounded waiting

Setting flag[i] and then giving turn to the other process ensures all three requirements. On modern CPUs that reorder memory accesses it needs memory barriers to remain correct.

More Operating Systems questions

Exams that ask this topic