Lab 7 (5 points)
CS550, Operating Systems
File Systems and Scheduling

Name: _____________________________________________

To submit this assignment, you may copy and paste parts of the assignment into a text editor such as nano, vi, notepad, MS Word, OpenOffice Writer, etc.  Zip any code and scripts showing the output of your solutions, and submit the zip file to the dropbox for lab 7.  Be sure to include a text document including any written/typed/graphed results.  The purpose of this lesson is to learn to about deadlock in the C programming language.

1. (2 points) Threaded code is provided at the following link for the Dining Philosophers problem using 5 philosophers. Convert the code to work for any number of philosophers greater than or equal to 3.

2. Incomplete MPI code for the Dining Philosophers problem is provided at the following link. Complete this code to work for any number of philosopers greater than or equal to 3. Note that a "server" is used to transfer forks or chopsticks between philosophers.

3. (1 point) The following batch script should work for 31 philosophers and 1 server:

#!/bin/bash
#SBATCH -A TG-SEE120004
#SBATCH -n 32
#SBATCH -J dining
#SBATCH -o dp.o%j
#SBATCH -p normal
#SBATCH -t 00:15:00
echo 'Starting job'
date
# number of philosophers first, number of meals second
ibrun mpiPhilosophers.exe 31 100
echo 'Completed job'
date

Compile your code and run it with the script above on Stampede making modifications as necessary for your executable file, and provide your output.