Question: I only need part 2 Expected Results. Obviously, the program should not deadlock and should run to completion. Further, there should be some degree of

I only need part 2 Expected Results. Obviously, the program should not deadlock and should run to completion. Further, there should be some degree of fairness among the threads. In other words, each philosopher should eat approximately the same number of times. For our project, we have 5 philosophers and 500 eats, so each philosopher should be able to eat about 100 times. Due to a number of thread scheduling issues, this could vary somewhat, namely each one should NOT eat exactly 100 time, but in no case should one or more philosophers starve (with 0 eats).I only need part 2 Expected Results. Obviously, the program should not

Programming Project #4 The Dining-Philosophers Problenm In Section71.3, we provide an outline of a solution to the dining-philosophers problem using monitors. This project involves implementing a solution to this problem using either POSIX mutex locks and condition variables or Java condition variables. You only need to implement with one of these two solutions. Solutions will be based on the algorithm illustrated in Figure z.z. Both implementations will require creating five philosophers, each identified by a number o. .4. Each philosopher will run as a separate thread. Philosophers alternate between thinking and eating. To simulate both activities, have each thread sleep for a random period between one and three seconds. The program stops when all the cats add up to 500. I. POSIX Thread creation using Pthreads is covered in Section 4.41. When a philosopher wishes to eat, she invokes the function pickup torks(int pllosopher number) where philosopher_number identifies the number of the philosopher wishing to eat. When a philosopher finishes eating, she invokes return forks(int philosopher number) Your implementation will require the use of POSIX condition variables, which are covered in Section z3 II. Java When a philosopher wishes to eat, she invokes the method takeForks (philosopher Number ), where philosopher Number Identifies the number of the philosopher wishing to eat. When a philosopher finishes eating, she invokes returnF orks (philosopherNumber) Your solution will implement the following interface public interface DiningServer /Called by a philosopher when it wishes to eat +/ public void takeForks(int philosopherNumber /* Called by a philosopher when it is finished eating / public void returnFor ks [int philosopherNumber); It will require the use of Java condition variables, which are covered in Section 7.4.4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!