• 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 alive?

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is conditions cousing thread transition into the Dead state from Ready-to-run state?
 
Vladimir Kositsky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean ,there are(is) any condition cousing threads get Dead state than returning from the call to the run method or by throwing an exception that propagates beyond the run method?
[This message has been edited by Vladimir Kositsky (edited January 08, 2001).]
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is what "Thinking in Java" says about it.
Blocking
A thread can be in any one of four states:

New: The thread object has been created but it hasn�t been started yet so it cannot run.
Runnable: This means that a thread can be run when the time-slicing mechanism has CPU cycles available for the thread. Thus, the thread might or might not be running, but there�s nothing to prevent it from being run if the scheduler can arrange it; it�s not dead or blocked.
Dead: The normal way for a thread to die is by returning from its run( ) method. You can also call stop( ), but this throws an exception that�s a subclass of Error (which means you aren�t forced to put the call in a try block). Remember that throwing an exception should be a special event and not part of normal program execution; thus the use of stop( ) is deprecated in Java 2. There�s also a destroy( ) method (which has never been implemented) that you should never call if you can avoid it since it�s drastic and doesn�t release object locks.
Blocked: The thread could be run but there�s something that prevents it. While a thread is in the blocked state the scheduler will simply skip over it and not give it any CPU time. Until a thread reenters the runnable state it won�t perform any operations.
 
Vladimir Kositsky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx for reply
so it impossible for thread get dead state while it waiting for monitor or it yields?
 
You may have just won ten million dollars! Or, maybe a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic