Question: Your job is to implement a solution that synchronizes the Homers and the Donut Chef in a Java application (called Donut) using semaphores such that

Your job is to implement a solution that synchronizes the Homers and the Donut Chef in a Java application (called Donut) using semaphores such that a deadlock or indefinite postponement will not occur.

Your solution to the Homer Simpson Problem must use the semaphore primitives (acquire and release) available in Java to synchronize the Homers and Chef. The Homers and Chef code must be based on the Java semaphore implementation and must not use any other synchronization technique.

In your implementation, each Homer, as well as the Chef, are required to run as separate threads. The Chef must use the Random class from java.util to create a seeded random number sequence for the Chefs product distribution. Your program must accept the seed value as an argument on the command line (java Donut seedvalue.) Include print statements that show the state of your system such that the 2 events can be traced. Use indentation, blank lines and specific labels to show your output in a clear and concise manner.

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!