IAE Academy

GATE 2022 CS Q.26: solution and answer

GATE 2022 · CSQ.26 · 1 mark · MSQ

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.

See the question in the paper

Answer and solution

ANSWER

The true statements are (A) and (D).

Official answer: A, DSource: Official answer key, GATE 2022 CS (IIT Kharagpur)

  1. (A) Deadlock needs all four Coffman conditions at once: mutual exclusion, hold and wait, no preemption and circular wait. So circular wait is a necessary condition. TRUE.

  2. (B) When a resource has several instances, a cycle in the wait-for graph is necessary but not sufficient. A process in the cycle may be waiting for a resource that a process outside the cycle holds and will release. A cycle means deadlock only when every resource has a single instance. FALSE.

  3. (C) An unsafe state means no safe sequence exists, so deadlock is possible but not certain. Processes may release resources before they make their maximum requests. FALSE.

  4. (D) An assignment edge goes from a resource to a process. If every edge is an assignment edge, there are no request edges, so no process is waiting. A deadlock needs at least one blocked process, so there is no deadlock. TRUE.

  5. Correct options: A and D.

KEY IDEA

Circular wait is necessary for deadlock. A cycle proves deadlock only with single-instance resources. An unsafe state means deadlock may happen, not that it must.

WATCH OUT FOR

Treating any cycle in a graph as a deadlock when resources have several instances. Treating an unsafe state as a deadlock that has already happened or must happen.

From the GATE 2022 CS paper. Every question of this paper · Download the full paper · All 6 Deadlock questions, with notes

More Deadlock questions