Status Type
At a specified point in time, a thread has one and only one state. These states are the JVM state, they did not reflect the state of the operating system.
definition
Thread state enumerated type defined in the interior of Thread.
public enum State { NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED; }
In the definition, we know that there are six types.
status | Explanation |
NEW (initial) | It creates a new thread object, but has not been called start () method |
RUNNABLE (run) | Java threads will be ready (ready) and running (running) two states generally referred to as "run." After the thread object is created, other threads (such as main thread) calls the start () method of the object. The thread state is located runnable threads in the pool, waiting to be selected thread scheduling, acquiring the right to use the CPU, this time in a ready state (ready). Ready state after obtaining thread CPU time slice becomes operational status (running). |
BLOCKED (blocking) | It represents the thread is blocked in the lock. |
WAITING (waiting) | Enter the state of threads need to wait for the other thread to make some specific action (notification or interrupt) |
TIMED_WAITING (Timeout waiting) | This state differs from WAITING, it can return itself after a specified time. |
TERMINATED (termination) | The thread has finished. |