Lecture 14: Synchronization 6 Flashcards
1
Q
Monitors:
A
A high-level synchronization abstraction
2
Q
When thread t calls wait()
A
t releases object lock
t’s state = BLOCKED
t placed in wait set
3
Q
When thread t calls notify()
A
a. selects some thread t’ from wait list
b. moves t to entry set
c. state of t:= RUNNABLE (Can again compete for lock)
4
Q
notify()
A
Selects arbitrary thread from wait set
5
Q
notifyAll ():
A
Removes ALL threads from wait set and puts them in entry set
Best to use if potentially multiple threads in wait set
(Safe if thread code loops checking conditions)