---
title: "Deadlock vs postponement; Banker's 4 resources"
subject: "Operating System"
chapter: 7
key: "semester_6/operating_system:deadlock-vs-postponement-banker-6442"
source: https://www.bctengineer.com/q/semester_6/operating_system/deadlock-vs-postponement-banker-6442
site: BCT Engineering
---

# Deadlock vs postponement; Banker's 4 resources

Operating System · Chapter 7: Deadlock

- Asked in: 2073 Bhadra, 3+7 marks
- Video: [Operating System Deadlock Numerical Part 1](https://www.youtube.com/watch?v=btWElRl0RrU) — IT-TECHIEZ
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/deadlock-vs-postponement-banker-6442
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-7

## Question

What is the difference between deadlock and indefinite postponement? Consider a system with 5 concurrent processes (P0, P1, P2, P3, P4) and 4 resource types (R0, R1, R2, R3). The number of instances of each resource type in the system are 6, 4, 4, 2 respectively. Allocation table and Maximum claim table are as follows:
| Process | Allocation (R0 R1 R2 R3) | Maximum claim (R0 R1 R2 R3) |
|---|---|---|
| P0 | 2 0 1 1 | 3 2 1 1 |
| P1 | 1 1 0 0 | 1 2 0 2 |
| P2 | 1 1 0 0 | 1 1 2 0 |
| P3 | 1 0 1 0 | 3 2 1 0 |
| P4 | 0 1 0 1 | 2 1 0 1 |
Is the state safe? If so, show the safe execution of the processes.

## Short answer

Deadlock involves a cycle of waiting processes, while indefinite postponement (starvation) is a single process waiting long due to unfair scheduling. The system's total instances (6,4,4,2) give Available (1,1,2,0). Banker's algorithm yields the safe sequence P2, P0, P3, P4, P1. The state is safe.

## Answer

#### Deadlock vs indefinite postponement
| Point | Deadlock | Indefinite postponement (starvation) |
|---|---|---|
| Meaning | Processes wait forever for each other's resources | A process waits for a long, unbounded time because others are always preferred |
| Cause | Four conditions hold together (circular wait etc.) | Unfair scheduling or resource allocation policy |
| Processes affected | All processes in the cycle | Usually one or a few low-priority processes |
| Other processes | Cannot proceed in the set | Others continue normally |
| Resolution | Needs prevention, avoidance or recovery | Aging, fair policy (FCFS queue) |
| Example | P holds printer, wants scanner; Q the reverse | Low priority job never gets CPU; SSTF disk request far away |

#### Banker's algorithm
Total = (6, 4, 4, 2). Sum of Allocation = (5, 3, 2, 2), so Available = (1, 1, 2, 0).

Need = Max − Allocation:

| Process | Allocation | Max | Need |
|---|---|---|---|
| P0 | 2 0 1 1 | 3 2 1 1 | 1 2 0 0 |
| P1 | 1 1 0 0 | 1 2 0 2 | 0 1 0 2 |
| P2 | 1 1 0 0 | 1 1 2 0 | 0 0 2 0 |
| P3 | 1 0 1 0 | 3 2 1 0 | 2 2 0 0 |
| P4 | 0 1 0 1 | 2 1 0 1 | 2 0 0 0 |

Work = (1, 1, 2, 0)

| Step | Process | Need | Need ≤ Work | Work after |
|---|---|---|---|---|
| 1 | P2 | 0 0 2 0 | yes | 1 1 2 0 + 1 1 0 0 = 2 2 2 0 |
| 2 | P0 | 1 2 0 0 | yes | 2 2 2 0 + 2 0 1 1 = 4 2 3 1 |
| 3 | P3 | 2 2 0 0 | yes | 4 2 3 1 + 1 0 1 0 = 5 2 4 1 |
| 4 | P4 | 2 0 0 0 | yes | 5 2 4 1 + 0 1 0 1 = 5 3 4 2 |
| 5 | P1 | 0 1 0 2 | yes | 5 3 4 2 + 1 1 0 0 = 6 4 4 2 |

All processes finish and Work equals the total (6, 4, 4, 2).

**Answer: The state is SAFE. Safe sequence: P2 → P0 → P3 → P4 → P1.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which statement correctly separates deadlock from indefinite postponement?
   A. Deadlock is caused by unfair scheduling; postponement by circular wait
   B. Both need all four necessary conditions
   C. Postponement stops every process; deadlock affects one
   D. In deadlock the processes in the cycle all wait forever; in postponement usually one low-priority process waits while others proceed
   Answer: D. Deadlock involves a set of mutually waiting processes; starvation is caused by an unfair policy and fixed by aging. (Key point: Deadlock vs starvation)

2. Total = (6,4,4,2) and allocation sums to (5,3,2,2). What is Available?
   A. (1, 1, 2, 0)
   B. (5, 3, 2, 2)
   C. (1, 1, 2, 2)
   D. (0, 1, 2, 0)
   Answer: A. Available = Total - sum of Allocation = (1,1,2,0). (Key point: Available vector)

3. How is Need computed and what is P2's Need?
   A. Allocation - Max; P2 needs (0,0,2,0)
   B. Max - Allocation; P2 needs (0,0,2,0)
   C. Max - Allocation; P2 needs (1,1,2,0)
   D. Max + Allocation; P2 needs (2,2,2,0)
   Answer: B. P2 Max (1,1,2,0) minus Allocation (1,1,0,0) gives (0,0,2,0). (Key point: Need matrix)

4. Which is the safe sequence found and why does P2 go first?
   A. P0, P1, P2, P3, P4; processes are taken in index order
   B. P1, P0, P2, P3, P4; P1 has the smallest Need
   C. P2, P0, P3, P4, P1; only P2's Need (0,0,2,0) fits within Work (1,1,2,0)
   D. The state is unsafe because Available has a zero
   Answer: C. At the start only P2's Need is <= Work; after each finish its Allocation is added to Work until it equals the total (6,4,4,2). (Key point: Safe sequence)

## Related in Operating System

- [Deadlock conditions; Banker's with 4 processes](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afour-conditions-banker-p1-p4) — Operating System, chapter 7
- [Deadlock conditions; Banker's safe sequence](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afour-conditions-banker-snapshot-332) — Operating System, chapter 7
- [Deadlock, postponement, prevention, 2 processes](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adeadlock-postponement-two-process-three-resource) — Operating System, chapter 7
- [Banker's algorithm, 5 processes, 4 resources](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Abanker-five-process-four-resource) — Operating System, chapter 7
- [Deadlock detection with allocation matrices](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adeadlock-detection-matrices) — Operating System, chapter 7

## Related in other subjects

- [Show i1 = i2 = -V/(R1+R2+R3) at t=0+](https://www.bctengineer.com/question.md?key=semester_3%2Felectrical_circuit_theory%3Aswitch-a-to-b-initial-values) — Electrical Circuit Theory, chapter 2
- [Get data from P0, send to P1 (asm and C)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3A8051-p0-to-p1-assembly-c) — Embedded System, chapter 9
- [Liang-Barsky: P1(-5,3), P2(15,9)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aliang-barsky-0-0-10-10) — Computer Graphics, chapter 3
- [Non-preemptive SJF with P4 arriving](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-sjf-nonpreemptive-6-8-2) — Embedded System, chapter 6, asked 2×
