HOME

TheInfoList



OR:

In
distributed computing A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
, the bully algorithm is a method for dynamically electing a
coordinator Coordinator may refer to: *Administrative assistant, or sometimes a slightly higher-ranking employee * Facilitator, a position within an organization or business with significant responsibilities for acting as a liaison between departments, stake ...
or leader from a group of distributed computer processes. The process with the highest process ID number from amongst the non-failed processes is selected as the coordinator.


Assumptions

The algorithm assumes that: * the system is synchronous. * processes may fail at any time, including during execution of the algorithm. * a process fails by stopping and returns from failure by restarting. * there is a failure detector which detects failed processes. * message delivery between processes is reliable. * each process knows its own process id and address, and that of every other process.


Algorithm

The
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
uses the following message types: * Election Message: Sent to announce election. * Answer (Alive) Message: Responds to the Election message. * Coordinator (Victory) Message: Sent by winner of the election to announce victory. When a process recovers from failure, or the failure detector indicates that the current coordinator has failed, performs the following actions: # If has the highest process ID, it sends a Victory message to all other processes and becomes the new Coordinator. Otherwise, broadcasts an Election message to all other processes with higher process IDs than itself. # If receives no Answer after sending an Election message, then it broadcasts a Victory message to all other processes and becomes the Coordinator. # If receives an Answer from a process with a higher ID, it sends no further messages for this election and waits for a Victory message. (If there is no Victory message after a period of time, it restarts the process at the beginning.) # If receives an Election message from another process with a lower ID it sends an Answer message back and if it has not already started an election, it starts the election process at the beginning, by sending an Election message to higher-numbered processes. # If receives a Coordinator message, it treats the sender as the coordinator.


Analysis


Safety

The safety property expected of
leader election In distributed computing, leader election is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task has begun, all network nodes are either unaware which node will ser ...
protocols is that every non-faulty process either elects a process , or elects none at all. Note that all
processes A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that produce a specific se ...
that elect a leader must decide on the same process as the leader. 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 and such that both sent the Coordinator (victory) message to the group. This means and must also have sent each other victory messages. But this cannot happen, since before sending the victory message, Election messages would have been exchanged between the two, and the process with a lower process ID among the two would never send out victory messages. 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.


Liveness

Liveness Properties of an execution of a computer program —particularly for concurrent and distributed systems— have long been formulated by giving ''safety properties'' ("bad things don't happen") and ''liveness properties'' ("good things do happen"). ...
is also guaranteed in the
synchronous Synchronization is the coordination of events to operate a system in unison. For example, the conductor of an orchestra keeps the orchestra synchronized or ''in time''. Systems that operate with all parts in synchrony are said to be synchronou ...
, crash-recovery model. Consider the would-be leader failing after sending an Answer (Alive) message but before sending a Coordinator (victory) message. If it does not recover before the set timeout on lower ID processes, one of them will become leader eventually (even if some of the other processes crash). If the failed process recovers in time, it simply sends a Coordinator (victory) message to all of the group.


Network bandwidth utilization

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. This process sends (N−1) Election messages, the next higher ID sends (N−2) messages, and so on, resulting in \Theta\left(N^2\right) election messages. There are also the \Theta\left(N^2\right) Alive messages, and \Theta\left(N\right) co-ordinator messages, thus making the overall number messages exchanged in the worst case be \Theta\left(N^2\right).


See also

*
Leader election In distributed computing, leader election is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task has begun, all network nodes are either unaware which node will ser ...
*
Chang and Roberts algorithm The Chang and Roberts algorithm is a ring-based coordinator election algorithm, employed in distributed computing. The algorithm The algorithm assumes that each process has a Unique Identification (UID) and that the processes can arrange the ...


References

* Witchel, Emmett (2005).
"Distributed Coordination"
Retrieved May 4, 2005. * Hector Garcia-Molina, Elections in a Distributed Computing System, IEEE Transactions on Computers, Vol. C-31, No. 1, January (1982) 48–59 * L. Lamport, R. Shostak, and M. Pease,
"The Byzantine Generals Problem"
ACM Transactions on Programming Languages and Systems, Vol. 4, No. 3, July 1982.


External links

*{{Commonscatinline Distributed algorithms Graph algorithms