Académique Documents
Professionnel Documents
Culture Documents
Given the following Resource-Allocation Graph (RAG) as in Figure 1, identify set for
edges, E.
R1
P1
P2
P0
P3
R2
3.
i)
What are the necessary conditions fro a deadlock to occur? Elaborate your answer.
ii)
4.
Consider a system with 4 processes P0 through P3, 3 resource types A, B, and C, and the
current state at t0 as shown in Table 1. Hint: Safety algorithm and Resource-request
algorithm in Appendix 1.
Allocation
A
B
C
2
0
0
3
1
2
2
1
1
1
3
1
A
4
5
2
1
Max
B
2
3
3
4
C
1
5
2
5
i)
ii)
Execute the safety algorithm to determine either the system is in safe or unsafe
state and write the safe sequence (if safe state). Show all your workings.
iii)
iv)
After P1s request is fulfilled in question (iii), P3 makes the following request,
Request3 = (0, 0, 1). Can the system grant the request of P3 using resource-request
algorithm and safety algorithm? Explain your answer.
5.
Consider a system with 4 processes P0 through P3, 3 resource types A, B, and C, and the
current state at t0 as shown in Table 2. Hint: Safety algorithm and Resource-request
algorithm in Appendix 1.
Table 2: Process allocation
Process
P0
P1
P2
P3
Total
A
0
1
2
0
Max
B
0
7
3
6
C
1
5
5
5
Allocation
A
B
C
0
0
1
1
0
0
1
3
5
0
6
3
2
9
9
Available
A
B
C
i)
ii)
iii)
iv)
If a request from process P1 arrives for additional resources of (0, 5, 2), can the
Banker's algorithm grant the request immediately?
v)
What would be the new system state after the allocation (Table 3)?
A
0
1
2
0
Max
B
0
7
3
6
C
1
5
5
5
Allocation
A
B
C
Available
A
B
C
APPENDIX 1
Safety Algorithm
1.
2.
3.
4.
Finish[i] == true
Go to step 2.
If Finish[i] == true for all i then the system in
safe state.
Resource-Request Algorithm
1.
2.
3.
4.