190 likes | 206 Views
Learn how to measure messages in transit on the internet, record consistent snapshots in distributed systems, and apply Chandy-Lamport Algorithm for deadlock detection and recovery.
E N D
How many messages are in transit on the internet? How do we measure this? Distributed snapshot
One-dollar bank Let a single token circulate in the network. How can someone count the total number of tokens in circulation? How to make sure that the same token is not counted more than once?
Useful in - deadlock detection - termination detection - rollback recovery etc. Importance of snapshots
(aconsistent cutC) (b a) b C Consistent cut b g c a d P1 e m f P2 P3 k h i j Cut 1 Cut 2 (Not consistent) (Consistent) A cut is a set of events.
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 C1 and C2 be two consistent cuts and C1 C2. Then C2 is more recent than C1. • Analyze why certain cuts in the one-dollar bank are inconsistent.
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.
Works on a (1) strongly connected graph (2) each channel is FIFO. An initiator initiates the algorithm by sending out a marker ( ) Chandy-Lamport Algorithm
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. White and red processes
Step 1. In one atomic action, the initiator does the following:(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 of its outgoing channels The algorithm terminates when (1) every process turns red, and (2) Every process has received a marker through each incoming channel. Two steps
Lemma 1 No red message is received in a white action. Why does it work?
Theorem. The 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? SSS
Verify that Chandy -Lamport algorithm correctly counts the tokens circulating in the system Example 1. Count the tokens
Verify the result Run Chandy-lamport snapshot on the network of machines, and observe that the snapshot state is down up M’ Does this appear strange?
Understanding snapshot The observed state is a feasible state reachable from the initial configuration. It may not be visited during a specific set of runs. The final state is always reachable from the observed state.
Questions What good is a snapshot if that state is never reached by the system? - It is relevant for the detection of stable predicates. - Useful for checkpointing.
Questions What if the channels are not FIFO? Study how Lai-Yang algorithm works. LY1. The initiator records its own state. When it needs to send a message m to another process, it sends a message (m, red). LY2. When a process receives a message (m, red), it records its state if it has not already done so, and then accepts the message m.
Questions Distributed snapshot = distributed read. distributed reset = distributed write How difficult is distributed reset?