Deadlock vs Starvation in OS (original) (raw)
Last Updated : 5 Dec, 2025
Deadlock and starvation are two different process-scheduling problems. In a deadlock, processes wait forever because each is holding a resource the other needs. In starvation, some processes wait indefinitely because higher-priority processes monopolise resources.
Deadlock
Deadlock is a condition in an operating system where two or more processes are permanently blocked because each process is waiting for a resource that is held by another process, forming a circular waiting chain, and none of them can proceed.
The 4 conditions for Deadlock:
- **Mutual Exclusion → Resources cannot be shared.
- **Hold and Wait → A process holds one resource and waits for another.
- **No Preemption → Resources cannot be forcibly taken back.
- **Circular Wait → A circular chain of processes waiting.

**Example:
**Two cars on a narrow bridge:
- Car A enters from left → blocks Car B
- Car B enters from right → blocks Car A
Both need the other to move back, but neither can → **Deadlock.
Starvation
Starvation is a state that prevents lower-precedence processes from getting the resources. Starvation arises when procedures with critical importance keep on utilizing the resources frequently. Starvation can be cured using a technique that is regarded as **aging.
In aging, priority of process increases with time and thus guarantees that poor processes will equally run in the system.
The 4 common causes:
- **Priority-Based Scheduling – cause of starvation
- **Indefinite Blocking – cause of starvation
- **Continuous High-Priority Arrival – cause of starvation
- **Unequal Resource Allocation – cause of starvation

Starvation
**Example:
CPU Scheduling in a Server
- A server uses **priority scheduling to handle tasks.
- If high-priority requests keep coming from premium users, low-priority tasks (free users) may never get CPU time → Starvation.
| Deadlock | Starvation |
|---|---|
| All processes keep waiting for each other to complete and none get executed | High priority processes keep executing and low priority processes are blocked |
| Resources are blocked by the processes | Resources are continuously utilized by high priority processes |
| Necessary conditions Mutual Exclusion, Hold and Wait, No preemption, Circular Wait | Poor implementation of scheduling causes starvation like purely based on priority or random selection. |
| Also known as Circular wait | Also known as lived lock |
| It can be prevented by avoiding the necessary conditions for deadlock | It can be prevented by Aging |