INF5510 Exercise Set 3
v18.1 (2018-03-07)
Sølve Johnsen
Oleks Shturmov

1. Heartbeat

Write a program heartbeat.m to monitor the liveness of the nodes in a network.

Let the nodes follow a protocol where they periodically tell a central node that they are still alive. Use the unavailable construct to make the program robust against crashes, this should be able to handle the crash of a central node as well.

Do not elect a new “central” node, in case the old one becomes unavailable, simply don't let your nodes crash due to the central node suddenly becoming unavailable.

2. The Taxmen Cometh

Write a program state.m, and declare a taxman object that tries to visit all the active nodes in an Emerald network before they die.

At each node, the taxman should spend roughly 20 seconds before moving on to the next.

If the node on which the taxman is located becomes unavailable, consider it dead, and the taxman dead along with it. (Although they may eventually “come back from the dead”.) The state should send out a new taxman to reach out to the remaining active nodes. Except the (central) state node, taxmen should not visit the same node twice.

3. Chatroom

Write a program chatroom.m, where client nodes connect to a central chatroom node. The clients can send messages to the chatroom, and these are forwarded to all other clients. When new clients connect, they get the last n (e.g., 20) messages, and otherwise become part of the loop, receiving all new messages, and able to send messages to others.