CS603 Clock Synchronization

1 / 10

# CS603 Clock Synchronization - PowerPoint PPT Presentation

CS603 Clock Synchronization. February 4, 2002. What is Clock Synchronization?. All nodes agree on time What do we mean by time? Monotonic Any observation increases When sun is overhead, time is “noon” What do we mean by agree?

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'CS603 Clock Synchronization' - nanda

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### CS603Clock Synchronization

February 4, 2002

What is Clock Synchronization?

All nodes agree on time

• What do we mean by time?
• Monotonic
• Any observation increases
• When sun is overhead, time is “noon”
• What do we mean by agree?
• Clocks on different nodes give same reading when time requested simultaneously
• Can’t distinguish readings from above definition
Time in a Distributed System

P

Q

R

q1

p1

r1

q2

p2

q3

p3

q4

r2

p4

q5

r3

q6

Event-based definition(Lamport ’78)

Define partial order of processes

• A  B: A “happened before” B: Smallest relation such that:
• If A and B in same process and A occurs first, A  B
• If A is sending a message and B is receipt of a message, A  B
• If A  B and B  C, then A  C
Anomalous Events

P

Q

R

q1

p1

r1

q2

p2

q3

p3

q4

r2

p4

q5

r3

q6

r4

Event-based definition(Lamport ’78)

Define partial order of processes

• A  B: A “happened before” B: Smallest relation such that:
• If A and B in same process and A occurs first, A  B
• If A is sending a message and B is receipt of a message, A  B
• If A  B and B  C, then A  C
• Clock: C(x) is time x occurs:
• C(x) = Ci(x) where x running on node i.
• Clocks correct if  a,b: ab  C(a) < C(b)
Event-based clocks

P

Q

R

q1

p1

r1

q2

p2

q3

p3

q4

r2

p4

q5

r3

q6

Lamport Clock Implementation
• Node i Increments Ci between any two successive events
• If event a is sending of a message m from i to j,
• m contains timestamp Tm = Ci(a)
• Upon receiving m, set Cj≥ current Cj and > Tm
• Can now define total ordering. a  b iff:
• Ci(a) < Cj(b)
• Ci(a) = Cj(b) and Pi < Pj
What if we want “wall clock” time?
• Ci must run at correct rate:
• κ << 1 such that | dCi(t)/dt – 1 | < κ
• Synchronized:
•  small ε such that  i,j: | Ci(t) – Cj(t) | < ε
• Assume transmission time between μ and μ+ξ
• Algorithm: Upon receiving message m,set Cj(t) = max(Cj(t), Tm+μ)
• Theorem: Assume every τ seconds a message with unpredictable delay ξ is sent over every arc. Then t ≥ t0 + τd, ε≈ d(2κτ + ξ)
Is this it?
• What if we don’t know maximum delay ξ?
• What if a clock goes “bad”
• Runs much too fast/slow