# GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 36

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 Banker’s 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. Then P2, P3 and P4 will run in sequence.

Hence, x = 0 is correct, so option (A) is true.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.