Download presentation

Presentation is loading. Please wait.

Published byCiera Mattison Modified about 1 year ago

1
Clock Synchronization

2
Problem 5:33 5:57 5:20 4:53 6:01

3
Why is this hard? Hard to set the clocks simultaneously Hardware clocks have a small drift rate Network messages have random delay This delay is unbounded Various types of faults are possible: –Process failure –Communication failure

4
Making it Tractable Clocks have higher resolution than needed e.g. clocks measure microseconds, but we only care about milliseconds Drift rate ρ of clock H is known ρ is very small Small bounded error in measurement allowable: (1 - ρ)(t - t’) ≤ H(t) - H(t’) ≤ (1 + ρ)(t - t’) A message is on-time if sent and delivered within maxp time units Minimum transmission time min is known

5
Reading a Remote Clock 5:305:33 Real time P Q 5:31 P sends “Time = ?” to Q

6
Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:41 5:37 Q sends “Time = 5:41” to P P sends “Time = ?” to Q Q receives “Time = ?” from P

7
Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:40 5:37 P sends “Time = ?” to Q 5:425:46 5:44 P receives “Time = 5:41” from Q Q sends “Time = 5:41” to P Q receives “Time = ?” from P

8
Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:40 5:37 P sends “Time = ?” to Q 5:425:46 5:44 P receives “Time = 5:41” from Q Q sends “Time = 5:41” to P Q receives “Time = ?” from P P measures the roundtrip delay to be 12 = 2D

9
What does P know about Q? P sends “Time = ?” to Q at P(t) P receives “Time = T” from Q at P(t’) Roundtrip delay = P(t’) – P(t) = 2D Drift rate ρ for P and Q Minimum message travel time min At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)]

10
What does P know about Q? P sends “Time = ?” to Q at P(t) = 5:30 P receives “Time = 5:41” from Q at P(t’) = 5:42 Roundtrip delay = 12 minutes = 2D Drift rate ρ = 0.25 for P and Q Minimum message travel time min = 4 minutes At P(t’) = 5:42, Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] = ?

11
What does P know about Q? P sends “Time = ?” to Q at P(t) = 5:30 P receives “Time = 5:41” from Q at P(t’) = 5:42 Roundtrip delay = 12 minutes = 2D Drift rate ρ = 0.25 for P and Q Minimum message travel time min = 4 minutes At P(t’) = 5:42, Q(t’) in interval [5:41 + 4(1–.25), 5: (1 +.5) - 4(1 +.25)] = [5:44, 5:54]

12
P’s Best Guess For Q(t’) At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] In example: [5:44, 5:54] To P, Q(t’) could be anywhere in the interval What should P guess that Q(t’) is equal to?

13
P’s Best Guess For Q(t’) At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] In example: [5:44, 5:54] To P, Q(t’) could be anywhere in the interval What should P guess that Q(t’) is equal to? The midpoint! Q(t’) = T + D(1 + 2ρ) - minρ Q(t’) = 5:41 + 6(1 +.5) – 4(.25) = 5:49

14
How Precise is the Measurement? Max error e = D(1 + 2ρ) - min P wants to know Q(t’) within error ε Only guaranteed if D ≤ U where U = (1 - 2ρ)(ε + min) Then P reaches rapport with Q Pick ε such that U > min(1+ ρ) If D > U then need to try again

15
Time Service 5:33 5:57 5:20 4:53 6:01 Q P2 P3P1 Master Slave P4 Slave

16
Time Service 5:33 5:57 5:20 4:53 6:01 Q P2 P3P1 Master Slave P4 Slave All slaves try to maintain rapport with Q

17
How Should P Change it’s Clock? At P(t’) = 5:42, P estimates Q(t’) = 5:49 What should P do?

18
How Should P Change it’s Clock? At P(t’) = 5:42, P estimates Q(t’) = 5:49 What should P do? Gradually adjust clock to eventually match Q Let P(t) = H(t) + A(t) H(t) is the value of the hardware clock A(t) = mH(t) + N is an adjustment to P’s clock Set m and N so P(t’ + x) = Q(t’ + x) x is the amortization parameter m = (Q(t’) - P(t’)) / x N = P(t’) - (1 + m)×H(t’)

19
Master-Slave Synchronization Slave tries up to k syncs with master Remember: rapport means D ≤ U Sync retry every W time units until rapport W > 2U At rapport, gradually adjust according to P(t) = H(t) + A(t) Slave knows it is out of sync after k tries

20
Importance Reliable Clock Synchronization required for: –Synchronous Atomic Broadcast –Processor Group Membership Agreement Any distributed system needs accurate Clock Synchronization

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google