In this tutorial you are going to learn about Clock Synchronization in Distributed System.
Introduction
Clock synchronization is the mechanism to synchronize the time of all the computers in the distributed environments or system.
Assume that there are three systems present in a distributed environment. To maintain the data i.e. to send, receive and manage the data between the systems with the same time in synchronized manner you need a clock that has to be synchronized. This process to synchronize data is known as Clock Synchronization.
Synchronization in distributed system is more complicated than in centralized system because of the use of distributed algorithms.
Properties of Distributed algorithms to maintain Clock synchronization:
- Relevant and correct information will be scattered among multiple machines.
- The processes make the decision only on local information.
- Failure of the single point in the system must be avoided.
- No common clock or the other precise global time exists.
- In the distributed systems, the time is ambiguous.
As the distributed systems has its own clocks. The time among the clocks may also vary. So, it is possible to synchronize all the clocks in distributed environment.
Types of Clock Synchronization
- Physical clock synchronization
- Logical clock synchronization
- Mutual exclusion synchronization
Physical Synchronization:
- In physical clock synchronization, All the computers will have their own 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 other nodes in the system.
- The time will be set based on UTC (Universal Coordinate Timer).
- The time difference between the two computers is known as “Time drift”. Clock drifts over the time is known as “Skew”. Synchronization is necessary here.
Physical clocks: In physical synchronization, physical clocks are used to time stamp an event on that computer.
If two events, E1 and E2, having different time stamps t1 and t2, the order of the event occurring will be considered and not on the exact time or the day at which they are occur.
Several methods are used to attempt the synchronization of the physical clocks in Distributed synchronization:
- UTC (Universal coordinate timer)
- Christian’s algorithm
- Berkely’s algorithm
Universal Coordinate Time (UTC)
- All the computers are generally synchronized to a standard time called Universal Coordinate Time (UTC).
- UTC is the primary time standard by which the time and the clock are regulated in the world. It is available via radio signals, telephone line and satellites (GPS).
- UTC is broadcasted via the satellites.
- Computer servers and online services with the UTC resources can be synchronized by the satellite broadcast.
- Kept within 0.9 seconds of UTI.
UTO - Mean solar time on Greenwich meridian, Obtained from astronomical observation.
UT1 - UTO corrected for polar motion.
UT2 - UT1 corrected for seasonal variations in earth’s rotation.
UTC - Civil time will be measured on an atomic scale.
Christian’s Algorithm:
- The simplest algorithm for setting time, it issues a remote procedure call (RPC) to the time sever and obtains the time.
- The machine which send requests to the time server is “d/z” seconds, where d is the maximum difference between the clock and the UTC.
- The time server sends the reply with current UTC when receives the request from the receiver.
This article on Clock Synchronization 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 thecode11info@gmail.com