I tried to give some insights and provide the simulated code for the Election Algorithm (Bully and Ring), RPC and RMI, Clock Synchronization using Lamport logical timestamp and Vector timestamp, and Banker's Deadlock Avoidance Algorithm.
------------------------------------- Clock Synchronization In Distributed System ----------------------------------------------
🔶 Using Lamport’s Algorithm
Program Output:
🔶 Using Vector Timestamp
Program Output:
More here
---------------------------------------- Leader Election in Distributed System --------------------------------------------------
The main purpose of the leader election is to choose a node as a coordinator. It will act as a leader and coordinate activities of the whole system.The election algorithm assumes that every active process in the system has a unique priority number. A leader in any leader election algorithm is usually chosen based on the node which has the largest identifier. Hence, when a coordinator fails, this algorithm elects the active process that has the highest priority number. Then this number is sent to every active process in the distributed system.
🔶 Bully Algorithm
In a distributed system, when the leader is crashed, other nodes must elect another leader. The election algorithm we consider here is called the bully algorithm because the node with the highest ID forces the nodes with smaller ID into accepting it as a coordinator.
Simulated Program Output
Analysis:
Initially, among the five processes, process with ID:5 is the one with the highest ID, so it is selected as
a leader. After that, the process with ID:5 crashes and since process with ID:4 is dead, process with
ID:3 is selected as leader. After some time, the process with ID:4 activates and calls for election. Since,
process with ID:5 is dead, the process with ID:4 is selected as leader.
🔶 Ring Algorithm
This algorithm applies to systems organized as a ring (logically or physically). In this algorithm,
we assume that the links between the processes are unidirectional and that every process can
message the process on its right only.
Simulated Program Output
More here
------------------------------------------------------------------------------------------------------------------------------
🔶 Bankers Algorithm
A new deadlock avoidance algorithm, derived from Dijkstra’s Bankers Algorithm, is introduced for avoiding deadlock and allocate resources safely to each process in a distributed SOA. The algorithm works by observing the current state of the resources in the system along with a worst case estimate of future resource requirements and permitting the execution of only those call trees that will keep the system in a safe state.
More here
------------------------------------------------------------------------------------------------------------------------------
Thank You.. HappY Learning!