Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

30/07/2017

Multicast T1
T2

 A process group consists of several


processes
A process might belong to multiple groups
 A multicast operation sends a message to
Time
all the members in a group.
 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. P1 P2 P3
 Various delivery guarantees might be required.
1 3

Ordered multicast T1
T2

 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’
 Causal ordering: if multicast m happens Time
before multicast m’, then all the processes
in the group will deliver m before m’
 Total ordering: if a process delivers
message m before m’, then all other
processes will deliver m before m’ P1 P2 P3

2 4

1
30/07/2017

T1 T1
T2 T2

F1
F2 F3

Time Time

P1 P2 P3 P1 P2 P3

5 7

T1 T1
T2 T2

F1 F1
F2 F3 F2 F3

Time Time

P1 P2 P3 P1 P2 P3

6 8

2
30/07/2017

T1 T1
T2 T2

F1 F1
F2 F3 F2 F3

Time Time
C1 C1
C2 C3
C2 C3

P1 P2 P3 P1 P2 P3

9 11

Implementing FIFO ordering


T1
T2  A process assigns a sequence number to the message
that it broadcasts to the group
 Each process maintains some variables to record the
F1 number of messages that are sent to/received from
the other processes
F2 F3
 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
Time
 When broadcast a message:
C1  Assign S as the sequence number of the message
C2  Increment S
C3
 When receives a message from process q
 If the sequence number of the message is Rq +1, deliver the
message.
P1 P2 P3
 Otherwise, place the message in a waiting queue.
• The message will be delivered after all the preceding messages
are delivered.
10 12

3
30/07/2017

Implementing total ordering Implementing total ordering

P2 P2
1 Message 1 Message
3
P4 2 P4
1 1

3 Agreed TS
1 1
P1 2 P1
3

P3 P3

13 15

Implementing total ordering h1


Holding queue: Delivery queue:
P2
1 Message S1 m1
2 P4
1

h2
1
Holding queue: Delivery queue:
2 P1 m2
S2

P3

14 16

4
30/07/2017

h1 h1
Holding queue: Delivery queue: Holding queue: Delivery queue:
m1 (1, S1) m1 (1, S1)
S1 m1 S1 m2 (2, S2)
m1 (1, S1)

h2 h2
Holding queue: Delivery queue: Holding queue: Delivery queue:
m2
S2 m2 (1, S2) S2 m2 (1, S2)
m1 (2, S1)
m2 (1, S2)

17 19

h1 h1
Holding queue: Delivery queue: Holding queue: Delivery queue:
m1 (1, S1) m1 (1, S1)
S1 m1 S1 m2 (2, S2)
m1 (1, S1)

h2 h2
Holding queue: Delivery queue: Holding queue: Delivery queue:
m2
S2 m2 (1, S2) S2 m2 (1, S2)
m1 (2, S1)
m2 (1, S2)

18 20

5
30/07/2017

h1 h1
Holding queue: Delivery queue: Holding queue: Delivery queue:
m1 (1, S1) m1 (2, S1)*
S1 m2 (2, S2) S1 m1 (2, S1) m2 (2, S2)
m1 (1, S1)
m1 (2, S1)

h2 h2
Holding queue: Delivery queue: Holding queue: Delivery queue:
m2 (2, S2)
S2 m2 (1, S2) S2 m1 (2, S1)
m1 (2, S1) m2 (2, S2)*
m2 (1, S2)
m2 (2, S2)

21 23

h1 h1
Holding queue: Delivery queue: Holding queue: Delivery queue:
m1 (1, S1) m2 (2, S2) m1 (2, S1)
S1 m1 (2, S1) m2 (2, S2) S1 m1 (2, S1)

h2 h2
Holding queue: Delivery queue: Holding queue: Delivery queue:
m2 (2, S2) m2 (2, S2)
S2 m2 (1, S2) S2 m1 (2, S1)
m1 (2, S1) m2 (2, S2)*

22 24

6
30/07/2017

h1  The sender transmits msg to its destinations.


 Each recipient adds the message to the priority queue
Holding queue: Delivery queue: associated with label, tagging it as undeliverable. It
m2 (2, S2)* assigns this message a priority larger than the
m1 (2, S1) priority of any message that was placed in the queue,
S1 with the process ID of the recipient as a suffix. It
then informs the sender of the priority that it
assigned to the message.
 The sender collects responses from recipients that
remain operational. It then computes the maximum
h2 value of all the priorities it received, and sends this
value back to the recipients.
Holding queue: Delivery queue:  The recipients change the priority of the message to
the value they receive from the sender, tag the
S2 m1 (2, S1)* message as deliverable, and re-sort their priority
m2 (2, S2)* 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.
25 27

h1 Implementing causal ordering


Holding queue: Delivery queue:  Each process maintains a set of variables.
 A variable records the multicast messages received from a
m1 (2, S1) process in the multicast group
S1  A vector represents the collection of these variables
m2 (2, S2)
 When a process multicasts a message, it attaches the
values of these variables to the message
 The values imply the number of multicast messages that
precede the one being multicast
h2  Attach the vector
 When a process receives a multicast message, the
Holding queue: Delivery queue: process only delivers the message after the
preceding multicast messages have been received
S2 m1 (2, S1)  Assumption: the communication between two
m2 (2, S2) processes has the FIFO property

26 28

7
30/07/2017

V1[1]=0 V2[1]=0 V3[1]=0 V1[1]=1 V2[1]=1 V3[1]=1


V1[2]=0 V2[2]=0 V3[2]=0 V1[2]=0 V2[2]=0 V3[2]=0
V1[3]=0 V2[3]=0 V3[3]=0 V1[3]=0 V2[3]=0 V3[3]=0

P1 P2 P3 P1 P2 P3
29 31

V1[1]=1 V2[1]=0 V3[1]=0 V1[1]=2 V2[1]=1 V3[1]=1


V1[2]=0 V2[2]=0 V3[2]=0 V1[2]=0 V2[2]=0 V3[2]=0
V1[3]=0 V2[3]=0 V3[3]=0 V1[3]=0 V2[3]=0 V3[3]=1
M1
V1[1]=1
V1[2]=0 deliver M1
V1[3]=0 deliver M1 deliver M1 M2 M3
V1[1]=2 V3[1]=1
V1[2]=0 V3[2]=0
deliver M2
V1[3]=0 deliver M3 V3[3]=1

P1 P2 P3 P1 P2 P3
30 32

8
30/07/2017

V1[1]=2 V2[1]=1 V3[1]=1 V1[1]=2 V2[1]=1 V3[1]=2


V1[2]=0 V2[2]=0 V3[2]=0 V1[2]=0 V2[2]=0 V3[2]=0
V1[3]=0 V2[3]=0 V3[3]=1 V1[3]=1 V2[3]=1 V3[3]=1

M2 M3 M2 M3
deliver M3
V1[1]=2 V3[1]=1 V1[1]=2 V3[1]=1
V1[2]=0 V3[2]=0 V1[2]=0 V3[2]=0
V1[3]=0 V3[3]=1 V1[3]=0 V3[3]=1

deliver M3
deliver M2 deliver M2

P1 P2 P3 P1 P2 P3
33 35

V1[1]=2 V2[1]=1 V3[1]=2 V1[1]=2 V2[1]=2 V3[1]=2


V1[2]=0 V2[2]=0 V3[2]=0 V1[2]=0 V2[2]=0 V3[2]=0
V1[3]=1 V2[3]=1 V3[3]=1 V1[3]=1 V2[3]=1 V3[3]=1

M2 M3
V1[1]=2 V3[1]=1
V1[2]=0 V3[2]=0
V1[3]=0 V3[3]=1

P1 P2 P3 P1 P2 P3
34 36

9
30/07/2017

 Let Vi[j] represents the message received by process


i from process j
 Initially, on each process Vi[j] =0 (1 ≤ j ≤ N)
 When process i multicasts a message Vi[i] is  Since processes might crash during its
incremented execution, ensuring reliable multicast is a
 Assume process i receives a message M from process non-trivial problem.
j. The following conditions must be satisfied before A process might have delivered a multicast
messages to some processes and crashed
M is delivered: before it is able to deliver the message to the
 Vj[j] = Vi[j] + 1 other processes in the multicast group
• Ensure FIFO order between i and j
 Vj[k] ≤ Vi[k] (k ≠ j)
 We want all the nonfaulty processes
• Ensure that multicast messages from other processes that receive the same set of multicast messages
precedes M are delivered first.
 The faulty processes will not participate in
the computation. So, they are not a
concern.
37 39

A naïve algorithm for achieving


Reliable multicast
 For some applications, a multicast message is
reliable multicast
required to be delivered either to all the
processes or to none at all.  The sender uses TCP to send multicast
A command sent to a group of players in an on-line message to each receiver.
game  To ensure a message is received by all
 Reliable multicast means that every process in
processes in a group, each receiver sends a
the process group receives all multicasts
received multicast message to all the other
 Reliability is orthogonal to ordering
 Can implement Reliable-FIFO, or Reliable-Causal, or
processes in the group except the sender
Reliable-Total of the multicast message.
A receiver would not re-multicast the same
message more than once.
 What’s the message complexity?

38 40

10
30/07/2017

Virtual Synchrony  A multicast message M is said to be “delivered in a view


V at process P” if P receives view V and delivers M
 Virtual synchrony is a model for managing group
membership and group communications. before P receives the next view
 Virtual synchrony ensures that
 Processes might join or leave a multicast group
(due to failure or planed leave).  The set of multicasts delivered in a given view is the same at
all non-faulty processes that were in that view
 A view of a group refers to the membership of a The sender of the multicast message also belongs to that view
multicast group at a given point of time.

 If the sender of a message crashes during the multicast, the
 When processes join or leave a group, the view message may either be delivered to all nonfaulty processes or
of the group changes. ignored by each of them.
 The processes in a group should have the same  A multicast with this property is called virtually
group view when a message is multicast. synchronous.
 Allthe processes agree who should receive the  Systems that implemented it have been used in many
message.
mission-critical information systems, e.g. NYSE, Air
 When a process join or leave a group, a view Traffic Control System.
change message should be broadcast to all the
processes.
 The processes should change their view together.
41 43

 Virtual synchrony guarantees that all view


changes are delivered in the same order at
examples
all non-faulty processes
 If a P1 process receives view changes, say {P1},
{P1, P2, P3}, {P1, P2}, {P1, P2, P4} then non-faulty
process receives the same sequence of view
changes (after it joins the group)
 E.g. P2 receives views {P1, P2, P3}, {P1, P2}, {P1,
P2, P4}

Acknowledgement: This example is adapted from Prof. Indranil Gupta of UIUC

42 44

11
30/07/2017

examples

Acknowledgement: This example is adapted from Prof. Indranil Gupta of UIUC Acknowledgement: This example is adapted from Prof. Indranil Gupta of UIUC

45 47

Acknowledgement: This example is adapted from Prof. Indranil Gupta of UIUC Acknowledgement: This example is adapted from Prof. Indranil Gupta of UIUC

46 48

12
30/07/2017

Implementing Virtual Synchrony  When a process P receives a view change message, P sends a
copy of any unstable message from the current view to
Assumptions
 A message is multicast using reliable point-to-point communication every process in the current view and marked these
(e.g. TCP). messages as stable
 Although each point-to-point transmission is guaranteed to succeed, there
are no guarantees that all group members receive the message  To indicate that P no longer has any unstable messages and
 The sender might crash during or before transmitting the message that it is prepared to install the new view, P multicast a
 No process crash during view change flush message for installing the new view
 There is one leader for handling view change

Problem
 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  Process 6 sends out
≠G’) all its unstable
messages followed
Solution by a flush message
 For each message m, each process in G keeps m until it knows that all
members in G have received m
 If m has been received by all members in G, m is called stable.
 Only stable messages can be deleted.

49 51

 A view change message is sent to all the processes


 After P has received a flush message for the new
in group view G when
view from each other process, P can install the
 A process wants to join or leave the group
new view
 A process detected that failure of another process

 Process 4 noticed
the failure of  Process 6 installs
process 7 and sends the new view when
a view change it has received a
flush message
message
from all other
processes

50 52

13
30/07/2017

reviews
 Understand the meaning of FIFO, total and causal
readings
order multicast and use an example to show why
they are important for applications.
 Understand the three algorithms for implementing  K. Birman and T. Joseph. Reliable
the three ordered multicast protocols. communications in the presence of failures.
 Can the causal order protocol be used to ensure ACM Trans. Comput. Syst., 5(1), 1987
FIFO order multicast? Explain why.
 Can the FIFO order multicast protocol be used to  K. Birman, A. Schiper, and P. Stephenson.
ensure total order multicast? Explain why. Lightweight causal and atomic group
 Design an algorithm that uses the partially
ordered logical timestamp to ensure the casual- multicast. ACM Transactions on Computer
ordering of multicast messages. Systems, 9(3):272--314, 1991
 What properties does virtual synchrony have?

53 55

reviews

 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.
 Assume that multiple processes can contact
different processes in the process group
concurrently for joining the process group.
Augment the scheme discussed in our lecture to
handle the view change correctly.
 Extend the implementation of the virtual
synchrony discussed in our lecture to provide
reliable total-order multicast. 54

14

You might also like