Election Algorithm
Election Algorithm
Election Algorithm
• Need one process to act as a coordinator.
• Technique to pick a unique coordinator (a leader node).
• Take over the role of a failed process.
• Pick a master in Berkely clock synchronization.
• Types of Election algorithm: I. Bully algorithm; II. Ring algorithm.
Bully algorithm
• Each process has a unique numerical ID.
• Process know the IDs and address of every other process.
• Communication is assumed reliable.
• Key idea: select process with the highest ID.
• Process initiate election if it just recover from failure or if coordinator
failed.
• Several process can initiate an election simultaneously.
• O(n^2) message required with n process.
Algorithm (suppose Process P send a message to
the coordinator)
• It will assume that the coordinator process is failed
when it doesn't receive any response from the
coordinator within the time interval T.
• An election message will be sent to all the active
processes by process P along with the highest priority
number.
• If it will not receive any response within the time
interval T, the current process P elects itself as a
coordinator.
• After selecting itself as a coordinator, it again sends a
message that process P is elected as their new
coordinator to all the processes having lower priority.
If process P will receive any response from another
process Q within time T:
1.It again waits for time T to receive another response, i.e., it
has been elected as coordinator from process Q.
2.If it doesn't receive any response within time T, it is assumed
to have failed, and the algorithm is restarted.
Bully Election Algorithm Example