Lecture 9B Flashcards
1
Q
Describe Consumer-Producer scenario:
A
A thread called Producer provides data in a queue (called a buffer). Another thread (consumer) removed this data from the queue. On both sides the queue(buffer) is a gated resource.
2
Q
What does wait() do?
A
It suspends execution of the thread until it receives notification from some other thread. Signaling is done using notify() or notifyAll() in the other thread (producer).
3
Q
What are condition variables?
A
They allow a thread to block (suspend execution) until notified by another thread that a condition is fulfilled.