CS 3733 Operating Systems, Spring 2008 Assignment 5 Comments
- This assignment was graded on the basis of 30 points.
- A global variable that will be changed by one thread but used by another
should be volatile.
- The mutex lock used by saveValue should be declared and
initialized, and used only in saveValue.
Some comments on some of the questions:
- It should be volatile since it may be changed by a different thread.
- Yes.
- The buffer could be corrupted.
- Most likely, this did not happen since it would be a rare occurrence.
- Most people used mutex locks.
- volatile
- It should not be a problem since you are just checking to see if it ever
changed from 0.
- Probably
- The thread may not be killed soon enough.
- One way to test this is to comment out the line that kills the
second thread.
If it is not killed, it might have a chance to generate
a factor that is not prime.