Ritesh 11

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 14

Physical clock example: counter + holding register + oscillating quartz crystal

The counter is decremented at each oscillation Counter interrupts(clock tick) when it reaches zero

Software clock: counts interrupts


This value represents number of seconds since some predetermined time (Jan 1, 1970 for UNIX systems; beginning of the Gregorian calendar for Microsoft) Can be converted to normal clock times

Clock skew(offset): the difference between the times on two different clocks Clock drift : the difference between a clock and actual time

Various Ways of Measuring Time*


The sun Mean solar second gradually getting longer as earths rotation slows. International Atomic Time (TAI) Atomic clocks are based on transitions of the cesium atom Universal Coordinated Time (UTC) Getting the Correct (UTC) Time WWV radio station or similar stations in other countries UTC services provided by earth satellites GPS (Global Positioning System)

Clock Synchronization Algorithms


Network Time Protocol (Cristian Algorithm):
Objective: to keep all clocks in a system synchronized to UTC time not so good in WAN Uses a hierarchy of passive time servers

The Berkeley Algorithm:


Objective: to keep all clocks in a system synchronized to each other (internal synchronization) Uses active time servers that poll machines periodically

Reference broadcast synchronization (RBS)


Objective: to keep all clocks in a wireless system synchronized to each other

GPS
The Global Positioning System (GPS) is a satellite-based navigation system made up of a network of 24 satellites placed into orbit by the U.S. Department of Defense that provides location and time information GPS satellites circle the earth twice a day in a very precise orbit and transmit signal information to earth. GPS receivers take this information and use triangulation to calculate the user's exact location. Essentially, the GPS receiver compares the time a signal was transmitted by a satellite with the time it was received. The time difference tells the GPS receiver how far away the satellite is. Now, with distance measurements from a few more satellites, the receiver can determine the user's position and display it on the unit's electronic map.

Clock Synchronization Algorithms

The relation between clock time and UTC when clocks tick at different rates.

Cristian's Algorithm
synchronization with a time server
Periodically (T < d/2r s) synchronization request to time server
Time must never run backward gradual changes Non zero message propagation time (estimate value = (T1-T0-I) /2 )

The Berkeley Algorithm


synchronization without time server

a) b) c)

The time daemon asks all the other machines for their clock value discrepancies The machines answer The time daemon tells everyone how to adjust their clock to the average no Universal Coordinated Time available

Logical Clocks
In this section we will discuss Lamport's algorithm , which synchronizes logical clocks. Also, we discuss an extension to Lamport's approach, called vector timestamps.

Correctness Conditions
Happened Before Relation (a b)

What we need is a way of measuring time then for every event, a we can assign it a time value C(a) 1. If a and b are events in the same process, and a occurs before b, then a b is true , C(a) < C(b) 2 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 is true ,C(a) < C(b)

Lamports Logical Clocks (2)


Event a: P1 sends m1 to P2 at t = 6, Event b: P2 receives m1 at t = 16. If C(a) is the time m1 was sent, and C(b) is the time m1 is received, do C(a) and C(b) satisfy the correctness

Lamports Logical Clocks (3)


Event c: P3 sends m3 to P2 at t = 60 Event d: P2 receives m3 at t = 56 Do C(c) and C(d) satisfy the Figure 6-9. (b) Lamports algorithm corrects the clocks. condition s?

Vector Clocks
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 is true ,C(a) < C(b) However, with Lamport clocks, nothing can be said about the relationship be-tween two events a and b by merely comparing their time values C(a) and C(b),respectively. In other words, if C(a) < C(b), then this does not necessarily imply that a indeed happened before b. Something more is needed for that.

The problem is that Lamport clocks do not capture causality. Causality can be captured by means of vector clocks.

You might also like