Question: I am trying to Implement an input/output version of the Dining Philosophers problem. To solve the problem, I am to use the Resource hierachy solution

I am trying to Implement an input/output version of the Dining Philosophers problem. To solve the problem, I am to use the Resource hierachy solution meaning, I have to sign a partial order to the resources ( forks).

Since there are 5 philosophers, (0 to 4) AND because it has to be interactive, I believe I need total of 6 threads.

I need help setting up the question since I am provided with 0 codes. Any help would be greatly appreciated.

I am trying to Implement an input/output version of the Dining Philosophersproblem. To solve the problem, I am to use the Resource hierachysolution meaning, I have to sign a partial order to the resources

Resource hierarchy solution This solution to the problem is the one originally proposed by Dijkstra. It assigns a partial order to the resources (the forks, in this case), and establishes the convention that all resources will be requested in order, and that no two resources unrelated by order will ever be used by a single unit of work at the same time Here, the resources (forks) will be numbered 0 through 4 and each unit of work (philosopher) will always pick up the lower-numbered fork first, and then the higher-numbered fork, from among the two forks they plan to use. The order in which each philosopher puts down the forks does not matter. In this case, if four of the five philosophers simultaneously pick up their lower-numbered fork, only the highest-numbered fork will remain on the table, so the fifth philosopher will not be able to pick up any fork. Moreover, only one philosopher will have access to that highest-numbered fork, so they will be able to eat using two forks Project Guidance and Requirements: By being interactive, vour program supports user inputs, which will determine which philosopher wants to eat or think

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!