Distributed System (6-7)
linearization
- Liveness: guarantee that something good will happen eventually
- Safety: guarantee that something bad will never happen.
- Stable: once true, stays true forever afterwards
Multicast
Basic Multicast (B-Multicast)
- B-multicast(group , message ):
- for each process in , send .
- receive( ): B-deliver( ) at
Reliable Multicast (R-Multicast)
- Integrity: A correct process delivers a message at most once.
- Validity: If a correct process multicasts (sends) message , then it will eventually deliver to itself. (Liveness)
- Agreement: If a correct process delivers message , then all the other correct processes in group( ) will eventually deliver .
- Validity and agreement together ensure overall liveness: if some
correct process multicasts a message m, then, all correct processes
deliver m too.
R-multicast is reliable even after the sender crashes.
Implementing R-Multicast
On initialization:
- Received
For process to R-multicast message to group
- B-multicast , (notice )
On B-deliver at process in group
- if Received
- Received Received
- if :
- B-multicast
- R-deliver
Ordered Multicast
FIFO ordering
For a process, if it sends before , then all processes recieves before .
Causal ordering
If multicasts ( cause , which means a process sends after recieving ), then all processes recieves before .
Causal ordering implies FIFO ordering, because multicasts that sent by a process can be regarded as Causal
Total ordering
For any pair of multicasts , , all processes recieving them recieves them in the same order.
Total Ordering doesn’t imply Causal Ordering
implementing ordered multicast
Implement FIFO multicast
Each process has a sequence vector
On process sending multicast ( , ):
- B-multicast( , )
On process recieving multicast from :
- buffer it until , then
- deliver
Implement causal order multicast
On process sending multicast ( , ):
- B-multicast( , )
On process recieving multicast from :
- buffer it until and
- deliver
Implement total order multicast
A special process as sequencer.
On process sending multicast ( , ):
- B-multicast
Sequencer:
- init:
- On sequencer recieving multicast from :
- B-multicast
Process :
- init:
- On process recieving B-deliver from :
- buffer it until
i. B-deliver from sequencer, and
ii.
, then: - deliver
- buffer it until
ISIS algorithm for total ordering
Sender multicasts message to everyone.
Each message recieved by a process may have:
- agreed priority
- proposed priority
- a marker: undeliverable or not
Each processes have
- largest agreed priority
- largest proposed priority
- an priority queue of messages order by agreed priority or proposed priority
To send a total order multicast to all processes in by :
- B-multicast where is an identifier for .
- take the largest proposed priority collected from all other process as agreed priority .
- B-multicast (here a can be
a:i
, i.e. attached with process id to avoid same priority) - set as the agreed priority of
- mark as diliverable
- update the priority queue
- if the message at the top of the queue is deliverable:
- deliver
Upon process recieving from
- if received :
- take as the new proposed priority.
- send
- if received :
- set as the agreed priority of
- mark as diliverable
- update the priority queue
- if the message at the top of the queue is deliverable:
- deliver
ISIS algorithm takes longer time than sequencer algorithm.
{: .prompt-info }
Proof of ISIS algorithm
two messages: , , two procesess , .
Assume delivers first.
When delivers , is either
- in queue and deliverable.
- agreed_priority agreed_priority
- in queue. not deliverable.
- agreed_priority propose_priority agreed_priority
- not in queue.
- agreed_priority propose_priority agreed_priority
Therefore
agreed_priority agreed_priority
And if delivers first, Contradiction.