Physical Clock and Logical Clock in Distributed System

Physical Clock and Logical Clock in Distributed System

In this tutorial you are going to learn about Physical Clock and Logical Clock in Distributed System.


Clocks in computers are used for temporal ordering of the events produced by the concurrent processes. To check the synchronization between sender and receiver of message physical clocks provide the coordination of joint activity. It provides serialization of concurrent access for shared objects.

Physical Clocks

The physical clocks are needed to adjust the time of nodes. All the nodes in the system can share their local time with all the other nodes in the system. Basically, in physical synchronization, physical clocks are used to time stamp an event on that computer.

Physical clocks keeps the time of the day. It will be consistent across systems.

Quartz Clock

  • Quartz oscillator is a part of self feedback loop.
  • It typically oscillates at 32KHz.
  • Higher frequency will be generated by dividing the clock.
  • The clock drift is + or -15 seconds per month (6 ppm).
  • The regular quartz clock is not suitable for large distributed systems.
  • Resonator shaped liked turning fork.
  • Good resonator can have accuracy of 1 second in 10 years. (Frequency changes with age, temperature and acceralation)

Atomic Clock

  • Caesium 133 will be used as an oscillator.
  • Uses a similar feedback based on circuit as the quartz clock.
  • Accuracy: 10^8 ppm.

Uses :

  • Each satellite broadcast its position(x1,x1,z1) and time t1.
  • The time is obtained through an atomic clock.

Finding the Position through GPS
  • Current position (x, y, z)
  • The drift between the receiver clock and the atomic clocks is d.
  • The time at which the receiver receives the message is t
  • Setup equation:

  • p (x − xi) 2 + (y − yi) 2 + (z − zi) 2 = (tr − ti + d) × c [ where c = speed of light ]

Problems that can arise during synchronization:

  • Getting two system agree upon time.
    1. Two clocks hardly ever agree.
    2. Quartz oscillators oscillates at sightly different frequencies.
  • Create ever-widening gap in perceived time. This is called as clock drift.
  • At one point of the time, the difference between the two clocks is called as Clock skew.

Dealing with Drift

Go for gradual clock correction.

If fast - In this case, Make sure that the clocks run slower until it synchronizes.

If slow - In this case, Make sure that the clocks run faster until it synchronizes.

Logical Clocks

If two systems do not interact with each other then there is no need of synchronization. So, what usually matters is that processes agree on the order in which events occur rather than the time at which they occurred. Logical clocks does not need exact time. So, absolute time is not a constrain in logical clocks. Logical clocks just bothers about the message to be delivered and not about the timings of the events occurred.

Using Interrupts, computer generally updates a software clock. More the interrupts, higher the overhead. Accuracy will be more.

The most common logical clock synchronization algorithms for distributed systems is Lamport’s algorithm. It is used in the situation where ordering is important not the time.

This article on Physical Clock and Logical Clock in Distributed System is contributed by Hemalatha P. If you like TheCode11 and would like to contribute, you can also write your article and mail to

Previous Post Next Post

Contact Form