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

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a thread is in the runnable or in the run state then the thread is in alive state and there is a thread of execution, that is, a call stack for that thread in the JVM stack. Generally, the alive state of the thread means that either the thread can be chosen by the scheduler any time or the thread is being run.

Now my question is that, what does happen when the thread is in either blocked or waiting or sleeping state?

When the thread stays one of these three states then the thread has been gone to such a state that it can to be alive again but currently it is not alive. If it is true, then what does happen of the thread of execution or call stack of that thread? The thread of execution or call stack has been suspended or totally removed from the JVM stack.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be suspended. Destroying / recreating stacks on each context switch will be expensive.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Unmesh Chowdhury wrote:Now my question is that, what does happen when the thread is in either blocked or waiting or sleeping state?



the particular thread go to the *blocked* state , later which may go to the runnable state by notifying/resume the thread.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic