Which of the following statements is/are TRUE with respect to deadlocks?

2022

Which of the following statements is/are TRUE with respect to deadlocks?

  1. A.

    Circular wait is a necessary condition for the formation of deadlock.

  2. B.

    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. C.

    If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.

  4. D.

    In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.

Attempted by 207 students.

Show answer & explanation

Correct answer: A, D

Answer: The true statements are:

  • Circular wait is a necessary condition for the formation of deadlock.

  • In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.

Explanations:

  1. Circular wait is one of Coffman’s four necessary conditions for deadlock: mutual exclusion, hold-and-wait, no preemption, and circular wait. All four conditions must hold for deadlock to be possible; circular wait by itself does not guarantee deadlock.

  2. A cycle in a wait-for graph when resources have multiple instances does not necessarily indicate a deadlock. Processes in the cycle might still obtain additional free instances and complete. A cycle guarantees deadlock only when each resource has exactly one instance.

  3. An unsafe state means the system cannot guarantee that all processes can finish for every possible sequence of future requests. It is not the same as an actual deadlock; deadlock may or may not occur after entering an unsafe state depending on subsequent requests and releases.

  4. If every edge in the resource-allocation graph is an assignment edge, there are no request edges and thus no process is waiting for a resource. Without any waiting processes, the system cannot be in a deadlock state.

Final: The true statements are the ones about circular wait being a necessary condition and about assignment-only edges implying no deadlock.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir