| Author |
wait and notify in Threads
|
K Vidhyakar
Ranch Hand
Joined: Jul 10, 2005
Posts: 66
|
|
Can Any body help in finding the answer for this question. Which statement is true? A. If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution. B. If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution. C. If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole consequence of the notify call. D. If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.
|
 |
Vishnu Prakash
Ranch Hand
Joined: Nov 15, 2004
Posts: 1026
|
|
option "B" is the correct answer. Regarding option "C"
then the first thread definitely resumes execution as a direct and sole consequence of the notify call.
Very little is guaranteed in threads. Once a thread is blocked-for-lock-acquisition and when another thread calls notify this threads goesto ready-to-run state and NOT running state directly. NOTE: This is NOT the correct forum for this(Thread) question.
|
Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
|
 |
Anurag Jain
Greenhorn
Joined: Jul 23, 2002
Posts: 8
|
|
|
I would agree and i have deleted my earlier post in favor of this correct answer!
|
--<br />Anurag
|
 |
 |
|
|
subject: wait and notify in Threads
|
|
|