Lecture 005 - Clock

Clock Synchronization

The actual ordering matter, not the timestamp

UTC Diverge compared to UT1

UTC Diverge compared to UT1

Time Standards:

Distribution of Clock Drift in Practice: Geng, Yilong, et al. "Exploiting a natural network effect for scalable, fine-grained clock synchronization." NSDI, 2018.

Distribution of Clock Drift in Practice: Geng, Yilong, et al. "Exploiting a natural network effect for scalable, fine-grained clock synchronization." NSDI, 2018.

Cause of Imperfection

Synchronization Technique

Naive Synchronization:

Cristian's Time Sync

Cristian's Time Sync

Cristian's Time Sync:

  1. client request time from server at time T_0
  2. server received request, it reply back with time t
  3. client receive result from server at time T_1
  4. client set its clock to t + \frac{T_1 - T_0}{2} where the round trip time is RRT = T_1 - T_0

The accuracy is \pm (RTT/2-\min) (where \min is an estimated minimum one way delay) because we can guarantee when the machine receive time from time server, the ground truth time is within range [t+\min, t+RTT-\min]. Suppose the minimum one way delay \min happens when message send from client to server, then the real-time when client received request is t + (RRT - \min) = t + (T_1 - T_0 - \min), but client's clock is set to t + \frac{T_1 - T_0}{2}. In this case, we overestimated the real-time by \frac{T_1 - T_0}{2} - \min. If the minimum one-way delay \min happens when the server replies back to the client, the real-time when the client received the request is t + \min. We underestimated the real-time by \frac{T_1 - T_0}{2} - \min.

Cristian's Time Sync only works if RTT (Round trip time) is short, since we need to have a low \min to bound the time. Centralized server might fail.

Berkeley Algorithm:

Network Time Protocol (NTP): (using Cristian's one-way messages)

Logical Clocks

We don't care about actual time, we just need to know the event order. (Well, in fact, we don't have time, we have space-time)

Lamport Clocks

Lamport Clock: in this example, (a, b, c, d, f) is transitive, but (e) is concurrent with (a, b, c, d)

Lamport Clock: in this example, (a, b, c, d, f) is transitive, but (e) is concurrent with (a, b, c, d)

Lamport Clock: using event order to sync clocks

Event e happens before e' implies timestamp at event e is smaller than timestamp at event e' (e \to e') \implies L(e) < L(e') The converse is not true. L(e) < L(e') \;\not\!\!\!\implies (e \to e') Therefore, Lamport Clocks does not capture causality

Total order Lamport Clock: Original Lamport Clock Value * number of processes + current process id

Total order Lamport Clock: Original Lamport Clock Value * number of processes + current process id

We can break ties using process ID to give us a total order: L(e) = M * L_i(e) + i

Vector Clocks

Vector clock provides a total order, as contrast to Lamport Clock's partial order.

Vector Clock

Vector Clock

Vector Clocks:

Recent Studies

Time Synchronization is still active research field.

HUYGENS 1: use support vector machine to detect time bounds

HUYGENS 1: use support vector machine to detect time bounds

Hardware Support: [DTP, SIGCOMM 2016]

Mostly Software: [HUYGENS, NSDI 2018]

Summary

Clock Synchronization

Logical Clocks:

Table of Content