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?

image.png

  1. A.

    <P1, P2, P3>

  2. B.

    <P1, P3, P2>

  3. C.

    <P2, P1, P3>

  4. 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:

  1. Only P3 can be satisfied with Available (2). After completion, Available becomes 2 + 4 = 6.

  2. Now, P1 or P2 can execute. If P1 runs, Available becomes 6 + 7 = 13.

  3. Finally, P2 runs.

Thus, the safe sequence is <P3, P1, P2>. Correct option is D.

Explore the full course: Niacl Ao It Specialist