Goal

State each broadcast guarantee (best-effort, reliable, FIFO, causal, total order, FIFO-total order) as a property of executions, decide for a given space-time diagram which guarantees it satisfies, and prove which guarantees imply which.

A single node in a distributed system often needs to say something to every other node: “I am the leader”, “set x to 5”, “here is the next log entry”. That is a broadcast. The idea looks trivial, but two questions make it subtle. First, if the sender crashes halfway through, do the others still agree on whether the message exists? Second, when several messages are in flight, in which order does each node hand them to its application? Different answers give different broadcast models, and the rest of these notes are, at bottom, about the strongest one: every node delivers the same messages in the same order.

This module fixes the vocabulary. We define the models as properties that an execution either has or lacks, and then prove the “hierarchy” between them: which model implies which, and, for every pair that does not, an explicit execution that separates them. Module 2 gives the algorithms that implement each model, and Module 4 shows why the strongest model is exactly what replicated state machines need.

The module follows lecture 04.03 (Broadcast Protocols, Part 1) and Kleppmann’s notes, Section 4.2, slides 73-80 (1). It assumes the happens-before relation, Lamport clocks and vector clocks from lectures 03.03-04.02 (2).

The system model, briefly

Question. Before we can say what a broadcast guarantees, we need to say what can go wrong. Which failures do we allow, and how do we talk about “before” without a global clock?

Background 1.1 (System model (lectures 02.02 and 03.01)).
  • A fixed group of nodes (processes) ; examples use A, B, C. Each node runs a deterministic program and has a unique id.
  • Crash-stop failures: a node may halt and never take another step. A node that never crashes in an execution is correct in that execution; the others are faulty. (In crash-recovery a node may restart from stable storage; Raft and Paxos use that model, Modules 5-9.)
  • Links are point-to-point. A fair-loss link may drop, delay or reorder messages; retransmitting with sequence numbers turns it into a reliable link: if a correct node sends to a correct node, the receiver eventually receives exactly once, and nothing is received that was not sent.
  • Asynchronous timing: no bound on message delay or on the speed of a node. Hence “eventually” in every liveness property below, and no timing guarantee at all.

Time is described by the happens-before relation of Lamport (2): on each node the events are totally ordered; sending a message happens before receiving it; and is transitive. Two events with neither nor are concurrent, . Lamport and vector clocks are two ways of computing (an approximation of, and exactly) this relation.

For broadcast we look at the execution through the eyes of the application: it sees only its own calls and the deliveries . Every message is broadcast at most once and carries a unique id, so we can talk about and about the broadcast event of .

Definition 1.2 (Delivery notation).

For an execution and a node , let be the set of messages that node delivers. For two messages write

In words, is the order in which node hands messages to its application. The order in which messages arrive at node plays no role in any definition below.

Definition 1.3 (Causal precedence of messages).

Message causally precedes message , written , if there is a chain with in which each step is of one of two kinds:

  1. program order: the same node broadcasts and later broadcasts ; or
  2. delivery then broadcast: some node delivers and later broadcasts .

This is Lamport’s happens-before relation applied to the application-level events (broadcasts and deliveries), with the edge playing the role of “send happens before receive”.

Remark 1.4 (Which happens-before?).

Kleppmann’s slide 75 writes without saying which events count. If we included the network receive events inside the broadcast layer, then a node that has received but is still holding it in a buffer would make every later broadcast causally depend on , although its application has never seen . No algorithm that decides from deliveries alone (such as the causal algorithm of Module 2) could respect that relation. The application can only be influenced by what was delivered to it, so Definition 1.3 uses deliveries. This is also the definition of Hadzilacos and Toueg (3).

Receive versus deliver

Question. Why do the notes keep saying “deliver” instead of “receive”?

Because they are different events at different layers. The broadcast algorithm sits between the network and the application, as in Figure 1.1. It sends and receives messages over point-to-point links; it delivers a message when it hands it up to the application. Between receive and deliver the message may sit in a buffer (a hold-back queue) until the ordering rule allows it out. All ordering guarantees are about the order of deliveries. The network may receive messages in any order it likes; the broadcast algorithm’s job is to repair that order.

node A application broadcast algorithm buffer: held messages broadcast deliver send receive node B application broadcast algorithm buffer: held messages broadcast deliver send receive network: point-to-point links
Figure 1.1. Receive versus deliver. The broadcast algorithm receives messages from the network and may hold them in a buffer; it delivers a message to the application only when the ordering rule allows (after Kleppmann, slide 74).

Two conventions from lecture 04.03 and Kleppmann matter later:

  • A node delivers its own broadcasts. When node broadcasts , node also delivers (the loopback arrow in Kleppmann’s diagrams). For FIFO and causal broadcast this self-delivery can happen at once; for total order it may have to wait (Figure 1.4).
  • Broadcast is group communication built from unicast. It is not IP multicast: the algorithm sends one point-to-point message per recipient (or relays through other nodes), so it can add retransmission and ordering on top.

Reliability: best-effort and reliable broadcast

Question. If the sender crashes in the middle of a broadcast, what may the other nodes see?

The weakest guarantee says nothing about that case; the next one says “all or nothing among the correct nodes”.

Definition 1.5 (Best-effort broadcast).

An execution satisfies best-effort broadcast (BE) if:

  1. Integrity (no duplication, no creation): every node delivers each message at most once, and if node delivers then broadcast , with .
  2. Validity: if a correct node broadcasts , then every correct node eventually delivers .

Kleppmann’s “may drop messages” covers both lossy links and a faulty sender. With reliable links the only loss left is the one that validity permits: a sender that crashes before all its copies have left.

Definition 1.6 (Reliable broadcast).

An execution satisfies reliable broadcast (RB) if it satisfies best-effort broadcast and

  1. Agreement: if a correct node delivers , then every correct node eventually delivers .

It satisfies uniform reliable broadcast if instead

3’. Uniform agreement: if any node delivers (even one that crashes later), then every correct node eventually delivers .

Agreement is the “atomicity” of lecture 04.04: among the correct nodes, a message is delivered by all of them or by none. Uniform agreement also binds the nodes that crash: a node may not deliver a message, act on it (say, print a receipt), crash, and leave the survivors unaware of it.

Example 1.7 (A sender that crashes mid-broadcast).

Node A broadcasts by sending one copy to B and one to C over reliable links, and delivers to itself. The copy to B leaves; A crashes before the copy to C leaves. Then B delivers and C never does.

  • Best-effort broadcast holds: A is faulty, so validity promises nothing, and integrity holds.
  • Reliable broadcast fails: B is correct and delivered , C is correct and did not.

This is the first attempt on Kleppmann’s slide 81; the repair (eager reliable broadcast, every node relays what it receives) is in Module 2.

Lecture correction: reliable links are not reliable broadcast

Lecture 04.03 says that “between best-effort broadcast and reliable broadcast, the difference is just using TCP links”. TCP (retransmission and deduplication) removes network losses, but it cannot help when the sender crashes before its last copy leaves: a connection to a dead process carries nothing. Example 1.7 uses perfectly reliable links and still breaks agreement. Lecture 04.04 makes exactly this point and fixes it by relaying.

All the ordered models below are reliable broadcasts with an extra ordering rule. This is Kleppmann’s convention (“all of these are reliable”) and it is what makes “stronger than” a clean statement.

Ordering: FIFO, causal and total order

Question. Given that every correct node eventually gets every message, which orders of delivery should we allow?

Each model below is reliable broadcast plus one safety property about . Read each property as a promise about every node that delivers a message: “you may deliver only if you have already delivered every message that must come before it”.

FIFO order

Definition 1.8 (FIFO broadcast).

An execution satisfies FIFO broadcast if it satisfies reliable broadcast and

FIFO order: if the same node broadcasts and later broadcasts , then every node that delivers has delivered before, that is .

FIFO is a promise per sender: messages from one node come out in the order that node sent them. It says nothing about messages from different senders. Lecture 04.03 explains when that is enough: if a single node (a leader) issues all the commands, then FIFO from that node already makes every follower see the leader’s commands in the leader’s order; messages from other nodes may interleave arbitrarily. The weak spot is a change of leader, when commands from the old and the new leader mix; we return to that in Module 5.

Try it: step through the run and watch node C’s buffer. When m2 arrives before m1, C must hold it; m3 from B is unaffected and is delivered at once. Ask yourself, before each step, which messages C is allowed to deliver.

A B C m1 m2 m1 m2 m3 m3 m3 m1 m2 m2 held dashed: m1 to C is slow delivery order at C: m3, m1, m2
Figure 1.2. FIFO broadcast holds back a message that overtook an earlier one from the same sender. C receives m2 before m1 (square), so it holds m2; it may deliver m3 from B at once. Dots are deliveries; time runs left to right.

In Figure 1.2 node C receives but delivers : only the pair from A is constrained. Delivering first is fine because it comes from a different sender.

Causal order

Definition 1.9 (Causal broadcast).

An execution satisfies causal broadcast if it satisfies reliable broadcast and

Causal order: if (Definition 1.3), then every node that delivers has delivered before: .

If , nodes may deliver and in either order, and different nodes may choose differently.

Causal order is the guarantee that matches how people read a conversation: a reply must never be shown before the message it replies to. If Alice broadcasts “shall we meet at 2pm?” and Bob, having seen it, broadcasts “yes”, then nobody may see “yes” first. FIFO cannot promise this, because the two messages come from different senders.

Try it: replay the lecture example and compare the delivery logs of A, B and C. They disagree about m2 and m3, which is allowed because the two broadcasts are concurrent; but every node delivers m1 first. Then select m1 and lengthen its delay to C until m2 arrives there first, and watch C hold m2 back.

A B C m1 m1 m1 m2 m3 m2 m2 m3 m3 A and C: m1, m3, m2; B: m1, m2, m3
Figure 1.3. Causal broadcast (lecture 04.03, Kleppmann slide 77). B broadcasts m2 after delivering m1 and A broadcasts m3 after m1, so m1 must come first everywhere; m2 and m3 are concurrent and may be delivered in either order.

In Figure 1.3, (B delivered and then broadcast ) and (program order at A), while and are concurrent. The valid delivery orders at any node are therefore exactly and , and the execution uses both.

Lecture correction: causal order does imply FIFO order

Lecture 04.03, discussing this diagram, says one “might think that [causal broadcast] is strictly stronger than FIFO, but that’s not always the case”, because concurrent messages can be delivered in different orders. The conclusion is wrong; the reason is right but about something else. Causal broadcast is stronger than FIFO broadcast (part 3 of Theorem 1.13, and Example 1.18 shows it is strictly stronger). What causal broadcast does not give is agreement on the order of concurrent messages, so it is not stronger than total order broadcast.

Total order

Definition 1.10 (Total order broadcast).

An execution satisfies total order broadcast (TO), also called atomic broadcast, if it satisfies reliable broadcast and

Total order: for all nodes and messages : if and , then .

In words: once any node has delivered before , no node may deliver without having delivered first.

This is Kleppmann’s “if is delivered before on one node, then must be delivered before on all nodes”, stated so that it also covers nodes that deliver only some of the messages (for example because they crash): a node may stop early, but it may not skip a message or swap two. It follows that all correct nodes eventually deliver the same messages (reliable broadcast) in the same order. The order itself is not specified: it need not respect FIFO or causality. That freedom is the point of the warning in Proposition 1.16.

Try it: watch node A’s own m3. A broadcasts it, but cannot deliver it to itself until m2 from B has arrived, because the agreed order is m1, m2, m3. Then click messages in the agreed order to move them earlier, and look for an order of the three messages that total order would allow but FIFO-total order would forbid.

A B C m1 m1 m1 m2 own m3 held m2 m3 m2 m3 m3 every node delivers m1, m2, m3
Figure 1.4. Total order broadcast (lecture 04.03, Kleppmann slide 78). Once the order m1, m2, m3 is fixed, node A may not deliver its own m3 when it broadcasts it: the square marks the held self-delivery, released after m2 arrives.

Figure 1.4 shows the most surprising consequence, which Kleppmann highlights: a node’s delivery of its own message may have to wait. Under FIFO or causal broadcast a node can deliver its own broadcast immediately (nothing it has not seen can be required to precede it). Under total order, node A broadcast concurrently with B’s ; if the agreed order puts first, A must hold its own until arrives. Problem 1.4 proves that some waiting is unavoidable for any total order algorithm.

Combinations

Definition 1.11 (FIFO-total and causal-total order broadcast).

An execution satisfies FIFO-total order broadcast if it satisfies both FIFO broadcast and total order broadcast. It satisfies causal-total order broadcast if it satisfies both causal broadcast and total order broadcast.

Kleppmann’s slide 75 lists FIFO-total order as the strongest model. Causal-total order is the model of Hadzilacos and Toueg’s “causal atomic broadcast” (3); we include it because Proposition 1.14 and Example 1.15 show that, once crashes are allowed, it is strictly stronger than FIFO-total order.

Remark 1.12 (Safety and liveness parts).

Every model above is a conjunction of two kinds of property.

  • Safety (“nothing bad happens”): integrity, FIFO order, causal order, total order. If one is violated, a finite prefix of the execution already shows it: some delivery happened too early or twice.
  • Liveness (“something good eventually happens”): validity and agreement. No finite prefix can violate them, because the missing delivery might still come.

The algorithms of Module 2 follow this split: a hold-back buffer enforces the safety part, and a reliable dissemination layer provides the liveness part. For total order the split becomes painful: in an asynchronous system with even one crash, no algorithm can guarantee both parts of fault-tolerant total order broadcast at once (4), which is the subject of Module 4.

The hierarchy

Question. Kleppmann’s slide 80 draws the models as a diagram with arrows “stronger than”. What exactly does “stronger” mean, and is every arrow (and every missing arrow) justified?

Say that model implies model if every execution that satisfies also satisfies . A model is strictly stronger if, in addition, some execution satisfies but not . Figure 1.5 shows the result we prove in this section.

causal-total order causal FIFO-total order FIFO total order reliable best-effort no crashes
Figure 1.5. The broadcast hierarchy. A line joins a stronger model (above) to a weaker one it implies. The dashed arrow holds only in executions where every broadcaster delivers its own message, for instance when no node crashes.
Theorem 1.13 (The implications).

For every execution:

  1. reliable broadcast implies best-effort broadcast;
  2. FIFO, causal and total order broadcast each imply reliable broadcast;
  3. causal broadcast implies FIFO broadcast;
  4. FIFO-total order broadcast implies FIFO broadcast and total order broadcast;
  5. causal-total order broadcast implies causal, FIFO, total order and FIFO-total order broadcast.

The arrow that Kleppmann draws from FIFO-total order to causal broadcast needs an assumption. Without crashes it is true:

Proposition 1.14 (FIFO-total order gives causal order when broadcasters deliver their own messages).

Consider an execution that satisfies FIFO-total order broadcast, and in which every node that broadcasts a message also delivers that message (this holds whenever no node crashes, by validity). Then the execution satisfies causal broadcast.

The proof used the assumption exactly once, in the delivery-then-broadcast step. When that step’s node crashes before delivering its own message, the argument has nothing to stand on, and indeed the implication fails:

Example 1.15 (FIFO-total order without causal order).

Four nodes P, Q, R, S. Node P broadcasts ; only Q receives it, Q delivers , and P crashes. Q then broadcasts ; its copies reach R and S, and Q crashes before delivering itself. R and S deliver .

  • Delivery sets: , (and ).
  • Reliable broadcast holds: the only correct nodes are R and S, they deliver the same messages, and no correct node broadcast anything.
  • FIFO order holds vacuously (no node broadcast two messages), and total order holds vacuously (no node delivers two messages).
  • Causal order fails: Q delivered before broadcasting , so , yet R delivers and never .

The execution violates uniform agreement (Q delivered , the correct nodes never do). Problem 1.5 shows that uniform agreement repairs the implication.

Now the separations: for every pair that Theorem 1.13 does not connect, an execution that satisfies one model and not the other. E1 and E6 use crashes and E2-E5 use none. The separations E2-E5 therefore do not depend on failures, while the separation E6 exists only with crashes: without them every broadcaster delivers its own messages, and FIFO-total order implies causal order (Proposition 1.14).

Proposition 1.16 (Separating executions).

Each of the following executions satisfies the first model and violates the second.

Execution (deliveries listed per node, left to right)SatisfiesViolates
E1Example 1.7; A crashes after sending to B onlyBERB
E2A broadcasts then ; A and C deliver ; B delivers RBFIFO, TO
E3Figure 1.6; C delivers FIFOcausal
E4A broadcasts then ; every node delivers TOFIFO
E5Figure 1.3; A, C deliver ; B delivers causalTO
E6Example 1.15FIFO-TOcausal

Consequently the implications of Theorem 1.13 are the only ones: causal and total order are incomparable, FIFO and total order are incomparable, every implication in the theorem is strict, and (with crashes) FIFO-total order and causal broadcast are incomparable.

Exam trap: total order does not imply FIFO order

The tempting answer “total order is the strongest, so it includes FIFO” is wrong. Total order only demands that all nodes agree; the agreed order may put a sender’s second message before its first (execution E4). Lecture 04.03 gives the practical reason: in a leader-based implementation the leader picks some order, possibly arbitrary, and everyone follows it. FIFO-total order is the model that adds the sender’s order back. The same trap in the other direction: causal broadcast does not give total order (E5).

Lecture correction: total order needs coordination, not vector timestamps

Lecture 04.03 suggests that “anything other than [FIFO], which involves ordering across multiple nodes, needs vector timestamps”, including total order. Vector timestamps are the tool for causal broadcast (Module 2). They cannot produce a total order: two concurrent messages have incomparable vectors, and nothing in the vectors tells two nodes to break the tie the same way. Total order is obtained by agreeing on the order, through a sequencer, through Lamport timestamps plus waiting for every node, or through consensus (Module 2, Module 4). Also, FIFO needs only a per-sender counter, not a Lamport clock (lecture 04.05 says exactly this).

Why total order: replicated state

Question. Why do the later modules care so much about the strongest model?

Remark 1.17 (Total order is what replicas need).

Suppose every node keeps a copy of a variable , and updates are broadcast. Node A broadcasts “set ” and node B concurrently broadcasts “set ”. Under causal broadcast the two are concurrent, so A may apply them in the order 2, 1 and B in the order 1, 2. Both nodes then end with different values ( at A, at B) forever: the replicas have diverged.

If instead the updates are delivered by total order broadcast and each node applies them in delivery order, every correct node applies the same sequence of deterministic updates to the same initial state, and ends in the same state. This is state machine replication (5), the subject of Module 4. FIFO-total order adds that each client’s own updates take effect in the order the client issued them.

Weaker models are enough only when updates commute (a counter that is only incremented, a set that only grows): then the order of concurrent updates does not matter and causal broadcast suffices. That route is taken by CRDTs, later in the course and outside these notes.

Worked example: the three lecture diagrams

We check the three executions of lecture 04.03 (Kleppmann slides 76-78) against every model. Each check is a small list of pairs to compare; the method is the same for every exam question of this type:

  1. List the messages with their senders and the causal relations between them (program order and delivery-then-broadcast, then transitivity).
  2. For FIFO, compare only pairs with the same sender. For causal, compare only causally related pairs. For total order, compare the delivery sequences of all nodes on their common messages.
A B C m1 m1 m1 m2 m2 m2 m3 m3 m3 C delivers m2, m1, m3: FIFO yes, causal no
Figure 1.6. The lecture 04.03 FIFO example (Kleppmann slide 76). Every node delivers m1 before m3, so FIFO order holds; but C delivers m2 before m1 although B broadcast m2 after delivering m1, so causal order fails.
Example 1.18 (Lecture 04.03, the FIFO diagram).

The execution is Figure 1.6 (Kleppmann slide 76).

Step 1, senders and causality. A broadcasts and later , so . B delivers and then broadcasts , so . A broadcasts after it has delivered , so as well.

Step 2, deliveries. A: . B: . C: .

ModelPairs to checkHolds?
FIFO from A: first at A, B, Cyes
causal: C delivers firstno
total orderA has , C has no

So the execution is valid FIFO broadcast but neither causal nor total order. Lecture 04.03 stresses why it is still FIFO: the delay of to C does not matter for FIFO, because the only constraint is between A’s own messages, and C still delivers before .

Which orders could C use? Under FIFO, may go anywhere relative to A’s pair: , or (the three orders on slide 76). Under causal order all three relations above must hold, and is a chain, so only is allowed; a causal algorithm at C would hold back until arrives.

Example 1.19 (Lecture 04.03, the causal and total order diagrams).

The causal diagram (Figure 1.3). Causality: (B delivered first) and (program order at A). B broadcast before receiving , and A broadcast before receiving , so . Deliveries: A and C have ; B has . FIFO holds (only is constrained), causal holds (everybody starts with ), total order fails ( and swap between A and B).

The total order diagram (Figure 1.4). Causality: , , . Every node delivers . Total order holds (identical sequences), FIFO holds ( before everywhere), causal holds ( first everywhere). So this execution is even causal-total order. Slide 79 shows the other legal choice, at every node; there B must hold back its own .

Exam trap: three more wrong answers

  • “Under causal broadcast all nodes deliver concurrent messages in the same order.” No: E5 / Figure 1.3 delivers in different orders, legally.
  • “A node need not deliver its own broadcast.” In this model it does (validity applied to a correct sender), and under total order that self-delivery may have to wait for messages from other nodes (Figure 1.4).
  • “The receive order shows the delivery order.” Only deliveries count. In Figure 1.2, C receives before and delivers them the other way round.

What breaks

  • Crashes inside a causal chain. The definitions are robust, but intuitions are not: Example 1.15 shows that the familiar arrow “FIFO-total order is stronger than causal” fails once a node can crash right after broadcasting. Uniform agreement, or causal-total order, restores it.
  • Crash-recovery. The definitions speak of “correct” nodes that never crash. If a node can restart, it must remember what it has delivered (on stable storage), or it may deliver a message twice or deliver later messages without earlier ones. Raft and Paxos persist their logs for exactly this reason.
  • Partitions and timing. Every guarantee here is “eventually”. During a network partition a reliable broadcast simply waits; the models promise nothing about when. In particular they do not promise that a read sees the latest write (that is the topic of quorums in Module 3).
  • Byzantine nodes. The models assume nodes follow their program. A malicious sender could send different messages under the same id to different nodes; none of the guarantees survive that without Byzantine-tolerant protocols, which are outside these notes.

Why it matters

The models of this module are the specification side of everything that follows. Module 2 implements reliable, FIFO and causal broadcast without any coordination, and shows that the simple total order algorithms are not fault tolerant. Module 4 uses Remark 1.17 to show that replicated state needs total order broadcast, and that fault-tolerant total order broadcast is the same problem as consensus. Raft (Modules 6-7) and Multi-Paxos (Module 9) are, seen from this module, two implementations of FIFO-total order broadcast that keep working while a minority of nodes crash.

Further reading

  • Kleppmann’s notes, Section 4.2 and slides 73-80, for the diagrams this module redraws (1).
  • Hadzilacos and Toueg’s survey defines all of these broadcasts formally, including the uniform versions and causal atomic broadcast, and proves the relations between them (3).
  • Lamport’s paper introduces happens-before and uses a total order on events to build a replicated state machine (a mutual exclusion example) (2).
  • Schneider’s tutorial on the state machine approach explains why replicas need agreement and order (5).

Homework

The problems for this module are in Homework 1.

1.
Kleppmann M. Distributed Systems: Lecture Notes [Internet]. University of Cambridge, Computer Science Tripos Part IB; 2021. Available from: https://www.cl.cam.ac.uk/teaching/2122/ConcDisSys/dist-sys-notes.pdf
2.
Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM. 1978;21(7):558–65.
3.
Hadzilacos V, Toueg S. A Modular Approach to Fault-Tolerant Broadcasts and Related Problems. Cornell University, Technical Report TR94-1425. 1994;
4.
Fischer MJ, Lynch NA, Paterson MS. Impossibility of Distributed Consensus with One Faulty Process. Journal of the ACM. 1985;32(2):374–82.
5.
Schneider FB. Implementing Fault-Tolerant Services Using the State Machine Approach: A Tutorial. ACM Computing Surveys. 1990;22(4):299–319.