Coursify

Operating System

PYQ Analysis and Exam Preparation

45 mins

A deep strategic analysis of university exams from 2019 to 2024 for Deadlocks. Discover the guaranteed Banker's Algorithm numericals, the conceptual RAG cycle traps, and the recurring deadlock-free maximum n problems.

Learning Goals

  • Identify the highest-yield topics: Banker's Algorithm (guaranteed 7-mark numerical), four necessary conditions (2-mark frequent), and RAG cycle analysis (conceptual traps).
  • Master the step-by-step Safety Algorithm and Resource-Request procedure to solve any Banker's Algorithm problem.
  • Understand the recurring 'maximum n for deadlock-free' numerical pattern and its formula.
  • Be prepared to justify the statement: 'A cycle in RAG does not always imply deadlock' with a diagram.

Deep Trend Analysis: The Exam Blueprint for Deadlocks

An analysis of 14 exam questions spanning from 2019 to 2024 reveals an extremely predictable pattern for Module 4. The distribution is heavily skewed toward Banker's Algorithm numericals and conceptual understanding of the four conditions.

Topic Weightage Distribution

TopicQuestionsMarks RangeFrequency
Banker's Algorithm (Avoidance)4 (2022, 2023, 2024×2)7 marks eachGuaranteed every year
Four Necessary Conditions + Definitions5 (2019×2, 2022, 2023×2)2-14 marksEvery year
Deadlock Prevention Strategies2 (2022, 2023)7 marksAlternate years
RAG Cycle + Detection2 (2023, 2024)4-7 marksCommon conceptual question
Max n for Deadlock-Free2 (2019, 2023)2-14 marksRecurring numerical pattern

The 3 Key Exam Patterns

1. The Guaranteed Numerical (7 Marks) — Banker's Algorithm Every single year features a Banker's Algorithm numerical. You will be given an Allocation matrix, a Max matrix, and an Available vector. You must:

  • Calculate the Need matrix
  • Determine if the system is in a safe state (find a safe sequence)
  • Sometimes: evaluate whether a specific resource request can be granted

2. The Recurring Numerical (2-14 Marks) — Max n for Deadlock-Free A problem of the form: "System has R units of resource. Each of n processes may need up to K units. What is max n for deadlock-free operation?"

  • Solution: To guarantee no deadlock, the worst case must still allow forward progress: n × (K-1) < R. So maximum n = floor((R-1)/(K-1)).
  • Appeared in 2019 (6 units, each needs 3 → max n = ?) and 2023 (6 tape drives, each needs 2 → max n = ?).

3. The Conceptual Trap (4-7 Marks) — "Cycle ≠ Deadlock" A question asking you to justify or draw: "A cycle in the Resource-Allocation Graph does NOT always imply deadlock." This tests the key insight that with multi-instance resources, a cycle is necessary but not sufficient for deadlock.

Knowledge Check

Question 1 of 4
Q1Single choice

[2022] Which of the following approaches requires knowledge of the system's state in advance?

High-Yield Subjective Bank

Ensure you have a 200-300 word written response prepared for each of these recurring questions:

  1. [2019, 2022, 2023] Define deadlock. List and explain the four necessary conditions (Coffman conditions) for deadlock to occur. Provide an example for each.

  2. [2022, 2023] What are the different deadlock handling mechanisms? Explain any three of: Prevention, Avoidance (Banker's Algorithm), Detection, and Recovery.

  3. [2022, 2023] Give one approach to prevent each of the four necessary conditions for deadlock. Specifically:

    • How to break Mutual Exclusion (spooling)
    • How to break Hold and Wait (request all resources at once)
    • How to break No Preemption (allow preemption with rollback)
    • How to break Circular Wait (resource ordering / total ordering)
  4. [2023, 2024] Justify the statement: "A cycle in the Resource-Allocation Graph does not always imply the occurrence of deadlock." Draw a RAG diagram with a cycle but no deadlock (using multi-instance resources).

  5. [2022, 2024] Explain the core principle behind Deadlock Avoidance. Describe the Banker's Algorithm in detail — data structures (Available, Max, Allocation, Need), Safety Algorithm, and Resource-Request Algorithm. What are its limitations?

The Ultimate Numerical Challenge — Banker's Algorithm

If you can solve this 7-mark question from the 2024 exam, you are ready for the numerical portion. This is the most complex Banker's Algorithm problem in the PYQ set.

Problem Statement: Consider a system with five processes (P₀ through P₄) and four resource types (A, B, C, D). Using the Banker's Algorithm, determine if the system is in a safe state.

ProcessAllocation (A B C D)Max (A B C D)
P₀0 0 1 20 0 1 2
P₁1 0 0 01 7 5 0
P₂1 3 5 42 3 5 6
P₃0 6 3 20 6 5 2
P₄0 0 1 40 6 5 6

Available: (1, 5, 2, 0)

Step-by-Step Solution:

Step 1: Calculate the Need Matrix (Need = Max − Allocation)

ProcessNeed (A B C D)
P₀(0, 0, 0, 0)
P₁(0, 7, 5, 0)
P₂(1, 0, 0, 2)
P₃(0, 0, 2, 0)
P₄(0, 6, 4, 2)

Step 2: Apply Safety Algorithm

Work = Available = (1, 5, 2, 0)

  • P₀: Need (0,0,0,0) ≤ Work (1,5,2,0) ✓ → P₀ can finish. After P₀: Work = (1+0, 5+0, 2+1, 0+2) = (1, 5, 3, 2). Finish[P₀] = true.
  • P₂: Need (1,0,0,2) ≤ Work (1,5,3,2) ✓ → P₂ can finish. After P₂: Work = (1+1, 5+3, 3+5, 2+4) = (2, 8, 8, 6). Finish[P₂] = true.
  • P₃: Need (0,0,2,0) ≤ Work (2,8,8,6) ✓ → P₃ can finish. After P₃: Work = (2+0, 8+6, 8+3, 6+2) = (2, 14, 11, 8). Finish[P₃] = true.
  • P₁: Need (0,7,5,0) ≤ Work (2,14,11,8) ✓ → P₁ can finish. After P₁: Work = (2+1, 14+0, 11+0, 8+0) = (3, 14, 11, 8). Finish[P₁] = true.
  • P₄: Need (0,6,4,2) ≤ Work (3,14,11,8) ✓ → P₄ can finish. After P₄: Work = (3+0, 14+0, 11+1, 8+4) = (3, 14, 12, 12). Finish[P₄] = true.

Result: All processes can finish. Safe sequence exists: <P₀, P₂, P₃, P₁, P₄>. The system is in a safe state.

Practice More: Additional PYQs to Solve

Try these on your own:

Problem 1 [2023, 7 marks]: System with 5 processes (P₀-P₄) and 3 resources (A=10, B=5, C=7). Given Allocation, Max, and Available = (3,3,2), determine if safe. Then: P₁ requests (1,0,2) — can it be granted?

ProcessAllocation (A B C)Max (A B C)
P₀0 1 07 5 3
P₁2 0 03 2 2
P₂3 0 29 0 2
P₃2 1 12 2 2
P₄0 0 24 3 3

Problem 2 [2022, 7 marks]: Single processor, 3 resources (X, Y, Z) with 5 units each. Given Allocation and Request, find which process finishes first and last.

ProcessAllocation (X Y Z)Request (X Y Z)
P₀1 2 11 0 3
P₁2 0 10 1 2
P₂2 2 11 2 0

Problem 3 [2019, 14 marks]: A system contains 6 units of a resource, and n processes that use the resource. What is the maximum value of n for which the system will be deadlock-free if the maximum requirement of each process is 3?

To view complete PYQ, go here: https://pyqdeck.in/it/it_sem5/it_sem5_106503/practice/chapter/