A thread is an independent path of execution of a program. We can run multiple threads simultaneously within a program . A thread can be in one of the below 4 states.
1) New / Born state
2) Ready / Runnable state
For better understanding, see the below diagram. We can switch thread states by calling method provided by thread .
1) When we created thread object, then the thread is said to be in New state or Born state .
2) If we call start() method of thread then thread will be entered into Ready or Runnable state.
3) If Thread Scheduler allocates CPU for thread, Then thread will be entered into Running state.
4) Once thread execution completed , Then thread will be entered into dead state .
There is one more state , which is not considered as part of thread life cycle is ‘block / not running’ state . When we pause the thread execution , then we say thread is in blocked state or not running state .