Tutorial 5 Chapter OS Deadlockver2
Tutorial 5 Chapter OS Deadlockver2
a) Show that the four necessary conditions for deadlock indeed hold in this example.
2. a) What are the necessary conditions fro a deadlock to occur? Elaborate your
answer.
b) When is a system in a safe state?
3. We can have deadlock detection methods and also deadlock avoidance mechanisms. How
would a deadlock avoidance mechanism run?
Table 1
Process Current Outstanding Resources
Allocation Requests Available
A B C A B C A B C
P1 2 0 0 1 1 0 0 0 0
P2 3 1 0 0 0 0
P3 1 3 0 0 0 1
P4 0 1 1 0 1 0
Available 10 2 1
7. Consider the following system with 5 processes, P0 through P4 and four resource types,
A,B,C,D. At time T0, the following snapshot of the system was taken:
P1 1200 2200
P2 5310 5320
P3 0142 0272
P4 3250 3361
(i) Is the system in a safe state? Show a safe sequence, if one exists.
(ii) Assume P1 request (2, 1, 2).
Should the system satisfy the request of P1?
Illustrate in details.
(iii) Assume P1 returns back the resources in (ii) i.e. (2, 1, 2), and P2 request (1, 0, 1).
Should the system satisfy the request of P1?
Illustrate in details