liveBook · Manning

Safety

As explained in Think Distributed Systems

A system guarantee that a specified bad event or condition will never occur.

A safety property guarantees that something bad will never happen. A system is correct only when every possible behavior satisfies its safety and liveness guarantees. section 1.4.1

Think of safety as keeping every reachable state inside a permitted region. Liveness asks whether the system eventually reaches a desirable state; safety prevents inconsistent or forbidden states along the way. section 1.4.1 section 3.2.4

Two participants, one decision

For a transaction involving participants P1 and P2, safety forbids P1 from committing while P2 aborts, or the reverse. Both participants must not reach conflicting decisions. section 1.4.1 section 6.1.2

Figure 1.9 Behavior space of a distributed transaction with two participants
A diagram of a work flow

AI-generated content may be incorrect.

Use the behavior-space diagram to trace how individual participant transitions can produce either consistent or conflicting transaction states. section 1.4.1

A small state machine makes the guarantee precise. If x may be 0, 1, 2, or 3, declaring x = 1 or x = 2 as safe makes x = 3 intolerable; reaching it provides no guarantee of recovery. section 3.2.4

Failure handling protects safety by detecting unwanted events and inhibiting dangerous actions. Mitigation instead restores liveness, so a component may stop responding until it can safely rejoin. section 3.3.2

Guarantees depend on the system model. Two-phase commit preserves safety during transaction-coordinator failure but may block, sacrificing liveness; participant failures can be handled through recovery logs. section 6.3.2

Figure 6.11 Failure of TC after the first commit
A diagram of a process

AI-generated content may be incorrect.

Follow the coordinator-failure scenario to see how one participant can commit while another remains unable to commit or abort, without violating safety. section 6.3.2

Consensus expresses safety through validity, integrity, and agreement: decisions must be proposed, permanent, and identical across correct processes. Termination is separate because safety can hold while progress stops. section 10.2

Table 10.1 Symbols in set theory

Symbol

Meaning

∀

For all

∃

There exists

The notation table supports reading the quantified consensus guarantees for validity, integrity, agreement, and termination. section 10.2

Safety is therefore a negative guarantee: it rules out bad behaviors, not necessarily delays or failures to finish. In asynchronous systems, preserving safety may be possible even when guaranteeing liveness is impossible. section 10.1 section 6.3.2

How Think Distributed Systems covers it

How deep it goes
Defines safety formally, models reachable states, and applies it to transactions and consensus, while separating it from liveness and system-model limits.
Examples
Illustrates safety with a two-participant transaction, a state variable constrained to 1 or 2, coordinator failure, and consensus decision rules.
What it assumes
Assumes basic processes, states, messages, and failures, while defining correctness, safety, liveness, and consensus properties from first principles.
What you can do after
Evaluate distributed-system guarantees by identifying forbidden states, conflicting decisions, failure responses, and the boundary between safety and liveness.
How it connects
Connects safety with liveness, correctness, failure detection, failure mitigation, atomic commit, two-phase commit, consensus, and the FLP impossibility theorem.

Also explained in

Compare how 8 books explain safety →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Think Distributed Systems. The section links point to the parts of the book it draws on.