Due date: Tuesday, September 14, 2004.
Ex. 1 Rewrite the solution nr. 2 for the 5 philosophers problem
in pseudocode such that the famine situation is reduced or eliminated and
justify it in a few sentences.
Hint: for each fork, you may have to use a variable that keeps track of the philosopher that has used it the last time and try to avoid, if possible, allocating the fork to the same one again. You could also use a global queue that keeps track of the order in which the philosophers attempt to use the forks.
For this exercise, you will assume that the functions Try_to_reserve(), Eat(), and Meditate() are given. You do not have to rewrite them. If you need to use other functions like these, you may do so without providing the code for them, but you'll have to give me an explanation of what these functions are doing.
Note: This homework can be turned in either on paper or by email.