Skip to content

EX30 - Token passing algorithm

We have seen in the video (Topology - Token-Passing) how processes can work in a token-passing network. We have seen that the distributed mutual exclusion can be done with the help of the helper processes. The code that is also mentioned in the video can be found on GitLab in the code snippets

Question 1 - Some additional reading…

Take some time to read the chapter 7.8 in Andrew’s book. An assignment in Perusall.

Question 2 - Token passing implementation

You find on the code snippets in git repo the Python implementation of the token passing algorithm. Execute the code an try to understand how it works.

python token_passing.py

Play with the configurations (N, MW, ML) and discover the different behavior.

Question 3 - Stop, please stop!

Then, find out what is the problem with this code, and why it never stops.

Propose a modification in the code to achieve that the entire program stops, once all threads (regular) have finished their work.