Professional Documents
Culture Documents
H CS 3 - Multithreading Exercise 2: Name in Format Last, First
H CS 3 - Multithreading Exercise 2: Name in Format Last, First
H CS 3 - Multithreading Exercise 2
Total points 9/9
Subramanian, Krithika
Period: *
3rd
4th
When using a lock, all of the work of the method should be done in a try *1/1
clause after lock() is called in order for the object to be properly
protected.
1. True
2. False
https://docs.google.com/forms/d/e/1FAIpQLScFRVbGm4Bx1zITYasUEIAA4_ktjQm5zAS0NyWsifXgHv5f7g/viewscore?viewscore=AE0zAgAxcNna… 1/4
2/16/23, 6:28 PM H CS 3 - Multithreading Exercise 2
Which Condition method should be called when a condition has been met *1/1
that might allow waiting threads to proceed?
await
signalAll
conditionMet
retry
https://docs.google.com/forms/d/e/1FAIpQLScFRVbGm4Bx1zITYasUEIAA4_ktjQm5zAS0NyWsifXgHv5f7g/viewscore?viewscore=AE0zAgAxcNna… 2/4
2/16/23, 6:28 PM H CS 3 - Multithreading Exercise 2
What kind of object should be used to control the threads that want to *1/1
manipulate a shared resource?
Condition
Lock
Interrupt
PhoneBooth
Condition
Lock
Interrupt
It cannot be avoided
multiple threads are accessing the same object at the same time
https://docs.google.com/forms/d/e/1FAIpQLScFRVbGm4Bx1zITYasUEIAA4_ktjQm5zAS0NyWsifXgHv5f7g/viewscore?viewscore=AE0zAgAxcNna… 3/4
2/16/23, 6:28 PM H CS 3 - Multithreading Exercise 2
The wait() method causes the current thread to wait, and allows another *1/1
thread access to the lock.
1. True
2. False
1. True
2. False
Forms
https://docs.google.com/forms/d/e/1FAIpQLScFRVbGm4Bx1zITYasUEIAA4_ktjQm5zAS0NyWsifXgHv5f7g/viewscore?viewscore=AE0zAgAxcNna… 4/4