Ring Election Algorithm Workbench



This election algorithm is based on the use of a ring. We assume that the processes are physically or logically ordered, so that each process knows who its successor is. When any process notices that the coordinator is not functioning, it builds an ELECTION message containing its own process number and sends the message to its succesor. If the succesor is down, the sender skips over the successor and goes to the next number along the ring, or the one after that, until a running process is located. At each step, the sender adds its own process number to the list in the message.

Eventually, the message gets back to the process that started it all. That process recognizes this event when it receives an incoming message containing its own process number. At that point, the message type is changed to COORDINATOR and circulated once again, this time to inform everyone else who the coordinator is (designated by the list member with the highest number) and who the members of the new ring are. When this message has circulated once, it is removed and everyone goes back to work.

The workbench displays four processes. There are two queues associated with each process: a queue of requests received from other processes and a queue of requests waiting for an acknowledgement from other processes. Processes are color-coded as follows: red stands for an alive non-coordinator process, purple indicates a coordinator, and gray represents a process that is down. Every non-coordinator process sends requests (circles) to the coordinator and waits for an acknowledgement before sending the next request. Acknowledgement messages are indicated by circles within rectangles. If the acknowledgement does not arrive in a given timeout, the process starts an election by sending ELECTION messages (bars).

The simulation can be controlled on a step-by-step basis by pushing the buttons that correspond to each process. These buttons can cause the individual processes to send requests, fail, or recover. The simulation can also be run in the animation mode in which processes operate concurrently and go up and down randomly. The speed of the animation can be controlled by the "Slow Ratio" slide at the top of the demonstration. Moving the slide to the right will slow down the animiation.

Workbench