Thread life cycle:
The Thread life cycle means the thread is going through which state that is the Thread life.
The Thread is mainly going into the five state.
The state are as below.
New/born
Runnable
Running
Blocked/Waiting state
Dead state
1)New:
This is the start point of the Thread.When we call the Thread class constructor that time this state is performed.
2) Runnable:
This state means the Thread is ready for execution when we call start method then Thread is going to Runnable state.
3) Running:
This is the actual state where the Thread is execution.In this state the code executed concurrently mode.For coming in this state Thread perform number of number here check that the Thread priority and all other conditions.
4)Blocked:
If any reason Thread is going to blocked state.If we perform the IO operation if the Thread is waiting for the file then Thread is going to waiting state.and if we call the join,sleep method then the Thread is going to Blocked state.From the blocked state Thread always go to Runnable State not in Running state.
4)Dead/Complete:
After complete the Thread execution the Thread is going to Dead state.it is the last state of the Thread life cycle.If The once Thread goes into Dead state the Then never come into Running state.

No comments:
Post a Comment