Thread states

Updated at:

This topic describes the states of Java threads and their corresponding operating system (OS) threads.

Introduction

Each Java thread maps one-to-one to a native OS thread. Therefore, thread states are categorized as Java thread states and OS thread states. The Java Virtual Machine (JVM) creates a simple abstraction over OS threads, which allows the JVM to recognize its own specific attributes. For example, if a thread is blocked by an `object.wait()` call in Java code, the JVM reports the thread state as MONITOR_WAIT.

Java thread states

State

Description

NEW

The thread has just been created.

RUNNABLE

The thread is running.

SLEEPING

The thread is in a sleep state (Thread.sleep()).

IN_OBJECT_WAIT

The thread is waiting to be woken up by a synchronizer (Object.wait()).

IN_OBJECT_WAIT_TIMED

The thread is waiting to be woken up by a synchronizer and has a timeout (Object.wait(long timeout)).

PARKED

The thread is waiting (Unsafe.park()).

PARKED_TIMED

The thread is waiting and has a timeout (Unsafe.park(long timeout)).

BLOCKED_ON_MONITOR_ENTER

The thread failed to acquire a monitor lock and is blocked (synchronized(){}).

TERMINATED

The thread has terminated.

UNKNOWN

Unknown state.

Operating system thread states

State

Description

ALLOCATED

The thread is allocated but not initialized.

INITIALIZED

The thread is initialized but not running.

RUNNABLE

The thread is running.

MONITOR_WAIT

The thread is blocked and waiting for the next attempt to acquire a lock.

COND_VAR_WAIT

The thread is blocked and waiting to be woken up by a condition variable (Condition.await()/signal()).

OBJECT_WAIT

The thread is blocked and waiting to be woken up by an object (Object.wait()/notify()).

BREAK_POINTED

The thread is stopped at a Java Debugger (JDB) breakpoint.

SLEEPING

The thread is in a sleep state (Thread.sleep()).

ZOMBIE

The thread has terminated, but its associated resources have not been revoked. The thread is in a zombie state.

UNKNOWN

Unknown state.