1 / 28

Advanced Networks

Advanced Networks. PhD. Saúl Pomares Hernández. Causal Delivery. Clocks, events and process states. A distributed system is defined as a collection P of N processes p i , i = 1,2,… N Each process p i has a state s i consisting of its variables (which it transforms as it executes)

zasha
Download Presentation

Advanced Networks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Networks PhD. Saúl Pomares Hernández Causal Delivery

  2. Clocks, events and process states • A distributed system is defined as a collection P of N processes pi, i = 1,2,… N • Each process pi has a state si consisting of its variables (which it transforms as it executes) • Processes communicate only by messages (via a network) • Actions of processes: • Send, Receive, change own state • Event: the occurrence of a single action that a process carries out as it executes e.g. Send, Receive, change state • Events at a single process pi, can be placed in a total ordering denoted by the relation i between the events. i.e. eie’ if and only if e occurs before e’ at pi • A history of process pi: is a series of events ordered by i history(pi)= hi =<ei0, ei1, ei2, …>

  3. Logical time and logical clocks Happened-before(Lamport 1978) • Instead of synchronizing clocks, event ordering can be used • If two events occurred at the same process pi (i = 1, 2, … N) then they occurred in the order observed by pi, that is  • when a message, m is sent between two processes, send(m) happened before receive(m) • The happened before relation is transitive Not all events are related by  consider a and e (different processes and no chain of messages to relate them) they are not related by  ; they are said to be concurrent; write as a || e ab(at p1) cd (at p2) bc because of m1 also df because of m2

  4. Lamport’s logical clocks • A logical clock is a monotonically increasing software counter. It need not relate to a physical clock. • Each process pi has a logical clock, Li which can be used to apply logical timestamps to events • LC1: Li is incremented by 1 before each event at process pi • LC2: • (a) when process pi sends message m, it piggybacks t = Li • (b) when pj receives (m,t) it sets Lj := max(Lj, t) and applies LC1 before timestamping the event receive (m) ee’ implies L(e)<L(e’) The converse is not true, that is L(e)<L(e') does not imply ee’

  5. Vector clocks • Vector clock Vi at process pi is an array of N integers • VC1:initially Vi[j] = 0 for i, j = 1, 2, …N • VC2:before pi timestamps an event it sets Vi[i] := Vi[i] +1 • VC3:pi piggybacks t = Vi on every message it sends • VC4:when pi receives (m,t) it sets Vi[j] := max(Vi[j] , t[j]) j = 1, 2, …N ( then before next event adds 1 to own element using VC2) Note that ee’ implies V(e)<V(e’). The converse is also true

  6. A B C Initial vector (0,0,0) (0,0,0) (0,0,0) T i m e m1 (1,0,0) m2 (1,1,0) The message m2 arrives but can not be delivered (1,0,0) Only after the delivery of m1 , The message m2 also can be delivered. Causal Order deliver [BIR91] Causal Ordering: Ifsend(m) send(m’), thenk g deliveryk(m)  deliveryk(m’) Delivery condition if(VT(m’ )[i] = VT(pj)[i] +1 andVT(m’ )[k] VT(pj)[k]  (k  i, k=1…n) then delivery(m)

  7. Causal Order deliver • The general algorithm of vector time for causal delivery is as follows: • Initially, VT(pi)[j] = 0  j=1…n. • For each event send(m) at pi, • VT(pi)[i] = VT(pi)[i] + 1. • Each multicast message by process pi is timestamped with the updated value of VT(pi). • For each event deliveredj(m’), pj modifies its vector time in the following manner: • VT(pj)[k]=VT(m’) For each receptionreceive(m’) à pj , ij, m’=(i,VT(m’),message) • To enforce a causal delivery of m’ • i. Delivery condition • if not(VT(m’)[i] = VT(pj)[i] +1 andVT(m’)[k] VT(pj)[k]  (k  i, k=1…n) • then • wait • else • ii delivery(m)

  8. Problem m1 m2 m3 t m4 m5

  9. m1 m2 g3 m3 p3 p1 g1 g2 p2 Delivery of event m3 must be delayed. Causal Order deliver, Multigroup Case If sendi(m,g) sendj(m’,g’), thenk g g’ deliveryk(m)  deliveryk(m’) p3 p1 g3 g1={p1, p2} g2={p2, p3} g3={p1, p3} g2 (1,0,x) (x,0,1) (1,x,0) (1,0,x) (x,0,0) (0,x,0) (1,0,x) (x,0,0) (1,x,0) g1 m2 m3 m1 p2 Delivery condition - VTa(m)[i] = VTa(pj)[i] +1 - k : (pk gaΛki): VTa(m)[k]≤VT(pj)[k] and - g : (g Gj): VTg(m) ≤VTg(pj) t p2g1 g2

  10. e1 e3 e2 e4 e5 Delivery of event e5 must be delayed. Exercise ch3 p3 p1 p3 ch3 p1 ? ch2 e1 ch1 p2 ch1 ch2 p2 . . . ? ch1={?} ch2={?} ch3={?} e5 p2ch1 ch2

  11. The Basic Principles (cont.) The causal relation, denoted by  : 1.   x, ay, bifx=ya < b 2.   x, ay, bifx, a is the sending of an event and y, bis the delivery of that event . 3.   x, ay, bifz, c | (x, az, cz, cy, b)

  12. Immediate Dependency Relation • The problem with causal ordering : • The amount of control information emitted for large values of n = |G| is prohibitively high. Immediate Dependency Relation : ee’[ (e  e’) e” E, (e  e” e’)]

  13. Immediate Dependency Relation (cont.) Causal Intra-Channel Ordering: Ifsend(e) send(e’), thenk c deliveryk(e)  deliveryk(e’) Proposition 1: Ife,e’  Esend(e)  send(e’), thenk c deliveryk(e)  deliveryk(e’)

  14. e e 2 2 S S 1 1 e e e S S 3 3 2 2 3 S S e e e 3 3 4 4 4 S S 4 4 e 2 Serial Events p p p p p p 1 2 3 4 4 5 5 e e3e4 1 Immediate Dependency t t  e1 e2 e3 e4 IDR Graph Immediate Dependency Relation  : ee’[ (e  e’) e” E, (e  e” e’)]

  15. e S S e 1 1 2 e 3 3 S S 2 1 S S 3 1 S S 4 1 e2 e6 S S 5 1 e S S e 5 1 6 5  e1 S S 7 1 e3 e4 e5 S S 1 8 e 2 Concurrent Events p p p p p 1 2 3 4 5 (e2|| ( e3  e4) )  e6 e 1 Immediate Dependency e t 4 e 6 IDR Graph Immediate Dependency Relation  : ee’[ (e  e’) e” E, (e  e” e’)]

  16. e2 e6  e1 e3 e4 e5 Immediate Dependency Relation : ee’[ (e  e’) e” E, (e  e” e’)]. Concurrent Relation || : e || e’(e  e’  e’ e) Observation : (e’ee”e) e’ || e”

  17. For Multi-Channel Case Immediate Inter-Channel Dependency Relation : (e,c)(e’,c’)  [((e,c)  (e’, c’))(e”, c’’)E, ((e,c) (e”, c’’) (e’, c’) c’’cc’’c’)] Observation: Ifonly one channel exists in the system, then = 

  18. Causal Inter-Channel Ordering: Ifsend(e,c) send(e’,c’), thenk cc’ deliveryk(e)  deliveryk(e’) Proposition 2: Ife,e’  Esend(e,c)  send(e’,c’), thenk cc’ deliveryk(e)  deliveryk(e’)

  19. e1 e2 ((e1,ch1)(e2,ch3))(e3,ch2) e3 Events with IICDR to e3 Delivery of event e3 must be delayed. Inter-channel Dependency p3 p1 ch3 Proposition 2: Ife,e’  Esend(e,c)  send(e’,c’), thenk cc’ deliveryk(e)  deliveryk(e’) ch2 ch1 p2 Immediate Inter-Channel Dependency Relation : (e,c)(e’,c’)  [((e,c)  (e’, c’))(e”, c’’)E, ((e,c) (e”, c’’) (e’, c’) c’’cc’’c’)] t p2ch1 ch2

  20. The Multi-Channel Causal Algorithm

  21. The Multi-Channel Causal Algorithm

  22. The Multi-Channel Causal Algorithm

  23. The Multi-Channel Causal Algorithm

  24. The Multi-Channel Causal Algorithm

  25. Implementation JSDT 1 * Consistent Session * Session 1 1 1 * * Causal Ordering Channel Channel 1 1 * * * * Participant * * The MCP General Structure

  26. Membership Membership service The rest of Participants Participant pk The only no causal message req_join(ch, pk) Wait for serv_join serv_join(ch,pk,np) Memory reservation for a new participant pk • Wait for np-1 messages init_join. • Actualization of its VT init_join(pk, pi,VT(pi)[i]) join(ch, pk) Only after the reception of join, we consider pk like a member of channel ch Join Procedure

  27. Membership Participant pk Membership service The rest of Participants req_leave(ch, pk) Wait for serv_leave serv_leave(ch,pk) leaving notification of pk leave(ch, pk) Only after the reception of leave, on efface toute information concernant pk Leave Procedure

  28. Implementation (cont.) Cooperative Distributed Engineering System Multi-Channel Coordination Protocol Java Shared Data Toolkit Light Reliable Multicast Protocol . . . g channels 1 2 Network The MCP Architecture

More Related