Lab 8 (5 points)
CS550, Operating Systems
Condition Variables 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 8.  Be sure to include a text document including any written/typed/graphed results. 

The following lab is based in part upon information provided at the LLNL POSIX Threads Programming website by Blaise Barney at the following link.  Within this lab, you will work with an example file on the examples webpage ConditionVariable.c. This file is related to the questions below and contains information on where the questions should be answered.

1. Add output statements to each thread function in the code and record your output. Then modify the code to remove the condition variable and record your output. Finally, add the condition variable back to the code.

2. What happens when you increase the number of deposits and withdrawls to 1000? Record your output.

3. What happens when you increase the number of threads to 10 for deposit and withdrawl threads? Record your output.

4. Currently deposit threads add between 100 and 200 dollars to the account. What happens if you change this to 1 to 100 dollars? Record your output, then revert the change.

5. What happens when you change the scheduling policy? Try SCHED_FIFO and SCHED_OTHER and record your output. Read the man pages and online and explain what these do.

6. Modify the code to use 8 deposit threads, 8 withdrawl threads, and 2 billion iterations. Remove ALL output except that used to display the starting and ending account balance. Run your code on one node of Stampede with one task (-n 1 -N 1). Be sure to run your code WITHOUT using the ibrun command.