a) Briefly explain the difference between deadlock prevention and deadlock [2 marks]
avoidance.
b) Four blacksmiths – Andrew, Beth, Chris and Daisy are working on four [8 marks]
separate projects in their shared forge. Collectively they have the following equipment:
4 Hammers
8 Punches
3 Swages
5 Tongs
Each piece of equipment can only be used by one blacksmith at a time.
Andrew needs at most 2 Hammers, 3 Punches, 3 Swages and 1 Tongs
Beth needs at most 2 Hammers, 3 Punches, 1 Swage and 1 Tongs
Chris needs at most 1 Hammer, 2 Punches and 4 Tongs
Daisy needs at most 3 Hammers, 4 Punches, 1 Swage and 2 Tongs
At some point in time the equipment is being used as follows:
Andrew has 1 Hammer and 2 Punches.
Beth has 1 Punch, 1 Swage and 1 Tongs.
Chris has 1 Hammer, 1 Punch and 1 Tongs.
Daisy has 1 Punch, 1 Swage and 1 Tongs.
i. Is this state safe? Use the bankers algorithm to prove your answer and identify a safe sequence (if one exists).
ii. Andrew requests the use of 1 Tongs, is it safe to grant this request? Justify your answer by either showing a safe sequence or explaining why one does not exist.
iii. If instead Daisy requests the use of 1 Punch, is it safe to grant this request? Again justify your answer by either showing a safe sequence or explaining why one does not exist.