Grading for Question 3 -- 20 points
Grading for this question was broken down into the following:
- Part 1: 13 points.
- Part 2: 3 points. If you didn't use a semaphore, you had to
account for waking up the sleeping readers to get all three points.
- Part 3: 4 points. You had to mention that readers can starve
writers for 2 points (if you didn't take measures to prevent it),
and that anything could starve if the threads system doesn't enforce
FIFO for the other two points.
The main problem that y'all had in part one was waking up multiple
readers when the writer completed. Most of you just did one
cv_notify() in end_writers(). You need to do one per
sleeping thread, or to do a cv_notify() at the end of
begin_reading() as in my answer. This was a two point
deduction. I also deducted for errors like protecting your
cv_wait() calls with if's rather than while's,
calling cv_wait() and cv_notify() outside of the monitor,
and general synchronization problems.
If your code had the right framework, but otherwise was not very close,
you started with 4 points, and points were taken off if things were
particularly sketchy or incorrect.
Grade Histogram