Sei sulla pagina 1di 2

Clock synchronization algorithms

1. CRISTIAN ALGORITHM
This algorithm is based on the use of universal coordinate time (UTC), which is received
by a team within the distributed system. This equipment, called the UTC receiver, in turn
receives periodic requests for the time of the rest of the machines in the system, each one
of which sends them a response in the shortest possible time, reporting the requested UTC
time, with which all the machines of the system update your time and keep the whole
system synchronized. The UTC receiver receives the time through various available means,
among which radio waves, Internet, among others. A big problem in this algorithm is that
time can not run backwards:
The UTC receiver time can not be less than the time of the machine that requested the
time.
The UTC server must process the requests for time with the concept of interruptions,
which affects the time of attention.
The transmission interval of the request and its response must be taken into account
for synchronization. The propagation time is added to the time of the server to synchronize
the sender when it receives the response.
➢ Functioning of the algorithm

1. A process p makes a time request to the server in a message mr.


2. The server responds with an mt message in which it includes its TUTC time.
3. The process that receives the message mt updates its clock with the time TUTC, but
it is necessary to consider the error because it has required a time for the
transmission of the message from the server.
The time it takes to receive the response since sending the request message, TREQUEST,
is measured. The estimated propagation time, in the absence of other information, will be
TREQUEST/2, so the client synchronizes his watch to TUTC + TREQUEST / 2. This estimate
can be improved if the minimum message propagation time is known:
• The minimum time that the server wrote the message is min.
• The maximum time that the server wrote the message is TREQUEST - min.
Therefore, the time in which the server message is received is in the range [CUTC + min,
CUTC + TREQUEST -min] whose width is TREQUEST - 2min so the precision is ± TREQUEST /
2 - min.
Client Server

TREQUEST interrupt handling time

2. BERKELEY ALGORITHM
In this algorithm, among all the distributed system teams choose a coordinator to act as
master or time server. Unlike the CRISTIAN algorithm. In which the server was passive. In
this case the chosen coordinator now asks, periodically, the rest of the stations. When the
slaves respond to each one with their local time, the master estimates the propagation
delays of the messages.
➢ Algorithm
1) An individual node is chosen as the master node from a pool nodes in the network.
This node is the main node in the network which acts as a master and rest of the nodes act
as slaves. Master node is chosen using a election process/leader election algorithm.
2) Master node periodically pings slaves nodes and fetches clock time at them using
Cristian’s algorithm.
Diagram below illustrates how the master sends request to slave nodes.

Potrebbero piacerti anche