Download presentation

Presentation is loading. Please wait.

Published byIvy Ritchie Modified about 1 year ago

1
Slides for Chapter 11: Time and Global State From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Pearson Education 2005

2
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Logical time and clocks (11.4) zcan't synchronize physical clocks perfectly zabsolute time might not be necessary, just need ordering of events zlogical clocks: Lamport, 1978 zhappened-before relationship among events zpotential causal ordering

3
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Happen-before relation ze -> e' ytwo events occur in the same process ya message is sent between two processes zHappened-before relation: yHB1: if e -> e' in process i, then e -> e' yHB2: for any message m, send(m) -> receive(m) yHB3: if e -> e' and e' -> e'', then e -> e''

4
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Events occurring at three processes

5
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Happen-before vs. causality ze || e' if the two events aren't in a particular order (concurrent) zpotential causality: e -> e’ doesn't mean that e causes e' znaturally, if e causes e’, e -> e’

6
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Logical clocks (Lamport) each process i keeps a local clock L i zupdating logical clocks: LC1: L i := L i + 1 for each event in process i y LC2: xWhen a process i sends a message m it piggybacks on m the value of t = L i x Upon receiving (m,t), process j computes L j := max( L j, t ) and then applies LC1 before timestamping the event receive(m) zif e -> e', then L(e) < L(e') zbut L(e) e'. Why? (Fig. 11.6)

7
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Lamport timestamps (Fig 11.6)

8
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Totally ordered logical clocks zdifferent processes, same Lamport time zTime: (T i, i ) z (T i, i ) < (T j, j ) iff yT i < T j or yT i = T j and i < j

9
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Vector clocks zLamport clocks: L(e) e' zeach process keeps its own vector clock V i zpiggyback timestamps on messages zupdating vector clocks: VC1: Initially, V i [ j ] := 0 for p i, j=1.. N (N processes) yVC2: before p i timestamps an event, V i [ i ] := V i [ i ]+1 yVC3: p i piggybacks t = V i on every message it sends yVC4: when p j receives a timestamp t, it sets V j [ k ] := max(V j [ k ], t[ k ]) for k=1..N (merge operation)

10
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Vector timestamps (Fig 11.7)

11
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Vector clocks At p i yV i [i] is the number of events p i timestamped locally yV i [j] is the number of events that have occurred at p j (that has potentially affected p i ) yCould more events than V i [j] have occurred at p j ?

12
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Comparing vector timestamps zV = V’ iff y V[j] = V’[j], j = 1.. N zV <= V’ iff y V[j] <= V’[j], j = 1.. N zV < V' iff yV <= V' and V != V‘ xDifferent from < in all elements

13
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 © Pearson Education 2005 Vector timestamps if e -> e', then V(e) < V(e') if V(e) e'. (Exercise 11.13) yFigure 11.7 neither V(c) = V(e) xc || e zDisadvantage compared to Lamport timestamps?

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google