Question:
In a deadlock, processes never finish executing and system resources are tied up, preventing other jobs from starting. Deadlocks can be characterised by a set of conditions.
a) Describe the four necessary conditions that must hold simultaneously in a system for a deadlock situation to arise.
b) One way of handling deadlock situations is by using a deadlock-avoidance algorithm: Consider that a system always require additional information about how resources are being requested for every process before making a decision on whether to grant the request or not to grant the request. One possible reason for not granting the request is because it will put the system in an unsafe state.
What is the difference between a safe state and an unsafe state in a deadlock-avoidance system?
c) Consider a system with 12 magnetic tape drives and 3 processes: P0, P1, P2. Process P0 requires 10 tape drives, process P1 may need as many as 4, and process P2 may need up to 9 tape drives. Suppose that at time t0, each process is holding 5, 2 and 2 tape drives respectively. This can be illustrated in the table below:
i. Is the system in a safe state at time t0? Clearly explain your answer.
ii. Suppose that at time t1, process P2 requests and is allocated 1 more tape drive. Now, will this allocation put the system in a safe or unsafe state? Clearly explain your answer.