L-8 Synchronizing Physical Clocks 1 Announcements Proj1 checkpoint – due midnight tonight HW1 checkpoint – due 2/12 2.

Slides:



Advertisements
Similar presentations
Time in Distributed Systems
Advertisements

Distributed Computing
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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
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
Distributed Systems Spring 2009
CS 582 / CMPE 481 Distributed Systems Synchronization.
Distributed Systems Fall 2010 Time and synchronization.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
Synchronization Clock Synchronization Logical Clocks Global State Election Algorithms Mutual Exclusion.
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.
Centralized Architectures
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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
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.
1 Synchronization Part 1 REK’s adaptation of Claypool’s adaptation of Tanenbaum’s Distributed Systems Chapter 5.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
Lecture 9 – Time Synchronization Distributed Systems.
PHYSICAL AND LOGICAL TIME EE324 Lecture 11 Last Time– RPC  Why remote procedure calls?  Simple way to pass control and data  Elegant transparent way.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Synchronization. Why we need synchronization? It is important that multiple processes do not access shared resources simultaneously. Synchronization in.
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
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 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.
Synchronization CSCI 4900/6900. Importance of Clocks & Synchronization Avoiding simultaneous access of resources –Cooperate to grant exclusive access.
Lecture 9 – Time Synchronization
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 582 / CMPE 481 Distributed Systems Synchronization.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
6 SYNCHRONIZATION. introduction processes synchronize –exclusive access. –agree on the ordering of events much more difficult compared to synchronization.
Synchronization Chapter 5. Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
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.
Prof. Leonardo Mostarda University of Camerino
Distributed Computing
Distributed Systems Time Synchronization.
Time and Global States Ali Fanian Isfahan University of Technology
Lecture 5 Time and synchronization
CSE 486/586 Distributed Systems Time and Synchronization
Time Synchronization and Logical Clocks
Logical time (Lamport)
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
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:

L-8 Synchronizing Physical Clocks 1

Announcements Proj1 checkpoint – due midnight tonight HW1 checkpoint – due 2/12 2

Last Lecture – RPC Important Lessons Procedure calls  Simple way to pass control and data  Elegant transparent way to distribute application  Not only way… Hard to provide true transparency  Failures  Performance  Memory access  Etc. How to deal with hard problem  give up and let programmer deal with it  “Worse is better” ( better.html)  implementation simplicity more important than interface simplicityhttp:// better.html 3

Today's Lecture Need for time synchronization Time synchronization techniques Lamport 4

Clocks in a Distributed System Computer clocks are not generally in perfect agreement  Skew: the difference between the times on two clocks (at any instant) Computer clocks are subject to clock drift (they count time at different rates)  Clock drift rate: the difference per unit of time from some ideal reference clock  Ordinary quartz clocks drift by about 1 sec in days. (10-6 secs/sec).  High precision quartz clocks drift rate is about 10-7 or 10-8 secs/sec 5

Clock Synchronization Algorithms The relation between clock time and UTC when clocks tick at different rates. 6

Impact of Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time. 7

8 Need for Precision Time Distributed database transaction journalling and logging Stock market buy and sell orders Secure document timestamps (with cryptographic certification) Aviation traffic control and position reporting Radio and TV programming launch and monitoring Intruder detection, location and reporting Multimedia synchronization for real-time teleconferencing Interactive simulation event synchronization and ordering Network monitoring, measurement and control Early detection of failing network infrastructure devices and air conditioning equipment Differentiated services traffic engineering Distributed network gaming and training

Coordinated Universal Time (UTC) International Atomic Time is based on very accurate physical clocks (drift rate ) UTC is an international standard for time keeping It is based on atomic time, but occasionally adjusted to astronomical time It is broadcast from radio stations on land and satellite (e.g. GPS) Computers with receivers can synchronize their clocks with these timing signals Signals from land-based stations are accurate to about millisecond Signals from GPS are accurate to about 1 microsecond  Why can't we put GPS receivers on all our computers? 9

NTP Reference Clock Sources (1997 survey) In a survey of 36,479 peers, found 1,733 primary and backup external reference sources 231 radio/satellite/modem primary sources  47 GPS satellite (worldwide), GOES satellite (western hemisphere)  57 WWVB radio (US)  17 WWV radio (US)  63 DCF77 radio (Europe)  6 MSF radio (UK)  5 CHU radio (Canada)  7 modem time service (NIST and USNO (US), PTB (Germany), NPL (UK))  25 other (precision PPS sources, etc.) 1,502 local clock backup sources (used only if all other sources fail) For some reason or other, 88 of the 1,733 sources appeared down at the time of the survey 10

11 Udel Master Time Facility (MTF) (from January 2000) Spectracom 8170 WWVB Receiver Spectracom 8183 GPS Receiver Hewlett Packard 105A Quartz Frequency Standard Hewlett Packard 5061A Cesium Beam Frequency Standard

Global Positioning System (1) Computing a position in a two-dimensional space. 12

Global Positioning System (2) Real world facts that complicate GPS It takes a while before data on a satellite’s position reaches the receiver. The receiver’s clock is generally not in synch with that of a satellite. 13

Today's Lecture Need for time synchronization Time synchronization techniques Lamport 14

Cristian’s Time Sync m r m t p Time server,S A time server S receives signals from a UTC source  Process p requests time in m r and receives t in m t from S  p sets its clock to t + T round /2  Accuracy ± (T round /2 - min) :  because the earliest time S puts t in message m t is min after p sent m r.  the latest time was min before m t arrived at p  the time by S’s clock when m t arrives is in the range [t+min, t + T round - min] T round is the round trip time recorded by p min is an estimated minimum round trip time 15

Network Time Protocol (NTP) A time service for the Internet - synchronizes clients to UTC Figure 10.3 Reliability from redundant paths, scalable, authenticates time sources Primary servers are connected to UTC sources Secondary servers are synchronized to primary servers Synchronization subnet - lowest level servers in users’ computers 16

17 Server population by stratum (1997 survey)

18 Client population by stratum (1997 survey)

NTP - synchronisation of servers The synchronization subnet can reconfigure if failures occur, e.g.  a primary that loses its UTC source can become a secondary  a secondary that loses its primary can use another primary Modes of synchronization: Multicast  A server within a high speed LAN multicasts time to others which set clocks assuming some delay (not very accurate) Procedure call  A server accepts requests from other computers (like Cristiain’s algorithm). Higher accuracy. Useful if no hardware multicast. Symmetric  Pairs of servers exchange messages containing time information  Used where very high accuracies are needed (e.g. for higher levels) 19

NTP Protocol All modes use UDP Each message bears timestamps of recent events:  Local times of Send and Receive of previous message  Local times of Send of current message Recipient notes the time of receipt T i (we have T i-3, T i-2, T i-1, T i ) In symmetric mode there can be a non-negligible delay between messages 20 T i T i-1 T i-2 T i-3 Server B Server A Time mm' Time

Accuracy of NTP For each pair of messages between two servers, NTP estimates an offset o, between the two clocks and a delay d i (total time for the two messages, which take t and t’) T i-2 = T i-3 + t + o and T i = T i-1 + t’ - o This gives us (by adding the equations) : d i = t + t’ = T i-2 - T i-3 + T i - T i-1 Also (by subtracting the equations) o = o i + (t’ - t )/2 where o i = (T i-2 - T i-3 + T i-1 - T i )/2 Using the fact that t, t’>0 it can be shown that o i - d i /2 ≤ o ≤ o i + d i /2.  Thus o i is an estimate of the offset and d i is a measure of the accuracy NTP servers filter pairs, estimating reliability from variation, allowing them to select peers Accuracy of 10s of millisecs over Internet paths (1 on LANs) 21

How To Change Time Can’t just change time  Why not? Change the update rate for the clock  Changes time in a more gradual fashion  Prevents inconsistent local timestamps 22

Berkeley algorithm Cristian’s algorithm -  a single time server might fail, so they suggest the use of a group of synchronized servers  it does not deal with faulty servers Berkeley algorithm (also 1989)  An algorithm for internal synchronization of a group of computers  A master polls to collect clock values from the others (slaves)  The master uses round trip times to estimate the slaves’ clock values  It takes an average (eliminating any above some average round trip time or with faulty clocks)  It sends the required adjustment to the slaves (better than sending the time which depends on the round trip time)  Measurements  15 computers, clock synchronization millisecs drift rate < 2x10 -5  If master fails, can elect a new master to take over (not in bounded time) 23

The Berkeley Algorithm (1) The time daemon asks all the other machines for their clock values. 24

The Berkeley Algorithm (2) The machines answer. 25

The Berkeley Algorithm (3) The time daemon tells everyone how to adjust their clock. 26

Clock Synchronization in Wireless Networks (1) The usual critical path in determining network delays. 27

Clock Synchronization in Wireless Networks (2) The critical path in the case of RBS. 28

Today's Lecture Need for time synchronization Time synchronization techniques Lamport 29

Lamport’s Logical Clocks (1) The "happens-before" relation → can be observed directly in two situations: If a and b are events in the same process, and a occurs before b, then a → b is true. If a is the event of a message being sent by one process, and b is the event of the message being received by another process, then a → b 30

Lamport’s Logical Clocks (2) Three processes, each with its own clock. The clocks run at different rates. 31

Lamport’s Logical Clocks (3) Lamport’s algorithm corrects the clocks. 32

Lamport’s Logical Clocks (4) The positioning of Lamport’s logical clocks in distributed systems. 33

Lamport’s Logical Clocks (5) Updating counter C i for process P i 1. Before executing an event P i executes C i ← C i When process P i sends a message m to P j, it sets m’s timestamp ts (m) equal to C i after having executed the previous step. 3. Upon the receipt of a message m, process P j adjusts its own local counter as C j ← max{C j, ts (m)}, after which it then executes the first step and delivers the message to the application. 34

Important Lessons Clocks on different systems will always behave differently  Skew and drift between clocks Time disagreement between machines can result in undesirable behavior Two paths to solution: synchronize clocks or ensure consistent clocks Clock synchronization  Rely on a time-stamped network messages  Estimate delay for message transmission  Can synchronize to UTC or to local source 35

Physical Clocks (1) Figure 6-2. Computation of the mean solar day. 36

Physical Clocks (2) Figure 6-3. TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with the sun. 37