The high-level thread states are ready, running, waiting, and dead.
In Java, threads can be in various high-level states, and these states are typically represented by the Thread.State
enumeration. The high-level thread states in Java are as follows:
- NEW: A thread that has been created but not yet started with the
start()
method. - RUNNABLE: A thread that is ready to run is moved to the runnable state. It is waiting for its turn to be picked by the thread scheduler for execution.
- BLOCKED: A thread that is blocked waiting for a monitor lock is in this state. It might be waiting to enter a synchronized block/method or trying to reenter a synchronized block/method it had entered and is currently executing.
- WAITING: A thread that is waiting indefinitely for another thread to perform a particular action is in this state. For example, a thread that calls
wait()
on an object enters this state. - TIMED_WAITING: A thread that is waiting for another thread to perform a particular action for up to a specified waiting time is in this state. For example, a thread that calls
sleep()
orjoin()
enters this state. - TERMINATED: A thread that has exited is in this state.
These states are part of the Java Thread State model and are represented by the Thread.State
enum introduced in Java 5.