Bully Algorithm
See, Wikipedia, Bhanu Priya, colostate (good example)
- Select the process with the highest process-id.
- Any process can initiate an election if
- it just recovered from a failure or
- it suspects that the current coordinator has failed.
- Cannot communicate with leader.
- Three types of messages are used: election, ok, and I won.
Bully Algo Steps
- An initiating process p sends election messages to all processes with higher IDs and awaits for ok messages.
- If a process receives an election message, it returns an ok message and starts an election.
- election message comes from process of lower IDs.
- Repeat step 1.
- If it receives any ok messages, it drops out and waits for an I won message.
- ok message comes from process having higher id.
- If no ok messages are received, p becomes the coordinator and sends I won to all processes with lower IDs.
- If a process receives an I won message, then the sender is the coordinator.