ALL > Computer and Education > courses > university courses > graduate courses > modern operating system > zstu 2018-2019-2 class > student homework directory > L20182E060103 >
Homework-2 - Clock synchronization algorithms Version 0
👤 Author: by mahrubachyoutlookcom 2019-03-25 12:45:12
Clock Synchronization:

In Computer Science and Engineering, distributed system includes a set of processors which communicate through message transmission without having access to a central clock. But, the processors needs to know come common notion of time which can be either an exact time or simply an integer-valued counter. This technique that is used to coordinate the notion of time is known as clock synchronization.

Clock Synchronization Algorithms-

  1. Berkeley’s Algorithm

  2. Cristian’s Algorithm


Berkeley’s Algorithm:

Berkeley’s Algorithm is a clock synchronization technique used in distributed systems. The algorithm assumes that each machine node in the network either doesn’t have an accurate time source or doesn’t possess an UTC server.

Algorithm

1) An individual node is chosen as the master node from a pool node 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 an 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 slave nodes send back time given by their system clock.



3) Master node calculates average time difference between all the clock times received and the clock time given by master’s system clock itself. This average time difference is added to the current time at master’s system clock and broadcasted over the network.



Cristian’s Algorithm:

Cristian’s Algorithm is a clock synchronization algorithm is used to synchronize time with a time server by client processes. This algorithm works well with low-latency networks where Round Trip Time is short as compared to accuracy while redundancy prone distributed systems/applications do not go hand in hand with this algorithm. Here Round-Trip Time refers to the time duration between start of a Request and end of corresponding Response.

Below is an illustration imitating working of cristian’s algorithm:



Algorithm:

1) The process on the client machine sends the request for fetching clock time(time at server) to the Clock Server at time T_0.

2) The Clock Server listens to the request made by the client process and returns the response in form of clock server time.

3) The client process fetches the response from the Clock Server at time T1 and calculates the synchronised client clock time using the formula given below.

TCLIENT =TSERVER + (T1-T0)/2

where TCLIENT refers to the synchronised clock time

TSERVER refers to the clock time returned by the server,

T0 refers to the time at which request was sent by the client process,

T1 refers to the time at which response was received by the client process

Please login to reply. Login

Reversion History

Loading...
No reversions found.