Ring Algorithm
Ring Algorithm starts its process of selecting of coordinator once any process connected in the ring notices that the coordinator is not functioning. The initiating process then prepares an election message that contains its own process number and then sends this message to its successor in the ring. If the successor is not functioning then it kills that successor and sends it to the next one.
Every next process then adds its own process number to the message and delivers the message to the next process connected in the ring. It continues until the message again reaches the initiating process. Now the message consists of the process number of all the functioning processes. The process that has the highest ID wins the election. The initiating process then sends another message in the ring about the winning process.
Difference Between Ring and Bully Algorithm
Election algorithms are required in order to select the coordinator. A distributed algorithm consists of many working processes. These distributed algorithms require a process that acts like a coordinator. This coordinator can be any of the working processes that organize the actions. When a coordinator fails the election algorithms are required to find the coordinating process.
Election Algorithms have two assumptions such as:
- Each process that is involved has a unique identification number.
- Each process knows the identification number of every other process.