Chang and Roberts algorithm
Appearance
Chang and Roberts[1] is a ring-based election algorithm used to find the process with the largest identification. It is a useful method of election in decentralised Distributed computing.
The algorithm
The algorithm assumes that each process has a Universal Identification (UID) and that the process can arrange themselfs in a unidirectional ring.
- Initially each process in the ring is marked as non-participant.
- A process that notices a lack of leader starts an election. It marks itself as participant and creates an election message containing its UID and sends it clockwise to its neighbour.
- When a process receives an election message it compares the UID with its own, if the current process has a larger UID it replaces the one in the election message with its own. The process then marks itself as participant and again forwards the election message in a clockwise direction.
- If the process was already marked as participant when it receives an election message the procedure is different. In this case it will compare the UID as before but only forward the election message if it has needed to replace the UID with its own.
The algorithm finishes when a process receives an election message containing its own UID. Then the second stage of the algorithm takes place
- This process marks itself as non-participant and sends an elected message to its neighbour announcing its election and UID.
- When a process recievices an elected message it makrs itself as non-participant records the elected UID and again forwards the elected message.
- When the elected message again reaches the newly elected process the election is over.
References
- ^ "An improved algorithm for decentralized extrema-finding in circular configurations of processes", Communications of the ACM, 22 (5), ACM: 281–283, 1979
{{citation}}
: Unknown parameter|authors=
ignored (help)