230x Filetype PDF File size 0.32 MB Source: www.ii.uib.no
INF 329 – Selected
topics in programming theory
Java Concurrency in
Practice
Chapters 10 and 11
Speaker: Guido Di Ridolfi
1
Chapter 10
“Avoiding Liveness Hazards”
2
Intro
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.
This chapter explores some of the causes of
liveness failures and what can be done to
prevent them.
3
10.1 - Deadlock
The following situation is the simplest case of
deadlock (or deadly embrace), where multiple
threads wait forever due to acyclic locking
dependency.
When thread A holds lock L and tries to acquire lock M,
but at the same time thread B holds M and tries to
acquire L, both threads will wait forever.
4
no reviews yet
Please Login to review.