Required for correctness and fairness. Challenging because:
| Clock Skew | Clock Drift |
|---|---|
| Relative difference in clock values of 2 processes | |
| Non-zero clock skew = clocks not synchronized | Relative difference in clock frequencies (rates) of 2 processes |
| Non-zero clock drift = cases skew to increase overtime |
MDR (maximum drift rate) between 2 clocks with similar MDR = 2 * MDRM / (2 * MDR) time units| External Sync | Internal Sync |
|---|---|
| This is what we cover in this class. External clock with highly precise atomic clock is accepted as source of truth. | Not discussed in this class. Ex: Berkeley’s algorithm. |
| Internal sync does not imply external sync. |
Time Server S (highly precise atomic clock) ← all Processes P sync with S
Algorithm accounts for message latencies
min1 = P to S (ex: client → network interface → server)min2 = S to P (ex: server → network interface → server)P receives message at [t + min2, t + RTT - min1]
min1 could be 0, but we must incur latency of at least min2 → add to t to get time on P’s endmin2 can be represented as RTT - min1 → add to t to get time on P’s end
Error bounded at most (RTT - min2 - min1) / 2
If min1 and min2 are unknown → set to 0