distributed systems causal broadcast

29
1 Distributed systems Causal Broadcast Prof R. Guerraoui Distributed Programming Laboratory

Upload: karena

Post on 13-Jan-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Distributed systems Causal Broadcast. Prof R. Guerraoui Distributed Programming Laboratory. Overview. Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using the past and A blocking algorithm using vector clocks. Broadcast. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Distributed systems Causal Broadcast

1

Distributed systems

Causal Broadcast

Prof R. GuerraouiDistributed Programming

Laboratory

Page 2: Distributed systems Causal Broadcast

2

OverviewIntuitions: why causal broadcast?Specifications of causal broadcastAlgorithms:

A non-blocking algorithm using the past and A blocking algorithm using vector clocks

Page 3: Distributed systems Causal Broadcast

3

Broadcast

B

A

C

m

m

deliver

broadcast

deliver

Page 4: Distributed systems Causal Broadcast

4

Intuitions (1)So far, we did not consider ordering among messages; In particular, we considered messages to be independent Two messages from the same process might not be delivered in the order they were broadcast A message m1 that causes a message m2 might be delivered by some process after m2

Page 5: Distributed systems Causal Broadcast

5

Intuitions (2)Consider a system of news where every new event that is displayed in the screen contains a reference to the event that caused it, e.g., a comment on some information includes a reference to the actual information Even uniform reliable broadcast does not guarantee such a dependency of delivery Causal broadcast alleviates the need for the application to deal with such dependencies

Page 6: Distributed systems Causal Broadcast

6

Modules of a process

request

indication

indication

indication

request

Page 7: Distributed systems Causal Broadcast

7

OverviewIntuitions: why causal broadcast?Specifications of causal broadcastAlgorithms:

A non-blocking algorithm using the past and A blocking algorithm using vector clocks

Page 8: Distributed systems Causal Broadcast

8

Causal broadcastEvents

Request: <coBroadcast, m>

Indication: <coDeliver, src, m>

• Property:

• Causal Order (CO)

Page 9: Distributed systems Causal Broadcast

9

CausalityLet m1 and m2 be any two messages: m1 -> m2 (m1 causally precedes m2) iff

C1 (FIFO order). Some process pi broadcasts m1 before broadcasting m2

C2 (Local order). Some process pi delivers m1 and then broadcasts m2

C3 (Transitivity). There is a message m3 such that m1 -> m3 and m3 - > m2

Page 10: Distributed systems Causal Broadcast

10

Causal broadcastEvents

Request: <coBroadcast, m>

Indication: <coDeliver, src, m>

• Property:

• CO: If any process pi delivers a message m2, then pi must have delivered every message m1 such that m1 -> m2

Page 11: Distributed systems Causal Broadcast

11

Causality ?

p1

p2

p3

m2delivery

delivery

delivery

m1

m1delivery

m2

delivery

delivery

Page 12: Distributed systems Causal Broadcast

12

Causality ?

p1

p2

p3

m2

delivery

delivery

delivery

m1

m1delivery

delivery

delivery

m2

Page 13: Distributed systems Causal Broadcast

13

Reliable causal broadcast (rcb)

Events

Request: <rcoBroadcast, m>

Indication: <rcoDeliver, src, m>

• Properties:

• RB1, RB2, RB3, RB4 +

• CO

Page 14: Distributed systems Causal Broadcast

14

Uniform causal broadcast (ucb)

Events

Request: <ucoBroadcast, m>

Indication: <ucoDeliver, src, m>

• Properties:

• URB1, URB2, URB3, URB4 +

• CO

Page 15: Distributed systems Causal Broadcast

15

OverviewIntuitions: why causal broadcast?Specifications of causal broadcastAlgorithms:

A non-blocking algorithm using the past and A blocking algorithm using vector clocks

Page 16: Distributed systems Causal Broadcast

16

AlgorithmsWe present reliable causal broadcast algorithms using reliable broadcast underlying abstractions

We obtain uniform causal broadcast algorithms by using instead an underlying uniform reliable broadcast

Page 17: Distributed systems Causal Broadcast

17

Algorithm 1Implements: ReliableCausalOrderBroadcast (rco).

Uses: ReliableBroadcast (rb).

upon event < Init > do

delivered := past := empty;

upon event < rcoBroadcast, m> do

trigger < rbBroadcast, [Data,past,m]>;

past := past U {[self,m]};

Page 18: Distributed systems Causal Broadcast

18

Algorithm 1 (cont’d)upon event <rbDeliver,pi,[Data,pastm,m]> do

if m not in delivered then

(*) forall [sn, n] in pastm do

if n not in delivered then

trigger < rcoDeliver,sn,n>;

delivered := delivered U {n};

past := past U {[sn, n]};

Page 19: Distributed systems Causal Broadcast

19

Algorithm 1 (cont’d) (*)

trigger <rcoDeliver,pi,m>;

delivered := delivered U {m};

past := past U {[pi,m]};

Page 20: Distributed systems Causal Broadcast

20

Algorithm 1

p1

p2

p3

m2(m1)

m2

m1

m1

m1

m1 m2(m1)

m2

m2m1

Page 21: Distributed systems Causal Broadcast

21

Algorithm 1

p1

p2

p3

m1

m1

m2(m1)

m2(m1)

m2 m1

m1 m2

m2m1

Page 22: Distributed systems Causal Broadcast

22

Uniformity

Algorithm 1 ensures causal reliable broadcast

If we replace reliable broadcast with uniform reliable broadcast, Algorithm 1 would ensure uniform causal broadcast

Page 23: Distributed systems Causal Broadcast

23

Algorithm 1’ (gc)Implements: GarbageCollection (+ Algo 1).

Uses:

ReliableBroadcast (rb).

PerfectFailureDetector(P).

upon event < Init > do

delivered := past := empty;

correct := S;

ackm := empty (for all m);

Page 24: Distributed systems Causal Broadcast

24

Algorithm 1’ (gc – cont’d)upon event < crash, pi > do

correct := correct \ {pi}

• upon for some m in delivered: self not in ackm do

• ackm := ackm U {self};

• trigger < rbBroadcast, [ACK,m]>;

Page 25: Distributed systems Causal Broadcast

25

Algorithm 1’ (gc – cont’d)upon event <rbDeliver,pi,[ACK,m]> do

ackm := ackm U {pi};

if forall pj in correct: pj in ackm do

past := past \ {[sm, m]};

Page 26: Distributed systems Causal Broadcast

26

Algorithm 2Implements: ReliableCausalOrderBroadcast (rco).

Uses: ReliableBroadcast (rb).

upon event < Init > do

for all pi in S: VC[pi] := 0;

upon event < rcoBroadcast, m> do

VC[self] := VC[self] + 1.

trigger < rbBroadcast, [Data,VC,m]>;

Page 27: Distributed systems Causal Broadcast

27

Algorithm 2upon event <rbDeliver, pj, [Data,VCm,m]> do

wait until ( (VC[pj] VCm[pj] – 1) and

(for all pk ≠ pj: VC[pk] VCm[pk]));

trigger < rcoDeliver, pj,m>;

if pj ≠ self then

VC[pj] := VC[pj] + 1.

Page 28: Distributed systems Causal Broadcast

28

Algorithm 2

p1

p2

p3 m2

m1

m1

m1

m1

m2

m2

m2m1

[2,0,0]

[1,0,0]

[1,0,0]

m2[2,0,0]

Page 29: Distributed systems Causal Broadcast

29

Algorithm 2

p1

p2

p3

m2

m1

m1

m1

m1

m2

m2[1,0,0]

[1,1,0]

[1,1,0]

[1,0,0]

m2

m1

m2