Consider the following system there are total 12 instances of resources A, 10 instances of resources B and 11 instances of resources C:
Process Allocation Maximum
A B C A B C
P0 0 2 3 3 3 6
P1 2 4 2 2 5 3
P2 3 1 2 3 5 3
P3 5 2 2 6 5 4
If Banker’s algorithm is applied for deadlock avoidance this system is in safe state. Which of the following option will be permitted with additional request?
Note – This question is multiple select questions (MSQ).
(A) Request: P3 – 1 instance of A, 2 instances of B, 3 instances of C
(B) Request: P2 – 1 instance of A, 2 instances of B, 3 instances if C
(C) Request: P1 – 1 instance of A, instances of B, 3 instances of C
(D) Request: P0 – 1 instance of A, 2 instances of B, 3 instances of C
Answer: (A) (B) (D)
Explanation: Currently, the system is in the safe state. When addition requests are made:
Available Instances are
A B C
2 1 2
Request: P3 – 1 instance of A, 2 instances of B, 3 instances of C
Need matrix:
A B C
3 1 3
0 1 1
0 4 1
2 5 5
Since 2 instances of A, 1 instance of B, 2 instances of C.
System is in safe state and start processing from P1.
Request: P2 – 1 instance of A, 2 instances of B, 3 instances of C
Need matrix:
A B C
3 1 3
0 1 1
1 6 4
1 3 2
Since 2 instances of A, 1 instance of B, 2 instances of C.
System is in safe state and start processing from P1.
Request: P1 – 1 instance of A, 2 instances of B, 3 instances of C
Need matrix:
A B C
3 1 3
1 3 4
0 4 1
1 3 2
The system is unsafe. Since 2 instances of A, 1 instance of B, 2 instances of C.
Request: P0 – 1 instance of A, 2 instances of B, 3 instances of C
Need matrix:
A B C
3 3 6
0 1 1
0 4 1
1 3 2
Since 2 instances of A, 1 instance of B, 2 instances of C.
System is in safe state and start processing from P1.
So, request of option (C) will not be permitted.
Option (A), (B), and (D) are correct.
Quiz of this Question