| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| Previous | Next |
|---|---|
| Lecture 7 | Lecture 9 |
This is an example of a decentralised1 algorithm that allows you to take a global snapshot of a running distributed system, and its design gives us two key advantages:
The act of initiating a snapshot creates a cascade of marker messages throughout the entire system. This message cascade then causes all the other processes to take a snapshot of themselves.
If process P1 decides to initiate a snapshot, then the following sequence of events takes place:
Notice that at the time P1's snapshot happens, message m is currently in the channel from P2 to P1 (channel C21).
IMPORTANT
Due the fact that all channels behave as FIFO queues, we do not need to be concerned about the possibility of FIFO anomalies. This system is designed such that marker messages cannot arrive before earlier message-send events in the originating process.
None of what follows would work if we had not first eliminated the possibility of FIFO anomalies!
When a process receives a marker message, it can react in one of two different ways. How it reacts depends on whether or not that process has already seen a marker message during this run of the global snapshot.
If this is the first time this process has seen a marker message, the receiver:
Q: During a snapshot, once a channel is marked as empty, what happens if you then receive a message on that channel?
A: Whilst the snapshot is running, messages received on channels marked as empty are ignored!
In the diagram below, since this is the first marker message P2 has seen, it does the following:
If a process sends out a marker message, then we consider that process already to have "seen" a marker message (its own). So when a process that has already sent out its own marker message receives someone else's marker message, it:
Message m from P2 (sent at event C) arrives on channel C21 as event D in process P1. This message arrived before the marker message because channels always behave as FIFO queues.
Upon receiving this marker message, P1 then:
So, we now have a consistent snapshot of our entire system, which in this simple case, consists of four things:
When a snapshot takes place, every process ends up sending out a marker message to every other process. So, for a system containing N participating processes, N * (N - 1) marker messages will be sent. This might seem inefficient as the number of messages rises quadratically with the number of participating processes, but unfortunately, there is no better approach.
As stated in the previous lecture, the success of the Chandy-Lamport algorithm relies entirely on the truth of the following assumptions:
In this example, we have three communicating processes P1, P2 and P3 in our system, and we want to take a snapshot.
Process P1 acts as the initiator; so it follows the above steps:
Next, P3 receives the marker message from P1. Since this is the first marker message it has received:
Looking at P3's marker message that now arrives at P1, since P1 initiated the snapshot process, this is not the first marker it has seen, so P1:
Now look at the other marker message from P3 to P2. This is the first marker P2 has seen, so it:
Eventually, the initial marker message from P1 arrives at P2. This is the second marker P2 has seen, so it:
P2's marker message now arrives at P1. This is not the first marker P1 has seen, so it:
Lastly, the marker message from P2 arrives at P3. Similarly, this is not the first marker P3 has seen, so it:
We now have a consistent snapshot of the entire system composed of three process states:
And six channel states:
In the above diagram, events C, D and E do not form part of P1's snapshot recorded in state S1 because these events had not yet occurred at the time P1 decided to take its snapshot.
Similarly, events J and K do not form part of P3's snapshot recorded in state S3 because these events had not yet occurred at the time the marker message arrived from P1.
These events will all be recorded the next time a snapshot is taken.
An individual process knows its local snapshot is complete when it has recorded:
If it can be shown that the snapshot process terminates for an individual process, and all individual processes use the same snapshot algorithm, then it follows that the snapshot will terminate for all participating processes in the system.
Now we can appreciate the importance of the assumptions listed at the start. The success of this entire algorithm rests on the fact that:
In Chandy & Lamport's original paper they provide a proof that the snapshot process does in fact terminate.
However, determining when the snapshot for the entire system is complete lies outside the rules of the Chandy-Lamport algorithm itself. Management of an entire system snapshot needs to be handled by some external coordinating process that:
| Previous | Next |
|---|---|
| Lecture 7 | Lecture 9 |
Endnotes
1 In this context, a "decentralised algorithm" is one that does not need to be invoked from a special coordinating process; any process in the system can act as the initiator. A beneficial side-effect of this is that if two processes simultaneously decide to initiate a snapshot, then nothing bad happens.
| Back | FazBrowse Home | New Git URL |