Given total number of instances of a resource to be 18, three processes (P1,…
2017
Given total number of instances of a resource to be 18, three processes (P1, P2, and P3) and the resource requirement and allocation table are given below. Which of the following orders of process execution forms a safe (deadlock free) sequence?

- A.
<P1, P2, P3>
- B.
<P1, P3, P2>
- C.
<P2, P1, P3>
- D.
<P3, P1, P2>
Attempted by 106 students.
Show answer & explanation
Correct answer: D
Total Instances: 18
Total Allocated: 7 + 5 + 4 = 16
Available Instances: 18 - 16 = 2
Let's calculate the Remaining Need (Max - Allocation):
P1: 12 - 7 = 5
P2: 10 - 5 = 5
P3: 5 - 4 = 1
Step-by-step Execution:
Only P3 can be satisfied with Available (2). After completion, Available becomes 2 + 4 = 6.
Now, P1 or P2 can execute. If P1 runs, Available becomes 6 + 7 = 13.
Finally, P2 runs.
Thus, the safe sequence is <P3, P1, P2>. Correct option is D.