- Related Questions & Answers
- C++ Program to Implement Kadane’s Algorithm
- C++ Program to Implement Johnson’s Algorithm
- Fleury’s Algorithm
- kasai’s Algorithm
- Manacher’s Algorithm
- Stein’s Algorithm for finding GCD in C++
- Alexander Bogomolny’s UnOrdered Permutation Algorithm in C++
- C++ Program to Implement Coppersmith Freivald’s Algorithm
- C++ Program for Dijkstra’s shortest path algorithm?
- Convex Hull Jarvis’s Algorithm or Wrapping in C++
- Difference Between Prim’s and Kruskal’s Algorithm
- C++ Program to Implement Dijkstra’s Algorithm Using Set
- Dijkstra’s Shortest Path Algorithm
- C++ Program to Construct Transitive Closure Using Warshall’s Algorithm
- Fleury’s Algorithm for printing Eulerian Path or Circuit in C++

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Berkeley’s Algorithm is an algorithm that is used for clock Synchronisation in distributed systems. This algorithm is used in cases when some or all systems of the distributed network have one of these issues −

A. The machine does not have an accurate time source.

B. The network or machine does not have a UTC server.

**Distributed system** contains multiple nodes that are physically separated but are linked together using a network.

In this algorithm, the system chooses a node as master/ leader node. This is done from pool nodes in the server.

The algorithm is −

An election process chooses the master node in the server.

The leader then polls followers that provide their time in a way similar to

**Cristian’s Algorithm**, this is done periodically.The leader then calculates the relative time that other nodes have to change or adjust to synchronize to the global clock time which is the average of times that are provided to the leader node.

Let’s sum-up steps followed to synchronize the clock using the Berkeley algorithm,

Nodes in the distributed system with their clock timings −

N1 -> 14:00 (master node) N2 -> 13: 46 N3 -> 14: 15

**Step 1** − The Leader is elected, node N1 is the master in the system.

**Step 2** − leader requests for time from all nodes.

N1 -> time : 14:00 N2 -> time : 13:46 N3 -> time : 14:20

**Step 3** − The leader averages the times and sends the correction time back to the nodes.

N1 -> Corrected Time 14:02 (+2) N2 -> Corrected Time 14:02 (+16) N3 -> Corrected Time 14:02 (-18)

This shows how the synchronization of nodes of a distributed system is done using Berkeley’s algorithm.

Advertisements