A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:
Allocated Maximum Available Process A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1 Process B 2 0 1 1 0 2 2 2 1 0 Process C 1 1 0 1 0 2 1 3 1 0 Process D 1 1 1 1 0 1 1 2 2 1 The smallest value of x for which the above system in safe state is __________.
(A) 1
(B) 3
(C) 2
(D) Not safe for any value of x.
Answer: (D)
Explanation:
Allocated Maximum Available Need Process A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1 0 1 0 0 2 Process B 2 0 1 1 0 2 2 2 1 0 0 2 1 0 0 Process C 1 1 0 1 0 2 1 3 1 0 1 0 3 0 0 Process D 1 1 1 1 0 1 1 2 2 1 0 0 1 1 1 The smallest value of x for which the above system in safe state is __________.
For x = 1 process D will execute and free 1 1 2 2 1 instances. Now none of the other process will execute.
let x = 2 then process D will execute and free 1 1 3 2 1 instances. Now process C will execute and free 2 2 3 3 1 instances. With these free instances process B will execute, but process A will not execute because 5 resources needs 2 instances which will never be satisfied. That’s why system is not in safe state.
So, option (D) is correct.
Quiz of this Question