Explain like I'm five · Systems

What is Deadlock and Starvation?

Deadlock and starvation, told as a story about two mechanics each holding a key the other needs.

I need the other one's key to finish…mechanic 1 waits for key 2, mechanic 2 waits for key 1neither lets go of their own key — each just stares at the other's

Two mechanics each hold a different key and wait for the other's.Neither lets go — each just stares at the other's key.

FOUR CONDITIONSmutual exclusion: one holder onlyhold & wait: keep one, wait for moreno preemption: a held key can't be seizedcircular wait: waiting in a loopall four must hold at once for a freezebreak just one, and deadlock can't happen

Deadlock needs all four conditions to hold at once.Break just one, and deadlock can't happen.

deadlock = freezing forever while each waits on the other's keyneither can move — not without someone stepping in

Deadlock = freezing forever while each waits on the other's key.Neither can move — not without someone stepping in.

Mutual Exclusiononly one holder per key at a time
Hold & Waitkeep what you have, wait for more
No Preemptiona held key can't be seized by force
Circular Waiteveryone waits in a loop
RESOLUTION STRATEGIESprevention: break one condition upfrontavoidance: allow only safe orderingsdetection+recovery: find it, roll one backignore: rare enough to just live withthe chief picks one to fit the situationin practice, "ignore" (the ostrich algorithm) is a common choice

There are four strategies for handling deadlock.In practice, "ignore" (the ostrich algorithm) is common.

JOB QUEUEurgent #9urgent #10urgent #11when is MY car ever…urgent cars keep cutting in, so the low-priority car's turn never comesthe garage keeps running — only this car's turn never comes (starvation)

Starvation — the garage keeps running, but one car keeps getting bumped.The garage isn't frozen — only this car's turn never arrives.

In one breath

Deadlock = freezing forever as each side holds one resource (key) and waits on another. Starvation isn't frozen — one side just never gets its turn.

Deadlock arises when four conditions hold at once: Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait. Fixes include prevention (design away one condition), avoidance (allow only safe states, as in the banker's algorithm), detection-and-recovery, or simply ignoring it (the ostrich algorithm). Starvation differs from deadlock: the system keeps running, but one process never gets the resource it needs because of scheduling or priority.

When grown-ups say it

Mutual Exclusion
One key, one holder at a time. One of the four conditions for deadlock.
Circular Wait
Everyone waiting in a loop for the next one's key. Break this waiting loop, and the deadlock breaks too.
Starvation
One car keeps getting bumped down the order. Not a freeze — an endless postponement.
CPU Scheduling
The rule that sets the car order on the board. A priority rule can itself cause starvation. → who gets the lift first
Synchronization
The rule for handing out the lift key. Deadlock often comes from misusing synchronization tools. → there's only one lift key
Process/Thread
Several hands working the same car. Deadlock can happen between threads or between processes. → one car, many hands
Virtual Memory
A fake map that makes the whole warehouse look like mine. Another example of sharing a limited resource. → the fake map that makes the whole warehouse yours
Orchestration
The SRE field's version of ordering work. Distributed systems handle resource deadlock in a similar spirit. → orchestration in the SRE field
Next story
The Hundred-Hand Helper Crew →
Want another term as a picture book? Request →