wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread Watch "thread New topic
Author

thread's

nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
If we have 4 thread's executing 4 synchronized method's ,Three in the waiting state and one in running state,out of those three in the waiting state, two with high priority and the third one with the low priority and low priority thread is the first to go in the waiting state when we call notify() then which thread will start running first.

Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Your scenario has many complications that are not explained. Are the 4 methods that are synchronized in the same class?? Is the synchronized code synchronized on a method, a block, a static method??? What is the priority of the running thread compared to the other 3, etc. etc.


"JavaRanch, where the deer and the Certified play" - David O'Meara
ASHISH KUMAR
Greenhorn

Joined: Feb 15, 2001
Posts: 11
Hi Nitin,
there is no way u can predict which thread comes out waiting state first and goes into ready state.
if u 've called notifyAll() all the 3 threads will go to ready
state.
I hope this helps u.
bye
ashish
 
 
subject: thread's
 
Similar Threads
Executor runnable priority
yield and sleep
Confusion with the call in threads
Question from k&B's masterexam about yield()???????
thread's