Explanation : If Process A’s Maximum need is 1 1 2 1 2 instead of 1 1 2 1 3, then answer will be x=1
The needs matrix is as follows:
0 1 0 0 1
0 2 1 0 0
1 0 3 0 0
0 0 1 1 1
If x is 0, available vector will be 0 0 0 1 1, we have a deadlock immediately.
If x is 1, available vector will be 0 0 1 1 1, now, process D can run to completion. When it is finished, the available vector is 1 1 2 2 1.
Now A can run to complete, the available vector then becomes 2 1 4 3 2.
Then C can run and finish, return the available vector as 3 2 4 4 2.
Then B can run to complete. Safe sequence D A C B.