Home » Core Java » Thread Life Cycle

Thread Life Cycle


In a life cycle a thread  at a particular time can be in one of the  five states.

1 : New
2 : Runnable
3 : Running
4 : Waiting/blocking/sleeping
5 : Dead


New : When we create thread instance ,the thread enters to new state.Here thread is not alive and start() method has not been invoked on the thread.

Runnable : A thread enters to runnable  when start() method is invoked on it.In this state thread becomes alive and becomes eligible for running.As soon as the thread scheduler selects it to run ,it starts running.A thread can also enters to runnable state afrer either runing/waiting/blocked/sleeping state.

Running : A thread enters to running state ,when the thread scheduler selects  it from running pool to be the currently executing process.

Waiting/blocked/sleeping : If a thread is in waiting/blocked/sleeping state , then it  is not running but still alive.

Dead : After the run() method completes ,thread enters into dead state.In the dead state the thread  may be viable(capable of living under some particular circumstances).Once a thread is in dead state ,you can not restart it.On invoking start() method on it,you will get run time exception.

Leave a comment

Your email address will not be published. Required fields are marked *

three × 3 =