Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.

Similar presentations


Presentation on theme: "1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley."— Presentation transcript:

1 1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001 Presentation based on slides by Coulouris et al; modified by Jens B Jorgensen, University of Aarhus

2 2 Time – basics zWe want to know when something happened. zAlgorithms may depend upon clock synchronization. zNo global notion of time.

3 3 Time – system model zN processes: yEach executes on a single processor. yNo shared memory. yOnly communication means is exchange of messages. zpi has state si. zAn event is the occurrence of a single action, i.e.: y An internal state-transforming action by pi, or y a communication action. ze (->i) e’ iff e occurs before e’ in pi.

4 4 Time – clocks zEach computer has its own physical clock. zThe software clock Ci can be used to timestamp any event at pi. zProblems: Clock skew and clock drift.

5 5 Time – Coordinated Universal Time (UTC) zInternational standard for timekeeping. zBased on atomic time. zSynchronizes with astronomical time using leap seconds. zUTC signals are synchronized and broadcast regularly from land-based radio stations and satellites. zComputers with receivers attached can synchronize their clocks with these timing signals.

6 6 Synchronizing physical clocks – basics zExternal synchronization: For each i, synchronize Ci with an authoritative, external source of time. zInternal synchronization: For each i,j, synchronize Ci and Cj with each other. zOther issues: Correctness, monotonicity, faulty clocks, crash failures, arbitrary failures.

7 7 Synchronizing physical clocks – in a synchronous system zInternal synchronization. zSender sends local time t to receiver. zReceiver ideally sets time to: t + T(trans). zT(trans) in [min,max]. zReceiver sets time to: t + (max+min)/2.

8 8 Synchronizing physical clocks – Cristian’s algorithm m r m t p Time server,S p records total round-trip time T(round); p sets its time to t+T(round)/2; If minimal transmission time is known, accuracy can be calculated. Problem: single point of failure. External synchronization

9 9 Synchronizing physical clocks – the Berkeley algorithm zInternal synchronization. zA coordinator computer chosen to act as master. zMaster periodically polls the other computers (the slaves). zSlaves send back their clock values to master. zMaster calculates an average (taking the roundtrip times into account). zMaster sends the amount by which each individual slave’s clock requires adjustment. zThe algorithm eliminates readings from faulty clocks.

10 10 Synchronizing physical clocks – the Network Time Protocol (NTP) aims zProvide a service enabling clients across the Internet to be synchronized accurately to UTC. zProvide a reliable service that can survive lengthy losses of connectivity. zEnable clients to resynchronize sufficiently frequently to offset the rates of drift found in most computers. zProvide protection against interference with the time service, whether malicious or accidental.

11 11 Synchronizing physical clocks – NTP architecture 1 2 3 2 33 Note: Arrows denote synchronization control, numbers denote strata. - A network of servers located across the Internet. - Primary servers connected directly to time source. - Secondary servers synchronized with primary servers. - Servers connected in logical hierarchy, synchronization subnet. - Three modes of sync.: Multicast, procedure-call, symmetric.

12 12 Synchronizing physical clocks – NTP peers message exchange T i T i-1 T i-2 T i-3 Server B Server A Time mm' Time T(i-3): Time when previous message sent. T(i-2): Time when previous message was received. T(i-1): Time when this message (just received) was sent. T(i): Time when this message was received.

13 13 Logical time and logical clocks – happened-before relation zIf two events occurred at the same process pi, then they occurred in the order in which pi observes them (->i). zWhenever a message is sent between processes, the event of sending the message occurred before the event of receiving the message. zTransitive relation.

14 14 Logical time and logical clocks – happened-before example

15 15 Logical time and logical clocks – Lamport logical clocks and timestamps zA Lamport logical clock is a monotonically increasing software counter. zEach process pi keeps its own logical clock Li which is used to apply Lamport timestamps to events. zTo capture the happened-before relation ->, processes update their logical clocks and transmit the values of their logical clocks in messages as follows: yBefore each event at pi: Li := Li+1 yWhen pi sends a message m, it piggybacks t=Li. yWhen pj receives (m,t): Lj := max(Lj,t)+1. ze -> e’ => L(e) < L(e’).

16 16 Logical time and logical clocks – Lamport timestamps example

17 17 Logical time and logical clocks – Vector timestamps example Vi[i]: The number of events that pi has timestamped; Vi[j]: The number of events that have occurred at pj that pi has potentially been affected by, j <> i.

18 18 Summary zTime zSynchronization of physical clocks: yIn a synchronous system. yCristian’s method. yThe Berkeley algorithm. yThe Network Time Protocol (NTP). zLogical time and logical clocks: yThe happened-before relation. yLamport’s logical clocks and Lamport’s timestamps. yVector timestamps.


Download ppt "1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley."

Similar presentations


Ads by Google