Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Q Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Thread Q" Watch "Thread Q" New topic
Author

Thread Q

Nitin Bhagwat
Ranch Hand

Joined: Sep 09, 2004
Posts: 132
True or False:

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.

Answer given is false.

I believe it is true. Can any one confirm it please?
Thank you in advance.


"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
The key here is "definetly"
I beleive that the answer depends on the JVM and the OS. So, when you are writing your platform-independent code, you cannot definetly say that the first thread going into the wait will be the first to resume execution
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Thread Q
 
Similar Threads
wait and notify in Threads
about wait() method
Threads
thread