Question: I only need part 2 done. Programming Project #4 The Dining-Philosophers Problem In Section 713, we provide an outline of a solution to the dining-philosophers

I only need part 2 done.  I only need part 2 done. Programming Project #4 The Dining-Philosophers

Programming Project #4 The Dining-Philosophers Problem In Section 713, 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 22. 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 I. POSIX Thread creation using Pthreads is covered in Section 44.1 When a philosopher wishes to eat, she invokes the function pickup forks (int philosopher nunber) 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 23 II. Java When a philosopher wishes to eat, she invokes the method takeForks (philosopherNumber), where phiooperNumber identifies the number of the philosopher wishing to eat. When a philosopher finishes eating, she invokes returnForks (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 publie void returnForks(int philosopherNumbeE) 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!