Hwajung Lee ITEC 452 Distributed Computing Lecture 8
Hwajung Lee ITEC 452 Distributed Computing Lecture 8 Distributed Snapshot
Distributed snapshot -- How many messages are in transit on the internet? -- What is the global state of a distributed system of N processes? How do we compute these?
One-dollar bank Let a $1 coin circulate in a network of a million banks. How can someone count the total $ in circulation? If not counted “properly, ” then one may think the total $ in circulation to be one million.
Importance of snapshots Major uses in - deadlock detection - termination detection - rollback recovery - global predicate computation
Consistent cut A cut is a set of events. (a consistent cut C) (b happened before a) b C If this is not true, then the cut is inconsistent P 1 b a m P 2 P 3 c k Cut 1 (Consistent) d g e h i Cut 2 (Not consistent) f j
Consistent snapshot The set of states immediately following a consistent cut forms a consistent snapshot of a distributed system. A snapshot that is of practical interest is the most recent one. Let C 1 and C 2 be two consistent cuts and C 1 C 2. Then C 2 is more recent than C 1.
Consistent snapshot How to record a consistent snapshot? Note that 1. The recording must be non-invasive 2. Recording must be done on-the-fly. You cannot stop the system.
Chandy-Lamport Algorithm Works on a (1) strongly connected graph (2) each channel is FIFO. A process called the initiator initiates the distributed snapshot algorithm by sending out a marker ( )
White and red processes Initially every process is white. When a process receives a marker, it turns red if it has not already done so. Every action by a process, and every message sent by a process gets the color of that process.
Two steps Step 1. In one atomic action, the initiator (a) turns red (b) records its own state (c) sends a marker along all outgoing channels Step 2. Every other process, upon receiving a marker for the first time (and before doing anything else) (a) turns red (b) records its own state (c) sends markers along all outgoing channels The algorithm terminates when (1) every process turns red, and (2) every process has received a marker through each incoming channel.
Why does it work? Lemma 1. No red message is received by a white action.
Why does it work? All white All red SSS Easy conceptualization of the snapshot state Theorem. The Chandy-Lamport algorithm records a consistent global state. The global state recorded by Chandy-Lamport algorithm is equivalent to the ideal snapshot state SSS. Hint. A pair of actions (a, b) can be scheduled in any order, if there is no causal order between them, so (a, b) is equivalent to (b, a)
Why does it work? Let an observer see the following actions: w[i] w[k] r[k] w[j] r[i] w[l] r[j] r[l] … w[i] w[k] w[j] r[k] r[i] w[l] r[j] r[l] … [Lemma 1] w[i] w[k] w[j] r[k] w[l] r[i] r[j] r[l] … [Lemma 1] w[i] w[k] w[j] w[l] r[k] r[i] r[j] r[l] … [done!] Recorded state Call it “break, ” when a red action precedes a white action in a given run. The idea view of the schedule has zero breaks. But in general, The number of breaks in the recorded sequence of actions can be a positive A swap reduces the number of breaks by 1.
- Slides: 13