Deadlock vs livelock vs starvation — how do you tell them apart and fix each?
Reviewed by Gurusankar M.
Short Answer
Deadlock: threads block forever in a cycle (no progress, no CPU). Livelock: threads keep responding to each other and changing state but make no progress (busy, high CPU). Starvation: a thread never gets scheduled/the lock. Fixes: lock ordering, randomized backoff, and fairness respectively.
On this page
Concept Made Simple
Coffee Chat Question
“Deadlock vs livelock vs starvation — how do you tell them apart and fix each?”
Remember It Faster
Mind Map Answer
- Deadlock
- stuck blocked, 0% CPU — break the cycle
- Livelock
- active but no progress — add backoff/jitter
- Starvation
- never scheduled — use fairness/priority
Think Beyond the Expected
What If?
Threads are at 100% CPU but throughput is zero and no deadlock is reported — what is it?
Likely livelock: threads keep retrying/yielding in response to each other (e.g. both back off and retry in lockstep) so they never make progress. Add randomized/exponential backoff so they desynchronize, or impose ordering.
Real World
Retry storms and politely-yielding lock-acquisition loops cause livelock; starvation shows up under unfair locks where one thread monopolizes a resource. Backoff-with-jitter and fairness are the standard cures.
Interviewer's Expectation
Keywords they're listening for:
- blocked vs busy
- deadlock cycle
- livelock no-progress
- starvation scheduling
- backoff/jitter/fairness fixes
Common Mistakes
- Treating livelock as deadlock (different fix)
- Retrying without backoff (retry storms)
- Ignoring fairness for hot shared resources
Best Practices
- Backoff with jitter on contention/retry
- Use fair locks/queues where starvation is a risk
- Correlate CPU usage with progress to classify
Follow-up Questions
- How does exponential backoff with jitter break livelock?
- How do fair locks prevent starvation (and what do they cost)?
- How do you distinguish these in a thread dump + CPU profile?
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: Deadlocks (Multithreading) Interview question: "Deadlock vs livelock vs starvation — how do you tell them apart and fix each?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
Affiliate links
Tools for Your Developer Workspace
Equipment for a comfortable, productive setup.
As an Amazon Associate I earn from qualifying purchases.
- MonitorView on Amazon : BenQ EW2790U 27-inch Monitor (opens in a new tab)
BenQ EW2790U 27-inch Monitor
- LaptopView on Amazon : Acer Aspire One Laptop (opens in a new tab)
Acer Aspire One Laptop
- Office ChairView on Amazon : Wakefit Gravita Ergonomic Office Chair (opens in a new tab)
Wakefit Gravita Ergonomic Office Chair