Description
### Motivation
* Demonstrate your ability to program using Java locking objects (i.e., Semaphore / Lock / Condition objects).
### Instructions
* You have two problems to complete:
* One task is to create two solutions to the Dining Philosophers Problem. One is Dijkstra’s solution, the is the arbitrator solution.
– Each solution should have a different implementation of
[Philosopher](src/main/java/edu/nyu/cs9053/homework9/Philosopher.java)
– Besides the two implementations of
[Philosopher](src/main/java/edu/nyu/cs9053/homework9/Philosopher.java) the only other classes which you should change for this task are: [Chopstick](src/main/java/edu/nyu/cs9053/homework9/Chopstick.java),
[Waiter](src/main/java/edu/nyu/cs9053/homework9/Waiter.java) and
[PhilosopherFactory](src/main/java/edu/nyu/cs9053/homework9/PhilosopherFactor y.java)
– To ensure this portion of the assignment works you need to invoke the main class two times. Once passing in no arguments (which will execute your Dijkstra solution), another passing in “waiter” (which will execute your
Waiter solution).
– For each solution, when invoking the main class you need to ensure the program never stops. The philosophers should eat infinitely.
– The main class is
[DiningPhilosophersProblem](src/main/java/edu/nyu/cs9053/homework9/DiningPhil osophersProblem.java)
– Run your program for at least 5 minutes without fail for each type. * The second task is to finish the jelly bean dispenser system. This is a version of the producer / consumer problem.
– Create an implementation of the
[Consumer](src/main/java/edu/nyu/cs9053/homework9/jellybean/Consumer.java) – Create an implementation of the
[Producer](src/main/java/edu/nyu/cs9053/homework9/jellybean/Producer.java)
– Complete the factory which instantiates your implementations
[ProducerConsumerFactory](src/main/java/edu/nyu/cs9053/homework9/jellybean/Pr oducerConsumerFactory.java)
– You should only modify `ProducerConsumerFactory` and create your two implementations.
– To ensure this portion of the assignment works you need to invoke the main class which is
[JellyBeanDispenser](src/main/java/edu/nyu/cs9053/homework9/jellybean/JellyBe anDispenser.java)
– It should run forever
### Implementation
* Ensure your code is correct by compiling and testing it
* A portion of your grade will be based upon readability and organization of your code.
– Follow the naming guidelines of lecture
– Break large functions into multiple functions based on logical organizations
* You should not need to create any Thread objects, call sleep or join for this assignment. If you find yourself doing this you have done something wrong.
Reviews
There are no reviews yet.