Professional Documents
Culture Documents
lab 8
lab 8
-> Assume that there are 5 processes, P0 through P4, and 4 types of resources. At T0 we
have The following system state:
Given Matrices
Allocation Matrix Max Matrix Available MatrixNot
(No of the Max resources that may Allocated Resources
allocated be used bya process
resources by aprocess)
A B C D A B C D A B C D
P0 0 1 1 0 0 2 1 0 1 5 2 0
P1 1 2 3 1 1 6 5 2
P2 1 3 6 5 2 3 6 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
Total 2 12 14 12
Given Matrices
Safe Available Matrix Not Need Matrix
Sequence Allocated Resources (Max – Allocation)
A B C D A B C D
P0 1 5 2 0 0 1 0 0
1 6 3 0 0 4 2 1
P3 1 12 6 2 1 0 0 1
P1 2 14 9 3 0 0 2 0
P2 3 17 15 8 0 6 4 2
P4 3 17 16 12
Task#2. Use the safety algorithm to test if the system is in a safe state or not?
Task#3. Write the C# code of the given problem.