Content deleted Content added
Allforrous (talk | contribs) added Category:Graph algorithms using HotCat |
m Moving Category:Algorithms in graph theory to Category:Graph algorithms per Wikipedia:Categories for discussion/Log/2024 October 4 |
||
(21 intermediate revisions by 14 users not shown) | |||
Line 1:
In [[distributed computing]], the '''bully algorithm''' is a method for dynamically [[Leader election|electing]] a [[Distributed computing#
==Assumptions==
The algorithm assumes that:<ref>
* the system is synchronous.
* processes may fail at any time, including during execution of the algorithm.
Line 12:
==Algorithm==
The [[algorithm]] 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 {{var|P}} recovers from failure, or the failure detector indicates that the current coordinator has failed, {{var|P}} performs the following actions:
# If {{var|P}} has the highest process
# If {{var|P}} receives no Answer after sending an Election message, then it broadcasts a Victory message to all other processes and becomes the Coordinator.
# If {{var|P}} 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 {{var|P}} 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 {{var|P}} receives a Coordinator message, it treats the sender as the coordinator.
===Analysis===
====Safety====
The safety property expected of [[leader election]] protocols is that every non-faulty process either elects a process {{var|Q}}, or elects none at all. Note that all [[process (computing)|processes]] that elect a leader must decide on the same process {{var|Q}} 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 {{var|X}} and {{var|Y}} such that both sent the Coordinator (victory) message to the group. This means {{var|X}} and {{var|Y}} 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
====Liveness====
[[Liveness]] is also guaranteed in the [[synchronous]], 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
====Network bandwidth utilization====
{{see also|network bandwidth}}
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
== See also ==
|