Multicast r A process group consists of several

  • Slides: 37
Download presentation
Multicast r A process group consists of several processes m. A process might belong

Multicast r A process group consists of several processes m. A process might belong to multiple groups r A multicast operation sends a message to all the members in a group. r The aim of a multicast operations is, for each process in a group, the process should receive a copy of the message sent to the group. m Various delivery guarantees might be required. 1

Ordered multicast r FIFO ordering: if a process multicasts m and then multicasts m’,

Ordered multicast r FIFO ordering: if a process multicasts m and then multicasts m’, then all processes in the group that delivers m’ will deliver m before m’ r Causal ordering: if multicast m happens before multicast m’, then all the processes in the group will deliver m before m’ r Total ordering: if a process delivers message m before m’, then all other processes will deliver m before m’ 2

T 1 T 2 F 1 F 3 F 2 Time C 1 C

T 1 T 2 F 1 F 3 F 2 Time C 1 C 2 C 3 P 1 P 2 P 3 3

Implementing FIFO ordering r A process assigns a sequence number to the message that

Implementing FIFO ordering r A process assigns a sequence number to the message that it broadcasts to the group r Each process maintains some variables to record the number of messages that are sent to/received from the other processes m m S is the sequence number assigned to the broadcast message Rq is the sequence number of the last message that is broadcast by process q r When broadcast a message: m Assign S as the sequence number of the message m Increment S r When receives a message from process q m If the sequence number of the message is R q +1, deliver the message. m Otherwise, place the message in a waiting queue. • The message will be delivered after all the preceding messages are delivered. 4

Implementing total ordering P 2 1 Message 3 2 2 1 Se d e

Implementing total ordering P 2 1 Message 3 2 2 1 Se d e pos o r P q P 4 3 Agreed Seq 1 2 P 1 3 P 3 5

h 1 Holding queue: S 1 Delivery queue: m 1 h 2 m 2

h 1 Holding queue: S 1 Delivery queue: m 1 h 2 m 2 Holding queue: Delivery queue: S 2 6

h 1 Holding queue: Delivery queue: m 1 (1, S 1) S 1 m

h 1 Holding queue: Delivery queue: m 1 (1, S 1) S 1 m 1 h 2 m 2 S 2 Holding queue: Delivery queue: m 2 (1, S 2) 7

h 1 m 1 S 1 ) 1 S 1, ( Holding queue: Delivery

h 1 m 1 S 1 ) 1 S 1, ( Holding queue: Delivery queue: m 1 (1, S 1) m 1 h 2 m 2 S 2 m Holding queue: 2) S , 2 (1 Delivery queue: m 2 (1, S 2) 8

h 1 Holding queue: S 1 Delivery queue: m 1 (1, S 1) m

h 1 Holding queue: S 1 Delivery queue: m 1 (1, S 1) m 2 (2, S 2) m 1 (1, S 1) h 2 Holding queue: S 2 m 2 (1, S 2) Delivery queue: m 2 (1, S 2) m 1 (2, S 1) 9

(2, S 2) h 1 Delivery queue: m 1 (1, S 1) m 2

(2, S 2) h 1 Delivery queue: m 1 (1, S 1) m 2 (2, S 2) m 2 S 1 Holding queue: m 1 (1, S 1) 1 m h 2 (2 Delivery queue: 1) , S Holding queue: S 2 m 2 (1, S 2) m 1 (2, S 1) 10

h 1 Holding queue: S 1 Delivery queue: m 1 (1, S 1) m

h 1 Holding queue: S 1 Delivery queue: m 1 (1, S 1) m 2 (2, S 2) m 1 (1, S 1) m 1 (2, S 1) h 2 Holding queue: S 2 m 2 (1, S 2) m 2 (2, S 2) Delivery queue: m 2 (1, S 2) m 1 (2, S 1) 11

h 1 Holding queue: S 1 m 1 (2, S 1) Delivery queue: m

h 1 Holding queue: S 1 m 1 (2, S 1) Delivery queue: m 1 (1, S 1) m 2 (2, S 2) h 2 Holding queue: m 2 (2, S 2) S 2 Delivery queue: m 2 (1, S 2) m 1 (2, S 1) 12

h 1 Holding queue: S 1 m 1 (2, S 1) Delivery queue: m

h 1 Holding queue: S 1 m 1 (2, S 1) Delivery queue: m 1 (2, S 1)* m 2 (2, S 2) h 2 Holding queue: m 2 (2, S 2) S 2 Delivery queue: m 1 (2, S 1) m 2 (2, S 2)* 13

h 1 Holding queue: m 2 (2, S 2) S 1 Delivery queue: m

h 1 Holding queue: m 2 (2, S 2) S 1 Delivery queue: m 1 (2, S 1) h 2 Holding queue: m 2 (2, S 2) S 2 Delivery queue: m 1 (2, S 1) m 2 (2, S 2)* 14

h 1 Holding queue: m 2 (2, S 2)* S 1 Delivery queue: m

h 1 Holding queue: m 2 (2, S 2)* S 1 Delivery queue: m 1 (2, S 1) h 2 Holding queue: S 2 Delivery queue: m 1 (2, S 1)* m 2 (2, S 2)* 15

h 1 Holding queue: Delivery queue: m 1 (2, S 1) m 2 (2,

h 1 Holding queue: Delivery queue: m 1 (2, S 1) m 2 (2, S 2) S 1 h 2 Holding queue: S 2 Delivery queue: m 1 (2, S 1) m 2 (2, S 2) 16

r The sender transmits msg to its destinations. r Each recipient adds the message

r The sender transmits msg to its destinations. r Each recipient adds the message to the priority queue associated with label, tagging it as undeliverable. It assigns this message a priority larger than the priority of any message that was placed in the queue, with the process ID of the recipient as a suffix. It then informs the sender of the priority that it assigned to the message. r The sender collects responses from recipients that remain operational. It then computes the maximum value of all the priorities it received, and sends this value back to the recipients. r The recipients change the priority of the message to the value they receive from the sender, tag the message as deliverable, and re-sort their priority queues. They then transfer messages from the priority queue to the delivery queue in order of increasing priority, until the priority queue becomes empty or the message with the lowest priority is undeliverable. 17

Implementing causal ordering r Each process maintains a set of variables. m A variable

Implementing causal ordering r Each process maintains a set of variables. m A variable records the multicast messages received from a process in the multicast group m A vector represents the collection of these variables r When a process multicasts a message, it attaches the values of these variables to the message m m The values imply the number of multicast messages that precede the one being multicast Attach the vector r When a process receives a multicast message, the process only delivers the message after the preceding multicast messages have been received 18

r Let Vi[j] represents the message received by process r r r i from

r Let Vi[j] represents the message received by process r r r i from process j Initially, on each process Vi[j] =0 (1 ≤ j ≤ N) When process i multicasts a message Vi[i] is incremented Assume process i receives a message M from process j. The following conditions must be satisfied before M is delivered: m Vj[j] = Vi[j] + 1 • Ensure FIFO order between i and j m Vj[k] ≤ Vi[k] (k ≠ j) • Ensure that multicast messages from other processes that precedes M are delivered first. 19

V 1[1]=0 V 1[2]=0 V 1[3]=0 V 2[1]=0 V 2[2]=0 V 2[3]=0 P 1

V 1[1]=0 V 1[2]=0 V 1[3]=0 V 2[1]=0 V 2[2]=0 V 2[3]=0 P 1 P 2 V 3[1]=0 V 3[2]=0 V 3[3]=0 P 3 20

V 1[1]=1 V 1[2]=0 V 1[3]=0 M 1 V 1[1]=1 V 1[2]=0 V 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3]=1 V 3[1]=2

V 1[1]=2 V 1[2]=0 V 1[3]=1 V 2[1]=1 V 2[2]=0 V 2[3]=1 V 3[1]=2 V 3[2]=0 V 3[3]=1 M 2 V 1[1]=2 V 1[2]=0 V 1[3]=0 M 3 V 3[1]=1 V 3[2]=0 V 3[3]=1 deliver M 2 P 1 P 2 P 3 26

V 1[1]=2 V 1[2]=0 V 1[3]=1 V 2[1]=2 V 2[2]=0 V 2[3]=1 P 2

V 1[1]=2 V 1[2]=0 V 1[3]=1 V 2[1]=2 V 2[2]=0 V 2[3]=1 P 2 V 3[1]=2 V 3[2]=0 V 3[3]=1 P 3 27

Atomic multicast r For some applications, a multicast message is r r required to

Atomic multicast r For some applications, a multicast message is r r required to be delivered either to all the processes or to none at all. On top of the totality requirement, it is also generally required that all messages are delivered in the same order to all processes (i. e. total order) A database is replicated at multiple sites. To ensure the consistency of the replicated databases, all the sites need to receive all the messages in the same order. This type of multicast is called atomic multicast. Since processes might crash during its execution, ensuring atomic multicast is a non-trivial problem. m A process might have delivered a multicast messages to some processes and crashed before it is able to deliver the message to the other processes in the multicast group 28

Virtual Synchrony r Processes might join or leave a multicast group (due to failure

Virtual Synchrony r Processes might join or leave a multicast group (due to failure or planed leave). r A view of a group refers to the membership of a multicast group at a given point of time. r When processes join or leave a group, the view of the group changes. r The processes in a group should have the same group view when a message is multicast. m All the processes agree who should receive the message. r When a process join or leave a group, a view change message should be broadcast to all the processes. m The processes should change their view together. r If the sender of a message crashes during the multicast, the message may either be delivered to all nonfaulty processes or ignored by each of them. A multicast with this property is called virtually synchronous. 29

30

30

Implementing Virtual Synchrony Assumptions r A message is multicast using reliable point-to-point communication (e.

Implementing Virtual Synchrony Assumptions r A message is multicast using reliable point-to-point communication (e. g. TCP). m m Although each point-to-point transmission is guaranteed to succeed, there are no guarantees that all group members receive the message The sender might crash during or before transmitting the message r No process crash during view change Problem r Guarantee that all messages sent to group view G are delivered to all nonfaulty processes in G before the group view changes to G’ (i. e. G ≠G’) Solution r For each message m, each process in G keeps m until it knows that all members in G have received m r If m has been received by all members in G, m is called stable. r Only stable messages can be delivered. 31

r A view change message is sent to all the processes in group view

r A view change message is sent to all the processes in group view G when m m A process wants to join or leave the group A process detected that failure of another process r Process 4 noticed the failure of process 7 and sends a view change message 32

r When a process P receives a view change message, P sends a copy

r When a process P receives a view change message, P sends a copy of any unstable message from the current view to every process in the current view and marked these messages as stable r To indicate that P no longer has any unstable messages and that it is prepared to install the new view, P multicast a flush message for installing the new view r Process 6 sends out all its unstable messages followed by a flush message 33

r After P has received a flush message for the new view from each

r After P has received a flush message for the new view from each other process, P can install the new view r Process 6 installs the new view when it has received a flush message from all other processes 34

reviews r Understand the meaning of FIFO, total and causal r r r order

reviews r Understand the meaning of FIFO, total and causal r r r order multicast and use an example to show why they are important for applications. Understand the three algorithms for implementing the three ordered multicast protocols. Can the causal order protocol be used to ensure FIFO order multicast? Explain why. Can the FIFO order multicast protocol be used to ensure total order multicast? Explain why. Design an algorithm that uses the partially ordered logical timestamp to ensure the casualordering of multicast messages. What properties does atomic multicast have? What is virtual synchrony? 35

reviews r The implementation of the virtual synchrony discussed in our lecture assumes that

reviews r The implementation of the virtual synchrony discussed in our lecture assumes that no failure occurs during the view change. Augment the scheme so that it can cope with failures during the view change. r Extend the implementation of the virtual synchrony discussed in our lecture to provide atomic multicast. 36

readings r K. Birman and T. Joseph. Reliable communications in the presence of failures.

readings r K. Birman and T. Joseph. Reliable communications in the presence of failures. ACM Trans. Comput. Syst. , 5(1), 1987 r K. Birman, A. Schiper, and P. Stephenson. Lightweight causal and atomic group multicast. ACM Transactions on Computer Systems, 9(3): 272 --314, 1991 37