CS 3733 Operating Systems, Fall 2010 Assignment 5 Comments
This assignment was graded out of 30 points.
Parts 1 and 2 were 5 points each. Parts 3 and 4 were 10 points each.
About half of those that turned it in got Part 3 working.
- When creating the threads, the 4th parameter to pthread_create
is a struct containing the start and end values.
You must have a separate storage location for each thread since otherwise
you will overwrite the value, possibly before the previous thread gets to
use it.
- You need to protect all printing done by each thread, including the
initial line giving the start and end values.
- If your mutex is only used inside of testRange,
it should not be a global variable,
but declared inside of the function with static storage class.
- Make your critical sections as small as possible.
If you lock the mutex at the start of testRange,
then only one thread can run at a time.
- You should only have to lock the mutex when a bad value is found.