Suppose there are four processes in execution with 12 instances of a Resource R in a system. The maximum need of each process and current allocation are…
Suppose there are four processes in execution with 12 instances of a Resource R in a system. The maximum need of each process and current allocation are given below:
Process | Max. Need | Current Allocation
P₁ | 8 | 3
P₂ | 9 | 4
P₃ | 5 | 2
P₄ | 3 | 1
With reference to current allocation, is system safe? If so, what is the safe sequence?
Show answerHide answer
Correct answer: (C) Yes, P₄ P₃ P₁ P₂
Explanation
Remaining need = Max need – Current allocation: P₁ = 5, P₂ = 5, P₃ = 3, P₄ = 2. Total allocated = 10, so available = 12 – 10 = 2. Satisfy P₄ (need 2), it releases 3 → available 4. Satisfy P₃ (need 3), releases 5 → available 7 (after P₃ completes). Then P₁ and P₂ can be satisfied similarly. Hence the safe sequence is P₄, P₃, P₁, P₂.