Skip to content

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

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