Question: Apply the following algorithm to the ring consisting of nodes 1 , 1 5 , 9 , 1 1 , 1 9 , 3 ,
Apply the following algorithm to the ring consisting of nodes and Illustrate your solution using snapshots.
The Algorithm
To run for election:
status "candidate"
maxnum
WHILE status "candidate" DO
sendboth from myvalue, maxnum
await both replies but react to other messages
IF either reply is no THEN status "lost"
maxnum maxnum
OD
On receiving message from value, num, maxnum:
IF value myvalue THEN sendecho no value
IF value myvalue THEN DO
status "lost"
num num
IF num maxnum THEN sendpass from value, num, maxnum
ELSE sendeecho ok value
OD
IF value myvalue THEN status "won"
On receiving message no value or ok value
IF value myvalue THEN sendpass the message
ELSE this is a reply the processor was awaiting
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
