• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

thread's

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic