Problem 5: Nested Monitor Demonstration

This version of the bounded buffer monitor uses semaphores instead of Java conditional synchronization. Can you get it to deadlock?

Hint: Shift the slider to the left to run the producer or the consumer faster.

Unable to load applet

 

Exercise:

Modify this applet in a way that the deadlock does not occur anymore.

Hint: This example uses a nested monitor. Check the classes BoundedBuffer, DisplayBuffer, and Semaphore.

Result:

The result may look like this.