3,261 views

Which of the following statements is/are $\text{TRUE}$ with respect to deadlocks?

1. Circular wait is a necessary condition for the formation of deadlock.
2. In a system where each resource has more than one instance, a cycle in its wait-for graph indicates the presence of a deadlock.
3. If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.
4. In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.

Option A, D

1. Circular Wait is one of the four necessary conditions for deadlock to happen. True

2. Not necessarily, if every resource had only a single instance then, a cycle would’ve been necessary and sufficient for a deadlock to occur. A Cycle in a multi-instance resource is necessary but isn’t sufficient and in this case, each resource is made up of more than one instance, a simple contradiction. False

3. An Unsafe state is where no method of allocation of resources can prevent deadlock from happening. Whereas in a safe state, there exists a method of allocation in which all processes are complete. False

4. Resource Allocation graph accommodates future resource requirements in the form of request edges. If there are no request edges, then resource requirements for all the processes are satisfied. True

Ans is : Option A, D.

1. The four necessary conditions for deadlock to happen are: Mutual Exclusion, Hold and Wait, No Pre-emption, Circular Wait. Hence option A is True.

1. Here they have asked about wait-for graph. A wait-for graph is a directed graph used for deadlock detection in operating systems and relational database systems (Wikipedia).Every cycle in a multi-instance resource type (In a system where each resource has more than one instance) wait-for graph is not a deadlock. But if there has to be a deadlock, there has to be a cycle. So, cycle is a necessary, but not sufficient condition for deadlock to happen in case of multi-instance graph. Hence option B is False.

1. Every unsafe state doesn’t necessarily mean that a deadlock would occur. Deadlock is a subset of an unsafe state. Hence option C is False.

1. In Resource Allocation graph, if every edge is an assignment edge, it means there are no future resource requirements. So the resources requirements of all the processes are already satisfied. The necessary condition of Hold and Wait is not fulfilled, as system is not waiting for any resource. Hence deadlock cannot occur. Therefore, option D is True.

### 1 comment

Best explanation!! :-)