Skip to Content
Java Concurrency in Practice
book

Java Concurrency in Practice

by Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea
May 2006
Intermediate to advanced
432 pages
12h 21m
English
Addison-Wesley Professional
Content preview from Java Concurrency in Practice

Chapter 10. Avoiding Liveness Hazards

There is often a tension between safety and liveness. We use locking to ensure thread safety, but indiscriminate use of locking can cause lock-ordering deadlocks. Similarly, we use thread pools and semaphores to bound resource consumption, but failure to understand the activities being bounded can cause resource deadlocks. Java applications do not recover from deadlock, so it is worthwhile to ensure that your design precludes the conditions that could cause it. This chapter explores some of the causes of liveness failures and what can be done to prevent them.

10.1. Deadlock

Deadlock is illustrated by the classic, if somewhat unsanitary, “dining philosophers” problem. Five philosophers go out for Chinese food ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Concurrency and Multithreading in Practice

Java Concurrency and Multithreading in Practice

Tatiana Fesenko
Modern Concurrency in Java

Modern Concurrency in Java

A N M Bazlur Rahman
Java Concurrency, 2/e

Java Concurrency, 2/e

Douglas Schmidt
Modern Java in Action

Modern Java in Action

Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft

Publisher Resources

ISBN: 0321349601Purchase book