Starvation
Starvation is a condition in which a task is persistently denied the resources or execution opportunities it needs to make progress.
Troubleshooting Java, Second Edition
A concurrency condition in which a thread is unfairly excluded from obtaining execution time or a required resource.
- How it is used
- Diagnoses whether lock contention unfairly excludes threads from execution in multithreaded applications.
- How deep it goes
- Defines unfair exclusion and traces it through sampling, lock counts, monitors, affected threads, and execution time.
- Examples
- Uses producer-consumer threads sharing an ArrayList, balanced lock counts, monitor histories, and aggregated profiler statistics.
- What you can do after
- Diagnose starvation with sampling and lock profiling, then evaluate changes that reduce waiting or rebalance thread execution.
Read how Troubleshooting Java, Second Edition explains starvation →
Learn Concurrent Programming with Go
Starvation is a situation in which an execution is blocked from gaining access to a shared resource because other executions keep it unavailable for a long time or indefinitely.
- How it is used
- Diagnoses unfair shared-resource access and motivates write-preferring readers–writer locks.
- How deep it goes
- Explains the failure sequence and implements lock-state checks, condition waits, counters, and broadcasts.
- Examples
- Uses two looping Go readers, a waiting writer, indefinite output, and a write-preferring lock that prints “Write finished.”
- What you can do after
- Build it from scratch using condition variables and mutexes to prevent write starvation in a readers–writer lock.
Read how Learn Concurrent Programming with Go explains starvation →
C# Concurrency: Asynchronous and multithreaded programming
Starvation is a concurrency condition in which a thread is prevented from making progress because another thread retains a required resource for an excessive time.
- How it is used
- Diagnoses multithreading failures where locks or processor time prevent otherwise runnable threads from progressing.
- How deep it goes
- Explains lock and CPU mechanisms through infinite-loop programs, then compares Windows and Linux scheduling behavior.
- Examples
- Uses competing console writers, an indefinitely held lock, processor affinity, and AboveNormal thread priority.
- What you can do after
- Diagnose starvation by distinguishing excessive lock duration from CPU monopolization and apply shortest-duration lock guidance.
Read how C# Concurrency: Asynchronous and multithreaded programming explains starvation →
Grokking Concurrency
Starvation is a concurrency failure in which a task is indefinitely denied the resources or execution opportunities needed to make progress.
- How it is used
- Diagnoses starvation as a concurrency failure alongside deadlocks and livelocks.
- How deep it goes
- Explains resource denial, scheduling causes, priority effects, and aging, but does not detail an implementation of fair scheduling.
- Examples
- Uses dining philosophers, chopstick locks, dumpling counts, and unequal philosopher output to demonstrate unfair progress.
- What you can do after
- Diagnose starvation by tracing resource access, scheduling, priorities, synchronization, and task load.
Troubleshooting Java: Read, debug, and optimize JVM applications
A condition in which a thread is repeatedly denied access to execution or resources it needs to make progress.
- How it is used
- Uses starvation as a fairness failure when assessing whether locks let threads make progress.
- How deep it goes
- Defines starvation as unfair blocking that prevents execution and relates it to lock profiling, without a formal fairness model.
- Examples
- Compares two threads sharing a list and notes that favoring one can starve the other.
- What you can do after
- Diagnose possible starvation by profiling locks and checking whether threads are unfairly excluded from execution.
Read how Troubleshooting Java: Read, debug, and optimize JVM applications explains starvation →
Also covered in
- Test Driven: Practical TDD and Acceptance TDD for Java Developers
- Distributed Machine Learning Patterns
- Functional Design and Architecture: Examples in Haskell
- Latency
What to know first
- lockingLocking is a synchronization technique that controls concurrent access to a shared resource or protected operation.
- threadA thread is a distinct sequence of execution with its own control flow and state, managed or scheduled by a processor, runtime, or operating system.
- race conditionA race condition is a concurrency defect in which program behavior or results depend on the timing or ordering of interacting operations.
- ArrayListArrayList is Java’s mutable, resizable-array implementation of the List interface.
Related concepts
- livelockincludes · A livelock is a concurrency failure in which active threads or tasks repeatedly respond to one another without making useful overall progress.
- livenesscontrasts with · Liveness is a correctness property requiring that a specified desirable event or system progress eventually occurs.
- lock-freeproduced by · Lock-free is a concurrency progress guarantee under which at least one operation completes within a finite number of steps despite contention, without relying on mutual-exclusion locks.
- write-preferring readers-writer lockaddressed by · A write-preferring readers-writer lock is a readers-writer synchronization lock that prioritizes waiting writers to prevent prolonged writer blocking.
Questions about starvation
What is starvation?
Starvation is a condition in which a task is persistently denied the resources or execution opportunities it needs to make progress.
Which Manning books explain starvation?
Troubleshooting Java, Second Edition, Learn Concurrent Programming with Go, C# Concurrency: Asynchronous and multithreaded programming, Grokking Concurrency and Troubleshooting Java: Read, debug, and optimize JVM applications.
What should I know before learning starvation?
Manning books that teach starvation usually introduce locking, thread, race condition and ArrayList first.
What is the difference between starvation and liveness?
Starvation is a condition in which a task is persistently denied the resources or execution opportunities it needs to make progress. Liveness is a correctness property requiring that a specified desirable event or system progress eventually occurs.
What kinds of starvation are there?
Kinds of starvation include livelock.
What is starvation a kind of?
Starvation is a kind of thread-related problem. A thread-related problem is incorrect, unsafe, or undesirable software behavior arising from how concurrent threads execute or coordinate.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




