CS560 Midterm Exam -- Answers and Grading


Question 4 -- 12 points

Answer

Part 1: Part 2 Part 3 Part 4

Grading

3 points per part. I gave partial credit for when I thought you said something reasonable. You had to mention breaking conditions for deadlock in your answer for part 3 to receive more than one point.

A bunch of you said that if you insert sleep calls between the get_resource() calls, you can deadlock. That's not true -- the ordering of the resources still ensures no circular wait, and adding sleep calls does not change anything (i.e. if one thread overtakes another, then it is the same as that thread having called allocate() before the other -- nothing is changed). If you gave that answer, you received one point.