Washers and Dryers--a Thread Test

I wanted to test my understanding of thread synchronization because various online tutorials and APIs on Threads provided vague and even conflicting explanations. I developed the Washer/Dryer scenario to determine the right answers.

The Requirements

Each Washer and Dryer is a thread and must sleep until a dish appears in the rack to its left. If another Washer or Dryer grabs the dish, leaving none for this Washer or Dryer, it should go back to sleep.

If a Washer has finished washing a dish, it can only put it in the clean rack if there is room. If there is no room, it must sleep (RED) while holding the dish until there is room to put it in the clean rack (once a Dryer removes a dish from that rack).

The clean rack is shared by the Washers and Dryers: only one should be allowed to change the contents of the rack at any moment. Washer and Dryer activity must be coordinated.

To restart, click in the Location/URL field and press Enter
Java details

The clean rack must be synchronized so that only one Washer or Dryer at a time can add a dish to or remove a dish from the clean rack.

The rack uses a Washer's wait() to tell the Washer to fall asleep if no slot is available.

The rack uses notifyAll() to awaken all Washers when a Dryer has removed a dish from the rack. If several Washers are waiting for an open slot, only one gets it, and the rest fall back to sleep.