Bully algorithm

In distributed computing, the bully algorithm is a method for dynamically electing a coordinator or leader from a group of distributed computer processes.

The algorithm assumes that:[1] The algorithm uses the following message types: When a process P recovers from failure, or the failure detector indicates that the current coordinator has failed, P performs the following actions: The safety property expected of leader election protocols is that every non-faulty process either elects a process Q, or elects none at all.

The Bully algorithm satisfies this property (under the system model specified), and at no point in time is it possible for two processes in the group to have a conflicting view of who the leader is, except during an election.

This is true because if it weren't, there are two processes X and Y such that both sent the Coordinator (victory) message to the group.

We have a contradiction, and hence our initial assumption that there are two leaders in the system at any given time is false, and that shows that the bully algorithm is safe.

If the failed process recovers in time, it simply sends a Coordinator (victory) message to all of the group.

Assuming that the bully algorithm messages are of a fixed (known, invariant) sizes, the most number of messages are exchanged in the group when the process with the lowest ID initiates an election.