Last Updated : 26 Oct, 2018

Consider the following system:

Process    Allocation         Maximum         Available
          A  B  C           A  B  C           A   B   C
P0        0  1  2           2  2  3           x   4   2
P1        1  3  1           1  4  2
P2        2  0  1           2  4  2
P3        4  1  1           5  4  3
P4        1  1  1           1  3  3

Find the minimum value of x for deadlock free system?

(A) 0
(B) 1
(C) 3
(D) The system is always in unsafe state.


Answer: (A)

Explanation: According to Bankers algorithm,
Need matrix = maximum matrix – Allocation matrix

\"\"

We need minimum A = 0, B = 1, and C = 1 to execute a process (i.e., P1). Process P1 P2 and P3 can easily executed With available resources. Process P1 execute first
Then available resources will be A = 2, B = 8, and C = 2.
Now process P0 will execute and available resources A = 4, B = 10, and C = 5.
Now P2, P3 and P4 will run in sequence.

So, option (A) is correct.


Quiz of this Question


Share your thoughts in the comments