CS FundamentalsVery hardGATE CS

mutex m = 1. P1: wait(m); print A; print B; signal(m). P2: wait(m); print C; print D; signal(m). P3: print E (no synchronisation). How many distinct outputs are possible?

  1. A. 2
  2. B. 6
  3. C. 10
  4. D. 12

Correct answer: C. 10

AB and CD each appear as an unbroken pair in either order (2 ways), and E can be inserted in any of the 5 gaps of the 4-letter string: 2 × 5 = 10.

More Operating Systems questions

Exams that ask this topic