Safety and liveness¶
Category: Hazards · Status: stub · Lessons: chapter 03, When locks go wrong (planned)
One line: The two kinds of correctness for a concurrent program: safety means nothing bad ever happens, liveness means something good eventually does.
Also called: safety property, liveness property.
How it connects¶
- See also: Liveness failure, Safety failure
In each language¶
| Rust | The Rustonomicon: Data races and race conditions ↗: safe Rust guarantees there are no data races, a safety property, but counts getting deadlocked as safe, so liveness is left to the program |
| Java | JLS §17.1 ↗: the language neither prevents nor requires detection of deadlock, so liveness is the program's job |
Where to read more¶
- In the books: Java Concurrency in Practice, Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea — ch. 2, 'Thread Safety' → 'Liveness and Performance'
- In the books: Concurrent Programming on Windows, Joe Duffy — ch. 11, 'Concurrency Hazards' → 'Liveness Hazards'
- In the books: Concurrent Programming: Algorithms, Principles, and Foundations, Michel Raynal — ch. 5, 'Mutex-Free Concurrent Objects' → 'Mutex-Freedom and Progress Conditions'
- In the books: Operating System Concepts, Abraham Silberschatz, Peter Baer Galvin, Greg Gagne — ch. 6, 'Synchronization Tools' → 'Liveness'
- Reference: Wikipedia: Liveness ↗