Problems and Solution_Bankers Algorithm
Problems and Solution_Bankers Algorithm
Total resources:
X=5
Y=5
Z=5
Allocated resources:
P0: 1 2 1
P1: 2 0 1
P2: 2 2 1
Total allocated:
X=1+2+2=5
Y=2+0+2=4
Z=1+1+1=3
X=5-5=0
Y=5-4=1
Z=5-3=2
Needs ≤ Available ✅
→ Can finish
P1 → P0 → P2
Thus, P2 finishes last.
Allocation Matrix:
Process A B C
P0 010
P1 200
P2 302
P3 211
P4 002
Maximum Matrix:
Process A B C
P0 753
P1 322
P2 902
P3 222
P4 433
Question:
Solution:
🔹 Given:
Total Resources:
A = 10
B=5
C=7
P0 010
P1 200
P2 302
P3 211
P4 002
Total Allocated:
A = 0+2+3+2+0 = 7
B = 1+0+0+1+0 = 2
C = 0+0+2+1+2 = 5
A = 10 - 7 = 3
B=5-2=3
C=7-5=2
Available = (3, 3, 2)
Process A B C
✅ Safe Sequence:
P1 → P3 → P4 → P0 → P2
Question:
System:
Total resources: A = 7, B = 2, C = 6
Allocation Matrix:
Process A B C
P0 010
P1 201
P2 303
Maximum Matrix:
Process A B C
P0 312
P1 413
P2 315
Questions:
3. Determine if the system is in a safe state and find one or more safe sequences.
System:
Allocation Matrix:
Process A B C
P0 010
P1 200
P2 303
P3 211
Maximum Matrix:
Process A B C
P0 632
P1 322
P2 904
P3 422
Questions: