1 Time (and Global State). 3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock.

Slides:



Advertisements
Similar presentations
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Advertisements

Time and Clock Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
CS6223: Distributed Systems Distributed Time and Clock Synchronization (1) Physical Time.
Computer Science 425 Distributed Systems CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2011 August 30, 2011 Lecture 3 Time and Synchronization Reading: Sections
Time and Global States Ali Fanian Isfahan University of Technology
L-8 Synchronizing Physical Clocks 1 Announcements Proj1 checkpoint – due midnight tonight HW1 checkpoint – due 2/12 2.
CS 582 / CMPE 481 Distributed Systems Synchronization.
Distributed Systems Fall 2010 Time and synchronization.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
Distributed Operating Systems CS551 Colorado State University at Lockheed-Martin Lecture 7 -- Spring 2001.
Time and Global States Chapter 11. Why time? Time is an Important and interesting issue in distributes systems. One we can measure accurately. Can use.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Distribuerede systemer – 5. marts 2001 Presentation based on slides by Coulouris et al.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
Lecture 9: Time & Clocks CDK4: Sections 11.1 – 11.4 CDK5: Sections 14.1 – 14.4 TVS: Sections 6.1 – 6.2 Topics: Synchronization Logical time (Lamport) Vector.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
TIME AND GLOBAL STATES Đàm Vĩnh Tường ( ) Nguyễn Lê Anh Đào ( ) Trần Viễn Phúc ( )
Chapter 10: Time and Global States
Slides for Chapter 9: Time and Global State From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Pearson Education.
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Distributed Systems Principles and Paradigms Chapter 05 Synchronization.
Synchronization Distributed System. Why synchronization? Two sharpshooters in a multiplayer online game kill the same target. Which one gets the points?
Lecture 9: Time and clocks (Chap 11) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
Lecture 5-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) September 10, 2013 Lecture 5 Time and Synchronization.
Lecture 9 – Time Synchronization
Distributed Systems Concepts and Design Chapter 11: Time and Global States Steve Wallis, Raymond Ho, Bruce Hammer.
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
Distributed Systems CS Synchronization – Part I Lecture 8, Sep 23, 2013 Mohammad Hammoud.
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 582 / CMPE 481 Distributed Systems Synchronization.
6 SYNCHRONIZATION. introduction processes synchronize –exclusive access. –agree on the ordering of events much more difficult compared to synchronization.
Distributed Systems Lecture 5 Time and synchronization 1.
CSE 486/586 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Page 1 Clock Synchronization: Physical Clocks Minqi Zhou Distributed Systems Except as otherwise noted, the content of this presentation.
Distributed Web Systems Time and Global State Lecturer Department University.
Topic 7: Time and Global State Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Proof of liveness: an example
Time, Clocks, and Global State Part-2
Distributed Computing
Time and Global States Ali Fanian Isfahan University of Technology
CSE 486/586 Distributed Systems Time and Synchronization
Time Synchronization and Logical Clocks
Logical time (Lamport)
Clock Synchronization: Physical Clocks
Distributed Systems CS
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Distributed Synchronization
Logical time (Lamport)
Logical time (Lamport)
CSE 486/586 Distributed Systems Time and Synchronization
Logical time (Lamport)
Last Class: Naming Name distribution: use hierarchies DNS
Outline Theoretical Foundations
Presentation transcript:

1 Time (and Global State)

3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock synchronization. zNo global notion of time.

4 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’ if e occurs before e’ in pi.

5 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.

6 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.

7 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.

8 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.

9 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

Cristian’s algorithm Compensate for delays yNote times: xrequest sent: T 0 xreply received: T 1 yAssume network delays are symmetric server client time requestreply T0T0 T1T1 T server 10

Cristian’s algorithm Client sets time to: server client time requestreply T0T0 T1T1 T server = estimated overhead in each direction 11

Error bounds If minimum message transit time (T min ) is known: Place bounds on accuracy of result 12

Error bounds server client time requestreply T0T0 T1T1 T server T min Earliest time message arrives Latest time message leaves range = T 1 -T 0 -2T min accuracy of result = 13

Cristian’s algorithm: example zSend request at 5:08: (T 0 ) zReceive response at 5:08: (T 1 ) yResponse contains 5:09: (T server ) zElapsed time is T 1 -T 0 5:08: :08: = 800 msec zBest guess: timestamp was generated 400 msec ago zSet time to T server + elapsed time 5:09: = 5:

Cristian’s algorithm: example If best-case message time=200 msec server client time requestreply T0T0 T1T1 T server Error = T 0 = 5:08: T 1 = 5:08: T s = 5:09: T min = 200msec 15

16 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. zAlgorithm has provisions for ignoring readings from clocks whose skew is too great, Compute a fault-tolerant average

Berkeley Algorithm: example 3:252:509:103:00 1. Request timestamps from all slaves 3:25 2:50 9:10 17

Berkeley Algorithm: example 3:252:509:103:00 2. Compute fault-tolerant average: 3:25 2:50 9:10 18

Berkeley Algorithm: example 3:252:509:103:00 3. Send offset to each client -0:20 +0:15 -6:05 19

20 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.

21 Synchronizing physical clocks – NTP architecture 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 (H.W.).

22 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.

SNTP Roundtrip delay: d = (T 4 -T 1 ) - (T 2 -T 3 ) server client time requestreply T1T1 T2T2 T4T4 T3T3 Time offset: 23

SNTP example server client time requestreply T 1 =1100 T 2 =800 T 4 =1200 T 3 =850 Time offset: Offset = (( ) + ( ))/2 =((-300) + (-350))/2 = -650/2 = -325 Set time to T 4 + t = =

Cristian’s algorithm server client time requestreply T 1 =1100 T 2 =800 T 4 =1200 T 3 =850 Offset = ( )/2 = 50 Set time to T s + offset = = 875 T s =825 25

26 Logical time and logical clocks – happened-before relation (self study) 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.

27 Logical time and logical clocks – happened-before example (self study)

28 Logical time and logical clocks – Lamport logical clocks and timestamps (self study) 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’).

29 Logical time and logical clocks – Lamport timestamps example (self study)

30 Logical time and logical clocks – Vector timestamps example (self study) 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.

31 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 (self study): yThe happened-before relation. yLamport’s logical clocks and Lamport’s timestamps. yVector timestamps.