VOOZH about

URL: https://www.geeksforgeeks.org/operating-systems/difference-between-deadlock-and-starvation-in-os/

⇱ Deadlock vs Starvation in OS - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Deadlock vs Starvation in OS

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:

  • 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:

  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

  • 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 executedHigh priority processes keep executing and low priority processes are blocked
Resources are blocked by the processesResources are continuously utilized by high priority processes
Necessary conditions Mutual Exclusion, Hold and Wait, No preemption, Circular WaitPoor implementation of scheduling causes starvation like purely based on priority or random selection.
Also known as Circular waitAlso known as lived lock
It can be prevented by avoiding the necessary conditions for deadlockIt can be prevented by Aging
Comment