Question: Consider the following attempt to solve the dining philosophers problem for five philosophers semaphore fork5 1 semaphore s-1 int i void philosopher(int i) while(true){ think:

Consider the following attempt to solve the dining philosophers problem for five philosophers semaphore fork5 1 semaphore s-1 int i void philosopher(int i) while(true){ think: wait(s); wait(forki); wait (forki +1] mod 5); eat); signal(forkli); signal(forki 1 mod 5); signal(s) Modity the code so that it provides a satisfactory solution. Justity your answer. (8 marks) (5 marks) (7 marks) (b) Explain whether this code avoids starvation (a) Explain whether this code avoids deadlock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
