A Monitor
has two queues: the waiting queue and the ready queue. In the absence of Wait
and Pulse
, all threads that try to acquire the lock go into the ready queue. When the lock becomes available, one thread from the ready queue will acquire it.
When a thread acquires the lock and then does a Wait
, that thread goes into the waiting queue. It's waiting for a Pulse
or PulseAll
, and will remain in the waiting queue until it receives a Pulse
, even if other threads from the ready queue acquire and release the lock.
Pulse
moves one thread from the waiting queue to the ready queue. PulseAll
moves ALL threads from the waiting queue to the ready queue.
The key here is that threads in the waiting queue can never acquire the lock. They are waiting for a pulse to move them back to the ready queue so that they can acquire the lock when it becomes available.
There's a reasonably good discussion of Wait and Pulse--at least a bit to get you started--here.