Professional Documents
Culture Documents
4 Message Ordering 1629630103769
4 Message Ordering 1629630103769
4 Message Ordering 1629630103769
Course ID: SS ZG526, Title: Distributed Computing 2 BITS Pilani, Hyderabad Campus
Causal Order
• A system supporting causal ordering model satisfies
CO: for mij and mkj , if send(mij ) → send(mkj ),
then rec(mij ) → rec(mkj )
•2 criteria must be satisfied by a causal ordering
protocol:
• Safety
• Liveness
Course ID: SS ZG526, Title: Distributed Computing 3 BITS Pilani, Hyderabad Campus
Causal Order
Safety
•a message M arriving at a process may need to be buffered until all
system-wide messages sent in the causal past of the send(M) event to the
same destination have already arrived
•distinction is made between
• arrival of a message at a process
• event at which the message is given to the application process
Liveness
A message that arrives at a process must eventually be delivered to the
process
Course ID: SS ZG526, Title: Distributed Computing 4 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
• each message M should carry a log of
• all other messages
• sent causally before M’s send event, and sent to the same
destination dest(M)
• log can be examined to ensure whether it is safe to deliver a
message
• channels are FIFO
Course ID: SS ZG526, Title: Distributed Computing 5 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
local variables:
• array of int SENT[1 …… n, 1 …… n] (n x n array)
• SENTi[j, k] = no. of messages sent by Pj to Pk as known to Pi
• array of int DELIV [1 …… n]
• DELIVi[j] = no. of messages from Pj that have been delivered to Pi
Course ID: SS ZG526, Title: Distributed Computing 6 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
Course ID: SS ZG526, Title: Distributed Computing 7 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
Complexity:
• space requirement at each process: O(n2) integers
• space overhead per message: n2 integers
• time complexity at each process for each send and deliver
event: O(n2)
Course ID: SS ZG526, Title: Distributed Computing 8 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
• P1 sent 3 messages to P2 SENT of P1 Updated SENT of P1
• P1 sent 4 messages to P3 0 4 4
0 3 4
• P2 sent 5 messages to P1
5 0 2 5 0 2
• P2 sent 2 messages to P3
0 4 0 0 4 0
• P3 sent 4 messages to P2
• Now if, DELIV1 = [0 4 0]
• P1 sends m1 to P2 SENT of P2
DELIV2 = [3 0 4]
0 3 4
DELIV3 = [3 2 0] 5 0 2
0 4 0
Course ID: SS ZG526, Title: Distributed Computing 9 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
• P1 sent 3 messages to P2 SENT of P3 Updated SENT of P3
• P1 sent 4 messages to P3 0 3 4 0 3 4
• P2 sent 5 messages to P1 5 0 2 5 0 2
• P2 sent 2 messages to P3 0 4 0 0 5 0
• P3 sent 4 messages to P2
• Now if, DELIV1 = [0 4 0] SENT of P2
• P3 sends m2 to P2 0 3 4
DELIV2 = [4 0 4]
5 0 2
DELIV3 = [3 2 0] 0 4 0
Course ID: SS ZG526, Title: Distributed Computing 10 BITS Pilani, Hyderabad Campus
Raynal–Schiper–Toueg Algorithm
• P1 sent 3 messages to P2 SENT of P1 Updated SENT of P1
• P1 sent 4 messages to P3
0 4 4 0 4 5
• P2 sent 5 messages to P1
5 0 2 5 0 2
• P2 sent 2 messages to P3
0 4 0 0 4 0
• P3 sent 4 messages to P2
• Now if, DELIV1 = [0 4 0]
• P1 sends m3 to P3
DELIV2 = [3 0 4]
DELIV3 = [3 2 0]
Course ID: SS ZG526, Title: Distributed Computing 11 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
• Ci = vector clock of Pi
• Ci[j] = jth element of Ci
Pi sends a message m to Pj
• Pi increments Ci[i]
Course ID: SS ZG526, Title: Distributed Computing 13 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
[ 0 0 0 ]P1
[ 0 0 1]
vectors in blue indicate
[ 0 0 0 ]P2 timestamps of messages
[ 0 0 1]
P3
[000]
[ 0 0 1]
Course ID: SS ZG526, Title: Distributed Computing 14 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
[ 0 0 0 ]P1
[ 0 0 1]
P2 [ 0 0 1]
[000]
[ 0 0 1]
[ 0 0 0 ]P3
[ 0 0 1]
Course ID: SS ZG526, Title: Distributed Computing 15 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
[ 0 0 0 ] P1
[ 0 11 ]
[ 0 0 1]
vectors in red indicate
[ 0 0 0 ]P2 [ 0 0 1 ] [ 0 11 ] timestamps of messages
[ 0 0 1] [ 0 11 ]
[ 0 0 0 ]P3
[ 0 0 1] [ 0 11 ]
Course ID: SS ZG526, Title: Distributed Computing 16 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
P1 (buffer) [ 0 0 1 ]
[000]
[ 0 11 ]
[ 0 0 1]
[ 0 0 0 ]P2 [ 0 0 1 ] [ 0 11 ]
[ 0 0 1] [ 0 11 ]
P3
[000]
[ 0 0 1] [ 0 11 ]
Course ID: SS ZG526, Title: Distributed Computing 17 BITS Pilani, Hyderabad Campus
Birman-Schiper-Stephenson Protocol
P1 (buffer) [ 0 0 1 ] [ 0 11 ]
[000]
[ 0 11 ] deliver
SES Protocol from
[ 0 0 1] from buffer
Recorded Lecture
[ 0 0 0 ]P2 [ 0 0 1 ] [ 0 11 ]
[ 0 0 1] [ 0 11 ]
P3
[000]
[ 0 0 1] [ 0 11 ]
Course ID: SS ZG526, Title: Distributed Computing 18 BITS Pilani, Hyderabad Campus
References
• Ajay D. Kshemkalyani, and Mukesh Singhal, Chapter 6,
“Distributed Computing: Principles, Algorithms, and Systems”,
Cambridge University Press, 2008.
• Ajay D. Kshemkalyani, and Mukesh Singhal, Chapter 7,
“Distributed Computing: Principles, Algorithms, and Systems”,
Cambridge University Press, 2008.
• https://courses.csail.mit.edu/6.006/fall11/rec/rec14.pdf
Course ID: SS ZG526, Title: Distributed Computing 19 BITS Pilani, Hyderabad Campus
Thank You
Course ID: SS ZG526, Title: Distributed Computing 20 BITS Pilani, Hyderabad Campus