\(𝑃 = \{𝑃_1, 𝑃_2, 𝑃_3, 𝑃_4\}\) consists of all active processes in an…

2025

\(𝑃 = \{𝑃_1, 𝑃_2, 𝑃_3, 𝑃_4\}\)Β consists of all active processes in an operating system.Β \(𝑅 = \{𝑅_1, 𝑅_2, 𝑅_3, 𝑅_4\}\) consists of single instances of distinct types of resources in the system.

The resource allocation graph has the following assignment and claim edges.

Assignment edges:Β \(𝑅_1 β†’ 𝑃_1, 𝑅_2 β†’ 𝑃_2, 𝑅_3 β†’ 𝑃_3, 𝑅_4 β†’ 𝑃_4\) (the assignment edgeΒ \(𝑅_1 β†’ 𝑃_1\) means resourceΒ \(𝑅_1\) is assigned to process \(𝑃_1\) , and so on for others)

Claim edges:Β \(𝑃_1 β†’ 𝑅_2, 𝑃_2 β†’ 𝑅_3, 𝑃_3 β†’ 𝑅_1, 𝑃_2 β†’ 𝑅_4, 𝑃_4 β†’ 𝑅_2\) (the claim edgeΒ \(𝑃_1 β†’ 𝑅_2\) means processΒ \(𝑃_1\) is waiting for resource \(𝑅_2\) , and so on for others)

Which of the following statement(s) is/are CORRECT?

  1. A.

    AbortingΒ \(P_1\) makes the system deadlock free.

  2. B.

    AbortingΒ \(P_3\) makes the system deadlock free.

  3. C.

    AbortingΒ \(P_2\) makes the system deadlock free.

  4. D.

    AbortingΒ \(P_1\) andΒ \(𝑃_4\) makes the system deadlock free.

Attempted by 121 students.

Show answer & explanation

Correct answer: C, D

Summary: The system has deadlocks represented by cycles in the resource-allocation graph. Correct answers are: aborting P2, and aborting both P1 and P4 (both choices make the system deadlock free). Aborting only P1 or only P3 does not remove all deadlocks.

Identify cycles:

  • Cycle 1: P1 requests R2 (held by P2) β†’ P2 requests R3 (held by P3) β†’ P3 requests R1 (held by P1).

  • Cycle 2: P2 requests R4 (held by P4) β†’ P4 requests R2 (held by P2).

Effect of aborting each process:

  • Aborting P1: frees R1 and breaks Cycle 1, but Cycle 2 (between P2 and P4) remains, so the system is not deadlock free.

  • Aborting P3: frees R3 and breaks Cycle 1, but Cycle 2 (between P2 and P4) remains, so the system is not deadlock free.

  • Aborting P2: removes the common process in both cycles and frees R2. P4 can then obtain R2 and proceed, which frees R4; once R4 (and R3 after P3 proceeds) are available the other processes can complete. Therefore aborting P2 breaks all cycles and makes the system deadlock free.

  • Aborting both P1 and P4: frees R1 and R4, which breaks both Cycle 1 and Cycle 2. After those resources are released, the remaining processes can obtain needed resources and make progress. This is a correct (but not minimal) way to remove all deadlocks.

Final answer:

  • Aborting P2 makes the system deadlock free.

  • Aborting both P1 and P4 also makes the system deadlock free.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir