Suppose a system has 12 instances of some resources with n processes competing for that resource. Each process may require 4 instances of the resource. The maximum value of n for which the system never enters into deadlock is
(A) 3
(B) 4
(C) 5
(D) 6
Answer: (A)
Explanation: Given,
Number of resources (R) = 12
Max need for each resource (N) = 3
Since deadlock-free condition is:
R ≥ P(N − 1) + 1
Where R is total number of resources,
P is the number of processes, and
N is the max need for each resource.
12 ≥ P(4 − 1) + 1 11 ≥ 3P 11/3 ≥ P P ≤ 3.66
(Take, floor value for maximum)
Therefore, the largest value of P that will always avoid deadlock is 3.
Option (A) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.