Bully algorithm: Difference between revisions

Content deleted Content added
m c/e
Line 21:
# If P has the highest process id, it sends a Victory message to all other processes and becomes the new Coordinator. Otherwise, P broadcasts an Election message to all other processes with higher process IDs than itself.
# If P receives no Answer after sending an Election message, then it broadcasts a Victory message to all other processes and becomes the Coordinator.
# If 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 startsrestarts athe newprocess electionat the beginning.)
# If P receives an Election message from another process with a lower ID it sends an Answer message back and starts a newthe election (thatprocess isat the beginning, Pby sendssending an Election messagesmessage to thehigher-numbered processes with higher ids than itself).
# If P receives a Coordinator message, it treats the sender as the coordinator.