\(π = \{π_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?
- A.
AbortingΒ
\(P_1\)makes the system deadlock free. - B.
AbortingΒ
\(P_3\)makes the system deadlock free. - C.
AbortingΒ
\(P_2\)makes the system deadlock free. - 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.