Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Lecture 1: Logical, Physical & Casual Time (Part 2) Anish Arora CSE 763."— Presentation transcript:

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

2 Physical Clocks Assume each process i has a physical clock, C i (t), that is a continuous, differentiable function except where the clock is reset Necessary conditions for a system of physical clocks to be correct: 1.Each clock must run at the approximately correct rate 2.The clocks must be synchronized |

3 Physical Clock Synchronization How closely can a system of physical clocks be synchronized? Theorem (basic idea) If physical clocks are maintained using the given algorithm, the maximum difference between any two clocks is d(2 + ) where d=maximum distance between processes (diameter of distributed system) =maximum error in any clock rate =maximum time between message transmissions on each link =max unpredictable message delay

4 Physical Clock Synchronization Assume that message transmission time has two components: a minimum delay and an unpredictable delay Algorithm When sending a message, a process timestamps it with the current value of its physical clock Upon receiving a message, a process sets its physical clock to the maximum of 1.its current value and 2.the timestamp plus the minimum message delay

5 Importance of Clock Synchronization Synchronized clocks are fundamental to the correct functioning of a distributed system ordering events (e.g., FCFS scheduling) consistent updates of replicated data expiration of privileges prearranged synchronization ordering multi-version objects interpreting data that is a function of time

6 The Problem A distributed system having synchronized clocks should have the following properties: At any instant the values of the clocks at any two sites in the distributed should differ by no more than a known quantity At any instant the value of a clock at a site should differ from universal time (i. e., real time) by at most /2 The values assumed by any clock should be monotonically increasing The first property cannot be achieved absolutely, but only with some very high probability

7 Difficulty of Clock Synchronization The following factors conspire to prevent perfectly synchronized clocks: Clocks cannot be engineered to run at precisely the correct rate Sites in a distributed system cannot communicate infinitely often There are always unpredictable delays in message delivery Faulty or malicious sites may provide incorrect or inconsistent time values to other sites

8 Standard Time Dissemination To coordinate time throughout the world, national administrations maintain and disseminate standard time (such as International Atomic Time, TAl, and Coordinated Universal Time, UTC) U.S. National Institute of Standards and Technology WWV, Fort Collins, CO WWVH, Kauai, HI WWBV, Boulder, CO Geosynchronous Orbiting Environmental Satellite (GOES) LORAN-C Global Positioning System (GPS)

9 Distributed Time Services There are two widely-used technologies for time service: OSF DCE's Distributed Time Service based on Digitals DECdts developed during 1986-90 a mature commercial product described in reference 2 NTP - Network Time Protocol specified in 1985 adopted as an Internet Standard Recommended Protocol Transarcs implementation proposed to OSF

10 DCE Distributed Time Service A clock is a device that provides a measure of UTC Real clocks always exhibit some deviation from universal time, or error. The error can never be known exactly, but it can be bounded So, a clock reports a range of values, anyone of which could be the universal time

11 DCE DTS Architecture

12 Obtaining a Time Value from a Server Unsolicited time information is of minimal value A request/response protocol gives more information

13 Obtaining a Time Value from a Server When a clerk requests a time value from a server it doesn't know exactly when the server read its clock

14 Obtaining a Time Value from a Server A interval containing the server's time at the synchronization instant can be computed If lower bounds exist on the times required for intervening activities, the interval can be narrowed

15 Computing a Correct Time Time values are obtained from several servers, in case some of them are faulty If all servers are correct, then the narrowest correct time is simply the intersection of the intervals

16 Computing a Correct Time Assume at most one server is faulty

17 Computing a Correct Time Assume at most two servers are faulty

18 Marzullo's Algorithm 1.Arrange the endpoints of the intervals into a list 2.Mark each endpoint as a minimum or maximum 3.Sort the list. (If two endpoints have the same value, the minimums must precede the maximums) 4.Set the initial estimate of the number of faulty servers, f 5.Scan the list in increasing order to find the first endpoint that is in at least M - f intervals, where M is the number of servers 6.Scan the list in decreasing order to find the first endpoint in at least M - f intervals 7.If no such points are found, then there are more than f faulty servers. Increment f and go to step 5 8.The two points found delimit a correct time interval

19 Adjusting a Clock Depending on the difference between the local clock and the computed time, one of two methods is used to update the local clock Abrupt adjustment immediately sets the local clock to the computed time. This is done only if the difference is greater than 10 minutes Gradual adjustment changes the amount by which the clock is incremented at each tick. It preserves the property that time is a monotonically increasing, continuous function

20 Adjusting a Clock For gradual adjustment, a fast clock must be slowed down so that UTC catches up; a slow clock must be speeded up so it catches up to UTC If the clock is usually incremented by, then during adjustment it is incremented by + ( > 0 clock gains time; < 0 clock loses time) To achieve the necessary adjustment, the tick increment is adjusted for ticks

21 Adjusting a Clock Example normal clock increment, =1 additional adjustment, =0.5 clock reading = 100 correct time =102 number of adjustments =(102-100) / 0.5 = 4

22 Determining the Inaccuracy Whenever a clock is read, its inaccuracy must be calculated This inaccuracy has four components: 1.The base inaccuracy at the synchronization point 2.The drift increase 3.The decrease due to the adjustment in the clock 4.The clock resolution

23 Clerk Synchronization A clerk synchronizes when its local clock exceeds a specified inaccuracy 1.Obtain time values from a specified number of servers 2.Read the local clock to determine the synchronization instant 3.Translate each servers time to the synchronization instant 4.Compute best correct time from servers time values 5.Compare the local time with best correct time. Report faulty clock or initiate clock adjustment 6.Schedule the next synchronization

24 Server Synchronization If the server has a time provider, it periodically synchronizes with its time provider 1.Obtain time value(s) from time provider 2.Read the local clock to determine the synchronization instant 3.Translate the time provider's time(s) to the synchronization instant 4.Compute best correct time from time provider's time(s) and own clock value 5.Compare the local time with best correct time. Report faulty clock or initiate clock adjustment 6.Schedule the next synchronization

25 Server Synchronization If a server has no local time provider, it periodically synchronizes with other servers. 1. Obtain time values from all local servers 2. Read the local clock to determine the synchronization instant 3. Translate the servers times to the synchronization instant 4. Compute best correct time from time servers times and own clock value 5. Compare the local time with best correct time. Report faulty clock or initiate clock adjustment 6. Schedule the next synchronization


Download ppt "Lecture 1: Logical, Physical & Casual Time (Part 2) Anish Arora CSE 763."

Similar presentations


Ads by Google