- 2074 Bhadra · 1+1+3+3+2 marks
Deadlock, postponement, prevention, 2 processes
Short answer
Deadlock is a circular wait for resources; indefinite postponement is starvation. The four conditions are mutual exclusion, hold and wait, no preemption, and circular wait. Prevention attacks one condition via spooling, requesting all resources at once, allowing preemption, or resource ordering. With two processes each needing max two of three resources, deadlock is impossible because at least one process can always obtain its maximum need.
What is Deadlock and indefinite Postponement? Explain the necessary conditions for deadlock and explain how deadlock can be prevented. A system has 2 processes and 3 resources. Each process needs maximum of two resources. Is deadlock possible? Explain.
Deadlock (1 mark)
Deadlock is a state where each process of a set waits for a resource held by another process of the set, so none can continue.
Indefinite postponement (1 mark)
A process is delayed repeatedly, for an unbounded time, while other processes are served (also called starvation). Example: a low-priority process never scheduled because high-priority ones keep arriving. Unlike deadlock, the system as a whole keeps working.
Necessary conditions (3 marks)
- Mutual exclusion: a resource is used by one process at a time.
- Hold and wait: a process holds resources while requesting more.
- No preemption: a resource cannot be taken away forcibly.
- Circular wait: a circular chain of waiting processes exists.
Prevention (3 marks)
- Remove mutual exclusion by spooling.
- Remove hold and wait: request all resources at once.
- Allow preemption of resources.
- Impose a total ordering on resources and request in order, which prevents circular wait.
Two processes, three resources (2 marks)
Each process needs at most 2 resources. Worst case: each process holds 1 resource and waits for its second one. Together they hold 2 resources, so 3 − 2 = 1 resource is free. That free resource can be given to either process, which then has its 2 resources, finishes and releases both. The other process then gets its second resource.
P1 holds 1 | P2 holds 1 | 1 free
give free to P1 -> P1 finishes, releases 2
P2 now gets its second -> finishes
In general, deadlock-free if Σ(maxᵢ − 1) + 1 ≤ R, i.e. (2−1)+(2−1)+1 = 3 ≤ 3.
Answer: Deadlock is not possible, because at least one process can always obtain its maximum need.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Deadlock vs postponement; Banker's 4 resources · Operating System, chapter 7
- Necessary conditions; deadlock prevention · Operating System, chapter 7
- Deadlock conditions; Banker's with 4 processes · Operating System, chapter 7
- Deadlock; necessary conditions with examples · Operating System, chapter 7
- Deadlock conditions and why all necessary · Operating System, chapter 7
- Four deadlock conditions; prevention, recovery · Operating System, chapter 7
- Deadlock and Coffman conditions · Embedded System, chapter 6 · asked 4×
- Deadlock and its conditions · Microprocessor, chapter 6 · asked 2×
- Capital budgeting needs, steps, process · Project Engineering, chapter 6
- Air-fuel mixture needs at different operating conditions · Automotive Technology, chapter 2