To identify and resolve deadlock in a message-passing program.
This lab will deal with the 08-deadlock.c program. This program computes a number of square root values, and then sends them from one process to another in a specific pattern.
Process 0 sends its values to process 1, process 1 sends its to process 2 and so on. The last process sends its values back to process 0.
As currently written, this program will not complete due to deadlock. Your job is to figure out why it's deadlocking and fix it.
When you're done, the output of the program should look like this when run with 4 processes (though the order may of course be different:
Process 1 received 1000 values from process 0. Process 2 received 1000 values from process 1. Process 3 received 1000 values from process 2. Process 0 received 1000 values from process 3.
Note that you should keep the communication pattern the same - i.e. you can't just remove the communication to fix the problem, but rework the communication so that it happens without deadlock.
Copyright © 2019 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.