Home CPSC 425

Lab 8: MPI Deadlock

 

Objective

To identify and resolve deadlock in a message-passing program.


 

Task

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.


 

Details

  1. Download and run the 08-deadlock.c program.
  2. Observe that the program will deadlock.
  3. Figure out why the program deadlocks.
  4. Fix the program so it can no longer cause deadlock. There are multiple ways to do this!

 

Submitting

When you have gotten the program to run without deadlock, submit the code in Canvas. As a comment, include a brief description of what caused the deadlock and how you fixed it.

Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.