Your answers should be submitted as a plain text file hw04.txt, a postscript file hw04.ps, or a PDF file hw04.pdf. Please use these filenames!
Savagei: while (1) { get serving from pot; eat; }
Cook: while (1) { sleep; put M servings in pot; }
Develop psuedocode (along the lines of the in-class Sleeping Barber solution) for the actions of the savages and the cook. Use semaphores for synchronization. You may assume the semaphores are fair. Your solution should avoid deadlock and awaken the cook only when the pot is empty. (10 points)