Skip to main content

Physical vs logical clock; sync method

Short answer

Physical clocks differ from logical clocks because they track real time and drift. Synchronization is difficult due to clock drift, variable and asymmetric network delays, single points of failure, and the need not to run clocks backward. Cristian's algorithm sets the clock to server time plus half the round-trip delay, assuming symmetric delay.

Differentiate between physical clock and logical clock. Why is it difficult to synchronize physical clock? Describe a method for physical clock synchronization.

Physical vs logical clock

PointPhysical clockLogical clock
What it keepsActual time of dayCounter giving event order
Based onHardware oscillatorHappened-before relation
UnitSecondsDimensionless numbers
Needs syncYes, to UTC or among themselvesNo external sync
DriftYesNone
ExamplesCristian, Berkeley, NTPLamport, vector clock
UseReal-time stamping, billingCausal ordering, consistency

Why synchronising physical clocks is difficult

  1. No global clock: every node has its own crystal; they run at different rates (clock drift, ~1 s in 10⁵–10⁶ s) and differ in skew.
  2. Variable network delay: the time to carry a message is unpredictable (congestion, queueing, routing), so the time received is already out of date.
  3. Asymmetric delays for request and reply make delay estimates inexact.
  4. Failures: time server or links may fail, clocks may be faulty.
  5. Clocks must not run backward (breaks ordering such as file timestamps), so correction must be gradual.
  6. Cost and scale: many nodes and wide area networks make frequent synchronisation expensive.
  7. Even after synchronisation, drift makes clocks diverge again, so it must be repeated.

Method: Cristian's algorithm

A client sends a request to a time server (which has a UTC source) at T0 and receives the server's time T_S at T1. It sets its clock to

T_new = T_S + (T1 − T0) / 2

assuming equal delay in both directions. Accuracy is within ± ((T1 − T0)/2 − Tmin). To improve: repeat several times and use the reading with the minimum round trip time; if T_new is behind the current time, slow the clock down gradually instead of jumping back.

Example: T0 = 5.000 s, T1 = 5.040 s (local), T_S = 9.000 s. T_new = 9.000 + 0.020 = 9.020 s.

Limit: the single server is a point of failure; Berkeley and NTP overcome this.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 5 questions →