The idea: received is not the same as delivered
A multicast sends one message to every process of a group. The network gives each copy its own delay, so two processes can see the same messages arrive in different orders. An ordered multicast puts a layer between the network and the application. A message is received when the network hands it over, and delivered when the layer passes it up to the application. In between it waits in a hold-back queue until the ordering rule says it may go.
| On the canvas | Meaning |
|---|---|
| three lines P1, P2, P3 | the processes; time runs left to right (down on a phone), one column per tick |
| coloured box | a message in flight, coloured by the process that wrote it; grey boxes are ACKs |
| arrow | a message that has arrived, from send to arrival; an orange dot at its end means it was held back |
| green box on a line | a delivery to the application, at the tick it happens |
| process panels | each process's counters (sequence numbers, vector or Lamport clock), its hold-back queue, what it delivered and, for the bank, its balance |
| results table | one row per ordering run on the same scenario, with ✓ / ✗ for FIFO, causal and same order |
The delays are fixed per scenario, so every run is the same and you can compare the orderings on one schedule. Data messages not in the schedule take 2 ticks, ACKs 1 tick.
FIFO order
FIFO order: if one process multicasts a and then b, every process delivers a before b. Each sender numbers its messages #1, #2, …, and each receiver remembers the next number it expects from each sender. A message with a higher number waits. In Demo 1: no ordering, P3 gets b before a, b reaches P3 at t=3 and a only at t=6, so P3 delivers b, a. In Demo 3: FIFO, P3 holds b back until a arrives, b #2 waits in P3's queue for 3 ticks, and at t=6 P3 delivers a and then b.
FIFO says nothing about two different senders. In Demo 4: FIFO, the reply overtakes the question, P1 asks Q "lunch at 12?", P2 delivers Q and answers R "yes". Each sender sends only one message, so FIFO holds nothing back, and P3 delivers the answer R at t=3 before the question Q at t=7.
Causal order with vector timestamps
Causal order: if sending m′ could have been influenced by m (m happened before m′, in the sense of Lamport's happened-before), every process delivers m before m′. Causal order includes FIFO order. One way to get it uses a vector clock that counts only multicasts:
- before a multicast, Pj adds 1 to its own entry
V[j]and puts the vector in the message; - Pi delivers a message from Pj with vector
VmwhenVm[j] = V[j] + 1(it is the next one from Pj) andVm[k] ≤ V[k]for every other k (Pi has seen everything the sender had seen); thenV[j] = V[j] + 1.
In Demo 5: causal, the reply waits for the question, R carries [1,1,0]: P2 had delivered one message from P1 when it replied. P3 is at [0,0,1], so R waits. When Q [1,0,0] arrives at t=7, P3 delivers Q and then R. P3's order is now N, Q, R. But P2's is Q, R, N and P1's is Q, N, R: N and Q are concurrent, and causal order lets each process put them where they arrive.
Total order and the bank account
Total order: every process delivers all messages in the same order. It does not say which order, only that it is the same everywhere. This is what replicas need. In the replicated bank account from van Steen and Tanenbaum, every process holds a copy of a $1000 account. P1 adds $100 and P3 adds 1% interest at the same time. Neither update depends on the other, so FIFO and causal order allow any order (Demo 2: no ordering, the bank replicas end at $1111 and $1110):
| Replica | Delivered order | Balance |
|---|---|---|
| P1 | +100, then +1% | 1000 + 100 = 1100; 1100 × 1.01 = $1111 |
| P2 | +1%, then +100 | 1000 × 1.01 = 1010; 1010 + 100 = $1110 |
| P3 | +1%, then +100 | $1110 |
Total order with Lamport timestamps and ACKs
The algorithm in van Steen and Tanenbaum uses Lamport clocks, the same clocks Ricart–Agrawala mutual exclusion uses to order requests:
- A sender adds 1 to its clock L and multicasts the message with timestamp
(L, id). It also puts the message in its own queue. - A receiver sets
L = max(L, Lmsg) + 1, puts the message in its queue sorted by(L, id), and multicasts anACKto everyone else. - A process delivers the message at the head of its queue once every other process has ACKed it.
Every process sorts by the same timestamps, so they all deliver in the same order. Why is it safe to deliver the head? An ACK from Pk carries a timestamp larger than the head's. Any message Pk sends later has a still larger one, and any message Pk sent earlier has already arrived, because the algorithm assumes FIFO channels (in both total-order tabs the page's network keeps each link in order, as TCP does). In Demo 6: total with Lamport timestamps and ACKs, every replica ends at $1111, +100 has (1,P1) and +1% has (1,P3): equal clocks, so the lower id goes first, and all three replicas end at $1111. It costs 4 data messages plus 8 ACKs and ends at t=5.
Total order with a sequencer
A simpler way: one process, the sequencer (P2 here), numbers every message. A sender sends to the sequencer only; the sequencer gives the message the next number #g, delivers it and multicasts it to the rest. Everyone delivers in number order, holding back a message whose number comes too early. In Demo 7: total with a sequencer, every replica ends at $1110, +1% reaches P2 first (1 tick against 2), so it becomes #1 and every replica ends at $1110. That is a different order from Demo 6, and that is fine: total order only promises the same order. The links to the sequencer must be FIFO too, or it could number a sender's b before its a. The cost is one extra hop and a single process that every message must pass. Raft and Kafka's partition leader work this way: the leader orders the log.
FIFO vs causal vs total
Demo 8: FIFO vs causal vs total on one schedule runs the question, reply and news scenario three times and fills the results table:
| Ordering | P1 | P2 | P3 | Guarantee |
|---|---|---|---|---|
| FIFO | Q N R | Q R N | N R Q | FIFO ✓, causal ✗, same order ✗ |
| causal | Q N R | Q R N | N Q R | FIFO ✓, causal ✓, same order ✗ |
| total (Lamport + ACKs) | Q N R | Q N R | Q N R | FIFO ✓, causal ✓, same order ✓ (12 ACKs, done at t=11) |
Total order by itself does not promise causal order: a total order could still put a reply before its question. The Lamport version respects it here because a reply is always sent after its question was delivered, so it gets a larger timestamp. A system that needs both asks for causal total order. Replicated state machines, such as MySQL Group Replication, need total order; chat and comment threads usually need only causal order, which is cheaper and needs no ACK round.
What the page leaves out
No message is lost and no process fails, so the page skips the hard part of real group communication: reliable multicast with retransmission, failure detection, and group membership changes (virtual synchrony, as in ISIS). It also skips the ISIS total-order algorithm (receivers propose a priority, the sender picks the maximum), sequencer failover, the equivalence of total-order broadcast and consensus (Paxos, Raft, Zab), and garbage collection of ACK state. The bank interest is rounded to cents.