GateAI

GATE CSE Deadlock PYQs

Standard yield9.4% of Operating Systems

Across GATE CS exams from 2014 to 2026, the Deadlock topic is tested through three main angles: mathematical resource bounds using the pigeonhole principle, alg… Read the guide

Questions
11
Asked
since 2014
Total marks
18
Marks / paper
0.7

11 GATE CSE Deadlock PYQs with solutions, from Operating Systems. Browse all GATE CSE PYQs.

Questions

Every official paper that asked this topic, newest first.

What GATE tests in Deadlock

Concepts, patterns, formulas and traps distilled from past papers.

Across GATE CS exams from 2014 to 2026, the Deadlock topic is tested through three main angles: mathematical resource bounds using the pigeonhole principle, algorithmic simulation of Banker's safety and request algorithms, and rigorous conceptual analysis of Coffman conditions, prevention schemes, and Resource Allocation Graphs (RAG). The topic frequently yields both 1-mark and 2-mark questions, with a significant recent pivot toward multi-select questions (MSQ) and code/graph analysis.

Core concepts

  • Four Coffman necessary conditions: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait
  • Deadlock Prevention techniques (strict linear ordering of resources, holding all resources upfront)
  • Deadlock Avoidance via Banker's Safety Algorithm and Resource-Request Algorithm
  • Safe state vs. Unsafe state vs. Deadlocked state hierarchy
  • Resource Allocation Graph (RAG) vs. Wait-For Graph (WFG) and single- vs multi-instance cycle sufficiency
  • Non-reentrant locks and single-thread self-deadlock
  • Deadlock recovery via process termination and preemptive restarts leading to livelock or starvation

Recurring question patterns

  • Minimum Resources or Maximum Demand for Deadlock Freedom

    CommonNAT1 marks2026, 2018, 2014

    Given NN processes each requiring a maximum of MM (or KK) instances of a single resource type, calculate the minimum total resources RR or the maximum demand KK that guarantees the system is deadlock-free using the worst-case allocation principle ∑(Mi−1)+1≤R\sum (M_i - 1) + 1 \le R.

  • Banker's Algorithm State and Request Evaluation

    CommonMCQ2 marks2017, 2014

    Given Allocation and Max matrices along with Available resources, evaluate whether the current state is safe, or simulate dynamic resource request vectors to determine if granting them leaves the system in a safe state with a valid execution sequence.

  • Resource Allocation Graph (RAG) and Cycle Analysis

    OccasionalMSQ2 marks2026, 2025, 2022

    Given a formal set of assignment edges (Rj→PiR_j \rightarrow P_i) and request/claim edges (Pi→RjP_i \rightarrow R_j) with single or multiple instances, detect cycles, evaluate deadlock presence, and determine which process terminations resolve all deadlocked cycles.

  • Deadlock Prevention, Coffman Conditions, and Algorithmic Schemes

    CommonMSQ2 marks2026, 2022, 2021, 2017

    Evaluating formal statements or pseudocode implementations against the four Coffman conditions (Mutual Exclusion, Hold and Wait, No Preemption, Circular Wait), distinguishing avoidance from prevention, and identifying side-effects like livelock and starvation.

Formulas GATE uses

Deadlock-Free Resource Condition (Pigeonhole / Worst-Case Allocation)

R≥∑i=1N(Maxi−1)+1R \ge \sum_{i=1}^{N} (\text{Max}_i - 1) + 1

Used to find the minimum resources RR or maximum demand KK among NN processes to guarantee that deadlock can never occur under single-resource type systems.

Identical Process Demand Deadlock-Free Bound

R≥N(K−1)+1  ⟺  N(K−1)<RR \ge N(K - 1) + 1 \iff N(K - 1) < R

Used when all NN processes have an identical maximum resource claim KK.

Banker's Need Matrix Formula

Need[i][j]=Max[i][j]−Allocation[i][j]\text{Need}[i][j] = \text{Max}[i][j] - \text{Allocation}[i][j]

Used as the first step in Banker's safety and resource-request algorithms to check if Requesti≤Needi\text{Request}_i \le \text{Need}_i and Needi≤Work\text{Need}_i \le \text{Work}.

Examiner traps in Deadlock

  • Confusing 'Unsafe state' with 'Deadlocked state' (an unsafe state does not guarantee that deadlock will definitely occur; it only means safety cannot be guaranteed).
  • Assuming a cycle in a Resource Allocation Graph always implies deadlock (true only for single-instance resource systems; for multi-instance, it is necessary but not sufficient).
  • Mixing up RAG edge directions: Pi → Rj is a Request/Claim edge, whereas Rj → Pi is an Assignment edge.
  • Confusing Deadlock Avoidance (e.g., Banker's Algorithm dynamically checking safe states) with Deadlock Prevention (static invalidation of Coffman conditions).
  • Off-by-one errors in worst-case formulas: forgetting the '+ 1' needed to allow at least one process to finish execution.
  • Assuming multiple threads/locks are mandatory for deadlock: a single thread holding a non-reentrant lock and requesting it again will self-deadlock (x=1, y=1).

How questions are asked

  • Worst-case resource/demand NAT computation
  • Banker's algorithm request granting feasibility MCQ
  • Banker's safety state determination MCQ
  • RAG edge listing and cycle termination MSQ
  • Coffman conditions and prevention schemes MSQ/MCQ
  • Pseudocode protocol concurrency analysis MSQ

Paper trends

  • Shift from standard single-choice tabular Banker's algorithm questions to multi-select conceptual questions (MSQs) testing subtle definitional boundaries and pseudocode analysis.

    2026, 2025, 2022, 2021

  • Introduction of pseudocode implementations involving concurrency primitives (locks, preempt-and-restart schemes) to evaluate livelock, starvation, and deadlock simultaneously.

    2021, 2017

  • Consistent presence of single-resource worst-case capacity numerical questions (NAT) as reliable 1-mark or 2-mark scoring items.

    2026, 2018, 2014

Difficulty notes

Easy questions typically involve direct evaluation of the worst-case pigeonhole formula (R≥∑(Mi−1)+1R \ge \sum(M_i - 1) + 1) or direct standard definitions of Coffman conditions. Medium questions require multi-step Banker's algorithm calculations with tentative state updates, tracing multiple simultaneous cycles in single-instance RAGs to test process abortion subsets, or analyzing pseudocode with locks for livelock and preemption properties.