Скачать презентацию Distributed systems Causal Broadcast Prof R Guerraoui Distributed Скачать презентацию Distributed systems Causal Broadcast Prof R Guerraoui Distributed

fdc059abd608a02435928c0f5fbf455c.ppt

  • Количество слайдов: 32

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

Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using the past and A blocking algorithm using vector clocks 2

Broadcast A deliver m B m broadcast deliver C 3 Broadcast A deliver m B m broadcast deliver C 3

Intuitions (1) So far, we did not consider ordering among messages; In particular, we 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 m 1 that causes a message m 2 might be delivered by some process after m 2 4

Intuitions (2) Consider a system of news where every new event that is displayed 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 5

Modules of a process indication request indication 6 Modules of a process indication request indication 6

Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using the past and A blocking algorithm using vector clocks 7

Causal broadcast Events Request: <co. Broadcast, m> Indication: <co. Deliver, src, m> • Property: Causal broadcast Events Request: Indication: • Property: • Causal Order (CO) 8

Causality Let m 1 and m 2 be any two messages: m 1 -> Causality Let m 1 and m 2 be any two messages: m 1 -> m 2 (m 1 causally precedes m 2) iff C 1 (FIFO order). Some process pi broadcasts m 1 before broadcasting m 2 C 2 (Local order). Some process pi delivers m 1 and then broadcasts m 2 C 3 (Transitivity). There is a message m 3 such that m 1 -> m 3 and m 3 - > m 2 9

Causal broadcast Events Request: <co. Broadcast, m> Indication: <co. Deliver, src, m> • Property: Causal broadcast Events Request: Indication: • Property: • CO: If any process pi delivers a message m 2, then pi must have delivered every message m 1 such that m 1 -> m 2 10

Causality ? delivery p 1 m 1 p 2 delivery m 1 m 2 Causality ? delivery p 1 m 1 p 2 delivery m 1 m 2 p 3 delivery 11

Causality ? delivery p 1 m 1 p 2 delivery m 1 m 2 Causality ? delivery p 1 m 1 p 2 delivery m 1 m 2 p 3 delivery 12

Causality ? delivery p 1 delivery m 2 m 1 p 2 delivery m Causality ? delivery p 1 delivery m 2 m 1 p 2 delivery m 2 p 3 m 1 delivery 13

Reliable causal broadcast (rcb) Events Request: <rco. Broadcast, m> Indication: <rco. Deliver, src, m> Reliable causal broadcast (rcb) Events Request: Indication: • Properties: • RB 1, RB 2, RB 3, RB 4 + • CO 14

Uniform causal broadcast (ucb) Events Request: <uco. Broadcast, m> Indication: <uco. Deliver, src, m> Uniform causal broadcast (ucb) Events Request: Indication: • Properties: • URB 1, URB 2, URB 3, URB 4 + • CO 15

Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using Overview Intuitions: why causal broadcast? Specifications of causal broadcast Algorithms: A non-blocking algorithm using the past and A blocking algorithm using vector clocks 16

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

Algorithm 1 Implements: Reliable. Causal. Order. Broadcast (rco). Uses: Reliable. Broadcast (rb). upon event Algorithm 1 Implements: Reliable. Causal. Order. Broadcast (rco). Uses: Reliable. Broadcast (rb). upon event < Init > do delivered : = past : = ; upon event < rco. Broadcast, m> do trigger < rb. Broadcast, [Data, past, m]>; past : = past U {[self, m]}; 18

Algorithm 1 (cont’d) upon event <rb. Deliver, pi, [Data, pastm, m]> do if m Algorithm 1 (cont’d) upon event do if m delivered then (*) forall [sn, n] in pastm do if n delivered then trigger < rco. Deliver, sn, n>; delivered : = delivered U {n}; past : = past U {[sn, n]}; 19

Algorithm 1 (cont’d) (*) … … … trigger <rco. Deliver, pi, m>; delivered : Algorithm 1 (cont’d) (*) … … … trigger ; delivered : = delivered U {m}; past : = past U {[pi, m]}; 20

Algorithm 1 p 1 m 2(m 1) m 2 m 1 p 2 m Algorithm 1 p 1 m 2(m 1) m 2 m 1 p 2 m 1 m 2(m 1) p 3 m 1 m 2 21

Algorithm 1 p 1 m 2(m 1) m 1 p 2 m 1 m Algorithm 1 p 1 m 2(m 1) m 1 p 2 m 1 m 2(m 1) p 3 m 1 m 2 22

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

Algorithm 1’ (gc) Implements: Garbage. Collection (+ Algo 1). Uses: Reliable. Broadcast (rb). Perfect. Algorithm 1’ (gc) Implements: Garbage. Collection (+ Algo 1). Uses: Reliable. Broadcast (rb). Perfect. Failure. Detector(P). upon event < Init > do delivered : = past : = ; correct : = S; ackm : = (for all m); 24

Algorithm 1’ (gc – cont’d) upon event < crash, pi > do correct : Algorithm 1’ (gc – cont’d) upon event < crash, pi > do correct : = correct {pi} • upon for some m delivered: self ackm do • ackm : = ackm U {self}; • trigger < rb. Broadcast, [ACK, m]>; 25

Algorithm 1’ (gc – cont’d) upon event <rb. Deliver, pi, [ACK, m]> do ackm Algorithm 1’ (gc – cont’d) upon event do ackm : = ackm U {pi}; if forall pj correct: pj ackm do past : = past {[sm, m]}; 26

Algorithm 2 Implements: Reliable. Causal. Order. Broadcast (rco). Uses: Reliable. Broadcast (rb). upon event Algorithm 2 Implements: Reliable. Causal. Order. Broadcast (rco). Uses: Reliable. Broadcast (rb). upon event < Init > do for all pi S: VC[pi] : = 0; pending : = 27

Algorithm 2 (cont’d) upon event < rco. Broadcast, m> do trigger < rco. Deliver, Algorithm 2 (cont’d) upon event < rco. Broadcast, m> do trigger < rco. Deliver, self, m>; trigger < rb. Broadcast, [Data, VC, m]>; VC[self] : = VC[self] + 1; 28

Algorithm 2 (cont’d) upon event <rb. Deliver, pj, [Data, VCm, m]> do if pj Algorithm 2 (cont’d) upon event do if pj ≠ self then pending : = pending (pj, [Data, VCm, m]); deliver-pending. 29

Algorithm 2 (cont’d) procedure deliver-pending is While (s, [Data, VCm, m]) pending s. t. Algorithm 2 (cont’d) procedure deliver-pending is While (s, [Data, VCm, m]) pending s. t. for all pk: (VC[pk] VCm[pk]) do pending : = pending (s, [Data, VCm, m]); trigger < rco. Deliver, self, m>; VC[s] : = VC[s] + 1. 30

Algorithm 2 m 1 p 1 m 2 m 1 p 2 m 1 Algorithm 2 m 1 p 1 m 2 m 1 p 2 m 1 m 2 p 3 m 1 [0, 0, 0] m 2 [1, 0, 0] m 1 31

Algorithm 2 m 1 p 1 m 1 p 2 p 3 m 2 Algorithm 2 m 1 p 1 m 1 p 2 p 3 m 2 [1, 0, 0] m 2 m 1 m 2 [1, 0, 0] m 1 [0, 0, 0] m 2 m 1 32