CS FundamentalsHardGATE CS

A system has 4 instances of R1 and 2 of R2. Allocated: P1 holds 1 R1; P2 holds 2 R1 and 1 R2; P3 holds 1 R1 and 1 R2. Requests: P1 wants 1 R2; P2 wants 1 R1; P3 wants nothing more. Which statement is correct?

  1. A. The system is deadlocked: P1 and P2 wait in a cycle
  2. B. Only P3 can finish; P1 and P2 then stay deadlocked on each other
  3. C. No deadlock: P3 finishes, after which P1 and P2 can both complete
  4. D. Deadlock detection cannot decide, since R1 has multiple instances

Correct answer: C. No deadlock: P3 finishes, after which P1 and P2 can both complete

Available is (0, 0). P3 needs nothing, finishes and frees (1, 1). Now P1's request (0, 1) or P2's request (1, 0) can be met, and after each finishes the other can too. A cycle with multi-instance resources does not imply deadlock.

More Operating Systems questions

Exams that ask this topic