Java Thread Life Cycle
In Java, Thread life cycle is nothing but a thread states.Based on the thread state we can determine what exactly the thread is doing in the given point of time. In more precise, based thread state whether thread is currently running or terminated or waiting can be determined.
Thread Life Cycles
When we see thread state as New, it internally means that the thread has been created but its not yet started.
When we see thread state as RUNNABLE, it means currently thread is running or executing the instructions what has been written in the run method of a thread. In general terms thread is utilizing the CPU to perform the execution of instructions.
When we see thread state as TERMINATED, it means thread has exited the run method or completed the instructions what needs to be executed for that respective thread.
When we see thread state as TIMED_WAITING, it means thread is started executing the instructions but programmer has gave the instruction to stop running for certain point of time.
When we see thread state as WAITING, it means thread is started executing the instructions but programmer has gave the instruction to stop running for indefinite time.
When we see thread state as BLOCKED, it means thread is waiting for a resource. The resource can be a database or anything, once the resource is available the thread state will change from BLOCKED state to RUNNABLE state.