1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)

Slides:



Advertisements
Similar presentations
Lecture 1: Logical, Physical & Casual Time (Part 2) Anish Arora CSE 763.
Advertisements

1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Synchronization.
Time in Distributed Systems
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.
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.
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.
Time in Distributed Systems Distributed Systems. Why Time is Important? If you work in the industry, you never have to worry about this You’ll rarely.
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.
Synchronization in Distributed Systems CS-4513 D-term Synchronization in Distributed Systems CS-4513 Distributed Computing Systems (Slides include.
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.
1 CLOCK SYNCHRONIZATION " Synchronization in distributed systems is more complicated than in centralized ones because the former have to use distributed.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
CS542: Topics in Distributed Systems Diganta Goswami.
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.
Physical Clocks.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
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 Coordination March 13, Time and Coordination What is time? :-)  Issue: How do you coordinate distributed computers if there is no global.
Parallel and Distributed Simulation Synchronizing Wallclock Time.
Computer Science Lecture 9, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS Iterative versus Recursive name resolution.
TIME AND GLOBAL STATES Đàm Vĩnh Tường ( ) Nguyễn Lê Anh Đào ( ) Trần Viễn Phúc ( )
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.
Distributed Systems Principles and Paradigms Chapter 05 Synchronization.
1 Clock Synchronization & Mutual Exclusion in Distributed Operating Systems Brett O’Neill CSE 8343 – Group A6.
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.
Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down,
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
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.
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
Time and Global States Ali Fanian Isfahan University of Technology
Lecture 5 Time and synchronization
Net 435: Wireless sensor network (WSN)
Logical time (Lamport)
Clock Synchronization: Physical Clocks
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)
Logical time (Lamport)
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC) u Cristain’s algorithm u Berkeley algorithm u network time protocol (NTP)

2 Why Do We Care About “Time” in a Distributed System? may need to know the time of day some event happened on a specific computer u need to synchronize that computer’s clock with some external authoritative source of time (external clock synchronization) F How hard is this to do? May need to know the time interval, or relative order, between two events that happened on different computers u If their clocks are synchronized to each other to some known degree of accuracy (called internal clock synchronization), we can measure time relative to a local clock F Is this always consistent? Will ignore relativistic effects u Cannot ignore network’s unpredictability

3 Physical Clocks Every computer contains a physical clock A clock (also called a timer) is an electronic device that counts oscillations in a crystal at a particular frequency Count is typically divided and stored in a counter register Clock can be programmed to generate interrupts at regular intervals (e.g., at time interval required by a CPU scheduler) Counter can be scaled to get time of day This value can be used to timestamp an event on that computer Two events will have different timestamps only if clock resolution is sufficiently small Many applications are interested only in the order of the events, not the exact time of day at which they occurred, so this scaling is often not necessary

4 Physical Clocks in a Distributed System Does this work? u Synchronize all the clocks to some known high degree of accuracy, and then u measure time relative to each local clock to determine order between two events Well, there are some problems… u It’s difficult to synchronize the clocks u Crystal-based clocks tend to drift over time — count time at different rates, and diverge from each other F physical variations in the crystals, temperature variations, etc. F drift is small, but adds up over time F for quartz crystal clocks, typical drift rate is about one second every 106 seconds =11.6 days F best atomic clocks have drift rate of one second in 1013 seconds = 300,000 years

5 Coordinated Universal Time the output of the atomic clocks is called International Atomic Time u Coordinated Universal Time (UTC) is an international standard based on atomic time, with an occasional leap second added or deleted UTC signals are synchronized and broadcast regularly by various radio stations (e.g., WWV in the US) and satellites (e.g., GEOS, GPS) u Have propagation delay due to speed of light, distance from broadcast source, atmospheric conditions, etc. u Received value is only accurate to 0.1–10 milliseconds most workstations and PCs don’t have UTC receivers

6 Synchronizing Physical Clocks use a time server with a UTC receiver centralized algorithm u client sets time to Tserver + Dtrans F Tserver = server’s time F Dtrans = transmission delay u unpredictable due to network propagation jitter

7 Cristian’s Algorithm send request to time server, measure time Dtrans taken to receive reply Tserver set local time to Tserver + (Dtrans / 2) u Improvement: make several requests, take average Tserver value to offset variations in time delay – client may average over several requests problems u network delay may not be consistent u request & reply may take different amount amount of time

8 Berkeley Algorithm choose a coordinator computer to act as the master master periodically polls the slaves — the other computers whose clocks should be synchronized to the master u slaves send their clock value to master master observes transmission delays, and estimates their local clock times u master averages everyone’s clock times (including its own) F master takes a fault-tolerant average — it ignores outliers u master sends to each slave the amount (positive or negative) by which it should adjust its clock

9 Network Time Service Protocol (NTP) provides time service on the Internet Hierarchical network of servers: u primary servers (100s) — connected directly to a time source u secondary servers (1000s) — connected to primary servers in hierarchical fashion F ns.cs.kent.edu runs a time server u servers at higher levels are presumed to be more accurate than at lower levels several synchronization modes: u multicast — for LANs, low accuracy u procedure call — similar to Cristian’s algorithm, higher accuracy (file servers) u symmetric mode — exchange detailed messages, maintain history all built on top of UDP (connectionless)

10 Compensating for Clock Drift in NTP Compare time Ts provided by time server to time Tc at computer C If Ts > Tc (e.g., 9:07am vs 9:05am) u Could advance C’s time to Ts u May miss some clock ticks; probably OK (maybe not) If Ts < Tc (e.g., 9:07am vs 9:10am) u Can’t roll back C’s time to Ts F Many applications (e.g., make) assume that time always advances! u Can cause C’s clock to run slowly until it resynchronizes with the time server F Can’t change the clock oscillator rate, so have to change the software interpreting the clock’s counter register F Tsoftware = a Thardware + b F Can determine constants a and b

11 Is It Enough to Synchronize Physical Clocks? in a distributed system, there is no common clock, so we have to: u use atomic clocks to minimize clock drift u synchronize with time servers that have UTC receivers, trying to compensate for unpredictable network delay is this sufficient? u value received from UTC receiver is only accurate to within 0.1–10 milliseconds F at best, we can synchronize clocks to within 10–30 milliseconds of each other F we have to synchronize frequently, to avoid local clock drift u in 10 ms, a 100 MIPS machine can execute 1 million instructions F accurate enough as time-of-day F not sufficiently accurate to determine the relative order of events on different computers in a distributed system