Fundamentals 6 min read

Mastering Java’s Six Thread States: A Visual Guide

This article explains Java’s six thread states—NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, and TERMINATED—using clear diagrams, concise descriptions, and practical code examples to help developers understand how threads transition during execution.

Architect Chen
Architect Chen
Architect Chen
Mastering Java’s Six Thread States: A Visual Guide

Six Thread States in Java

Java defines six distinct thread states that a Thread instance can occupy during its lifecycle: NEW , RUNNABLE , BLOCKED , WAITING , TIMED_WAITING , and TERMINATED . Understanding these states is essential for diagnosing concurrency issues and writing correct multithreaded code.

NEW – Initialization State

A thread is in the NEW state immediately after it is instantiated with new Thread(...) or a subclass of Thread. It has not yet been started.

class MyThread extends Thread {
    public void run() {
        // code to be executed by the thread
    }
}

MyThread myThread = new MyThread(); // myThread is in NEW state
NEW state diagram
NEW state diagram

RUNNABLE – Ready or Running

When start() is called, the thread moves to RUNNABLE . The JVM schedules it for execution, which may involve waiting for CPU time or I/O resources. RUNNABLE can be further split into:

Ready : the thread is waiting for the JVM scheduler.

Running : the thread has been allocated CPU time and is executing.

Thread thread = new Thread("thread");
thread.start();
RUNNABLE state diagram
RUNNABLE state diagram

BLOCKED – Waiting for Monitor Lock

A thread enters BLOCKED when it attempts to enter a synchronized block or method but cannot acquire the monitor lock because another thread holds it.

When the lock becomes available, the thread transitions back to the RUNNABLE (ready) state.

BLOCKED state diagram
BLOCKED state diagram

WAITING – Indefinite Wait

The WAITING state occurs when a thread calls Object.wait() (without a timeout), Thread.join(), or LockSupport.park(). The thread remains idle until another thread invokes notify(), notifyAll(), or otherwise unparks it.

Thread thread1 = new Thread("thread1") {
    @Override
    public void run() {
        synchronized (WaitingState1.class) {
            try {
                // thread waits indefinitely
                WaitingState1.class.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
};
thread1.start();
TimeUnit.SECONDS.sleep(1); // let thread reach wait()
WAITING state diagram
WAITING state diagram

TIMED_WAITING – Wait with Timeout

A thread enters TIMED_WAITING when it calls a timed version of wait, sleep, join, or the timed park methods ( LockSupport.parkNanos, LockSupport.parkUntil). The thread will automatically return to RUNNABLE after the specified timeout expires.

TIMED_WAITING state diagram
TIMED_WAITING state diagram

TERMINATED – End of Life

When the run() method completes, the thread transitions to TERMINATED . The thread can no longer be started or used.

TERMINATED state diagram
TERMINATED state diagram

Understanding these states helps developers reason about thread behavior, avoid deadlocks, and write more reliable concurrent Java applications.

concurrencyprogrammingthreadthread states
Architect Chen
Written by

Architect Chen

Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.