Ugg want one picture of whole tribe, but tribe no hold still
Ugg have many caves. Each cave hold one hunter — Ugg call him process. Hunters send things by runner: shiny stones, meat, berries — these are messages, and the trail between two caves is a channel. Ugg want ONE big cave-painting of the whole tribe at the same moment: who hold what, which stones still fly on the trails. This is a global snapshot — state of every hunter PLUS every flying stone — and Ugg must paint it without make the tribe freeze.
Hard! No big sun that all caves see the same, so no shared "now." Yell "EVERYBODY FREEZE!" no work — each cave hear it at a different time, runners still out on trails. So Ugg take a clever picture instead: each hunter paint own state when HE ready, and Ugg catch the flying stones. The painting show a tribe-state that COULD have been true, even if no single blink it was exactly true. Nobody can tell the difference. Good enough.
Good painting no let stone land before it thrown
A cut — Ugg pick one moment for each hunter, one state each, one line across all caves. Cut is a consistent cut when NO stone-arrow point backward in time. Meaning: every stone Ugg paint as CAUGHT must also have its THROW painted. No ghost-catch. Effect never come before cause.
Two rock-rules make this exact.
C1 (conservation — no stone lost): . Ugg say: if the throw is painted, that stone is EITHER still flying on the trail OR already caught — one or the other. Never both (Ugg count it twice), never neither (Ugg lose it). Every thrown stone is somewhere.
C2 (cause-before-effect): . Ugg say: if the throw is NOT painted, the stone must NOT be flying AND must NOT be caught. No catching a stone nobody threw yet. That stone from the future — not allowed.
Ugg count money-shells wrong, learn big lesson
Three cave-banks. Whole tribe always hold 2500 shells. paint self at time : 1000 shells. AFTER that, throw 400 shells to . Then paint self LATER: now show 700 shells — the 400 already landed.
See the trap. The 400 THROW happen after painted, so the throw is NOT in the picture — but the 400 CATCH IS in 's picture. So still show that 400 (painted before letting go) AND show it too. Same 400 counted TWICE, total no equal 2500. Ugg warn: if snapshot total ≠ start total, the cut is an inconsistent cut — a catch sit inside the picture but its throw sit outside, arrow point future→past. Good picture keep throw and catch on the same side, or shells on the trail — never double-count.
Chandy-Lamport — the marker trick, but trail must be FIFO
The real hunt-tool: Chandy-Lamport (old wisdom from Chandy and Lamport). It need FIFO channels — "first stone thrown is first stone caught," stones stay in order on the trail (like the TCP trail). The trick is a special painted bone Ugg call a marker. Marker split the trail into before-picture stones and after-picture stones.
The initiator (hunter who start): first paint own state. THEN throw a marker-bone down every out-trail, before any normal stone.
When a hunter catch a marker on channel :
- First marker he ever see → paint own state now. Say trail hold nothing () — nothing sneaked in between his painting and this marker. Throw marker down all his out-trails. Start watching every OTHER in-trail, write down each stone that land.
- Already painted before → stop watching . Trail state = all stones caught on from when he painted until this marker land.
Done (termination) when every hunter have caught a marker on every in-trail. Cost: bones (one marker per trail-direction), time where is the tribe's diameter (widest cave-to-cave hop count).
Why FIFO? Ugg warn: no FIFO, Chandy-Lamport break! A stone thrown BEFORE the marker should land before it → count as trail state. A stone thrown AFTER should land after → NOT count. FIFO keep stones in order, so anything landing after the marker was truly thrown after. On a messy trail, a fast after-stone jump ahead of the marker and get counted wrong. Bad painting.
Lai-Yang — messy trail, use war-paint
Trail no FIFO (stones any order, like UDP)? Use Lai-Yang. No markers — use white/red colouring. Every hunter start white. Hunter turn red the moment he paint his state. Every white hunter paint whenever he like — BUT no later than the first RED stone he catch (red stone force him: paint NOW). Every white hunter also remember the history of all white stones he throw and catch. Trail state come from the histories: white stones caught after painting, minus white stones threw before painting. Ugg warn: heavy memory — each hunter must hold a whole pile of white-stone history until snapshot finish.
Acharya-Badrinath — causal trail, count on fingers
If the trail deliver in causal order (even stronger than FIFO), Ugg have a light tool: Acharya-Badrinath. Each hunter keep two finger-counts, the SENT / RECD arrays: = stones threw to ; = stones caught from . Starter shout a token to everybody (self too). Each hunter catch token → paint self, send his counts back. Starter figure the trail :
Ugg say: stones already threw but not yet caught — the middle-number stones still flying. Only shouts total (token + one reply per hunter). Light!
Which tool for which trail
- Chandy-Lamport — need FIFO, msgs, no extra memory.
- Lai-Yang — messy non-FIFO ok, msgs, heavy history memory.
- Acharya-Badrinath — need causal, only msgs, tiny finger-counts.
Real world: TCP give FIFO, so Chandy-Lamport win most. Lai-Yang mostly cave-school talk. Acharya-Badrinath good when tribe already have causal delivery.
Ugg warn — no make these mistakes
- No say "snapshot is the exact state at one blink." NO — it is a state the tribe COULD have been in, maybe never exactly was.
- Always say the trail-type out loud. Chandy-Lamport need FIFO — worth a mark on the test.
- No forget: the initiator paint OWN state FIRST, before throwing any marker.
- No mix up C1 and C2. C1: throw painted ⇒ stone somewhere. C2: throw not painted ⇒ stone nowhere.
- No use Lai-Yang on a FIFO trail — waste, Chandy-Lamport lighter. Lai-Yang only earn its keep on messy trails.
Ugg remember
- Global snapshot = paint every hunter + every flying stone, tribe never stops. Good one is a consistent cut: no catch without its throw, no arrow point future→past.
- C1 = every thrown stone is somewhere (flying OR caught, never both/neither). C2 = an un-thrown stone is nowhere. If books no balance (total ≠ start), cut is inconsistent.
- Chandy-Lamport: FIFO trail, marker-bones, paint-self-then-mark, msgs, time.
- Lai-Yang: messy trail ok, white→red war-paint, red stone force paint, heavy history memory.
- Acharya-Badrinath: causal trail, SENT/RECD finger-counts, token+reply = msgs, tiny memory.