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:

  1. **Mutual Exclusion → Resources cannot be shared.
  2. **Hold and Wait → A process holds one resource and waits for another.
  3. **No Preemption → Resources cannot be forcibly taken back.
  4. **Circular Wait → A circular chain of processes waiting.

Deadlock

**Example:

**Two cars on a narrow bridge:

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:

  1. **Priority-Based Scheduling – cause of starvation
  2. **Indefinite Blocking – cause of starvation
  3. **Continuous High-Priority Arrival – cause of starvation
  4. **Unequal Resource Allocation – cause of starvation

Priority

Starvation

**Example:

CPU Scheduling in a Server

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