Fundamentals 3 min read

Java Thread States Explained: 6 States with Visual Diagrams

This article provides a comprehensive explanation of Java's six thread states—New, Runnable, Blocked, Waiting, Timed Waiting, and Terminated—with visual diagrams illustrating each state's transitions and typical triggers such as lock acquisition, wait/notify, and timeout mechanisms.

Architect Chen
Architect Chen
Architect Chen
Java Thread States Explained: 6 States with Visual Diagrams

1. New (New)

A thread has been created but has not yet started execution. The diagram illustrates the initial state before the start() method is invoked.

Thread New state diagram
Thread New state diagram

2. Runnable (Runnable)

The Runnable state encompasses two sub-states: Ready (waiting for CPU time) and Running (actually executing). The diagram shows the thread in the runnable pool, eligible for scheduling.

Thread Runnable state diagram
Thread Runnable state diagram

3. Blocked (Blocked)

The thread is blocked and paused, typically because it is waiting to acquire a monitor lock (e.g., entering a synchronized block/method already held by another thread). Once the lock becomes available, the thread transitions back to the Ready state.

Thread Blocked state diagram
Thread Blocked state diagram

4. Waiting (Waiting)

The thread is blocked indefinitely, waiting for another thread to perform a specific action. Common causes include calling Object.wait() without a timeout, Thread.join() without a timeout, or LockSupport.park(). The thread resumes only when another thread calls notify()/notifyAll() on the same object, or the joined thread terminates, or LockSupport.unpark() is called.

Thread Waiting state diagram
Thread Waiting state diagram

5. Timed Waiting (Timed Waiting)

The thread is blocked for a specified maximum time, waiting for another thread to perform an action. Examples include Thread.sleep(long), Object.wait(long), Thread.join(long), LockSupport.parkNanos/parkUntil, and CompletableFuture.get with timeout. If the timeout expires before the awaited event occurs, the thread automatically returns to the Ready state.

Thread Timed Waiting state diagram
Thread Timed Waiting state diagram

6. Terminated (Terminated)

The thread has completed its execution (run() method finished normally or threw an uncaught exception) and is no longer alive. It cannot be restarted.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaConcurrencymultithreadingThread StatesJava InterviewThread Lifecycle
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.