Professional Documents
Culture Documents
sample-604-2
sample-604-2
sample-604-2
Deadline
Assignment # 02
June 24, 2024
Spring 2024
Solution File
MC210201430
Part 1:
Total Resources:
A: 7
B: 2
C: 3
Allocation Matrix:
( )
A BC
010
201
302
Allocated Resources:
A: 0+2+3 = 5
B: 1+0+0 = 1
C: 0+1+2 = 3
Then subtract these from the total resources:
A: 7 – 5 = 2
B: 2 – 1 = 1
C: 3 – 3 = 0
( )
A BC
612
312
502
Allocation Matrix:
( )
A BC
010
201
302
( )
A BC
6 −0 1 −1 2− 0
3 −2 1 −0 2 −1
5 −3 0 −0 2 −2
( )
A BC
602
1 11
200
Part 2:
1. Determine if the current system state is safe.
[ 21 0 ]
Need Matrix:
( )
A BC
602
1 11
200
Allocation Matrix:
( )
A BC
010
201
302
Check P0:
Need: [ 6 , 0 , 2 ]
Available: [ 2 ,1 , 0 ]
Check P1:
Need: [ 1 ,1 , 1 ]
Available: [ 2 ,1 , 0 ]
Need: [ 2 , 0 ,0 ]
Available: [ 2 ,1 , 0 ]
Check P0 again:
Need: [ 6 , 0 , 2 ]
Available: [ 5 ,1 , 2 ]
Check P1 again:
Need: [ 1 ,1 , 1 ]
Available: [ 5 ,1 , 2 ]
Check P0 again:
Need: [ 6 , 0 , 2 ]
Available: [ 7 , 1, 3 ]
Since all processes can finish , the system is in safe state . The safe sequence
is :