Java Thread States: New, Runnable, Blocked, Waiting and Terminated
The Java thread life cycle explained: the six Thread.State values, what moves a thread between NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING and TERMINATED, how platform and virtual threads are scheduled, join with timeouts, and why stop, suspend and resume are gone.
kvi5hnuCode Sprout team member9 min readOn this page
Every Java thread is in exactly one of six states at any moment, and Thread.getState() tells you which. Knowing them isn't academic. When an application hangs, a thread dump lists every thread with its state, and reading a dump means knowing what BLOCKED versus WAITING says about your code. This article walks through each state, the events that move a thread between them, and how the scheduler decides which runnable thread actually gets a CPU.

NEW
A thread you have constructed with new Thread(r) (or a builder's unstarted) but not yet started is new. None of its code has run yet. Calling start() does the bookkeeping, such as allocating the native thread and its stack, and moves the thread on. start() may be called only once. Calling it on a thread that has already started, even one that has finished, throws IllegalThreadStateException. Threads can't be restarted, so create a new one.
RUNNABLE
After start(), the thread is runnable. Java deliberately uses one state for both "running right now" and "ready to run but waiting for a CPU". There is no separate RUNNING state, because which runnable thread is on a core at any instant is up to the scheduler and changes constantly.
A thread busy with a long computation, or one spinning in a loop, stays RUNNABLE the whole time. So does a thread blocked in some native I/O calls, such as reading from a socket on a platform thread. The JVM can't see into native code, which is a common surprise in thread dumps.
How threads get scheduled
Since Java 21 there are two kinds of threads:
- Platform threads each wrap one operating-system thread. The OS schedules them preemptively: each gets a time slice, and when the slice runs out, the OS suspends it and gives another thread a turn. With several cores, several platform threads truly run in parallel. If there are more runnable threads than cores, the rest wait their turn.
- Virtual threads are scheduled by the Java runtime onto a small pool of platform "carrier" threads. A virtual thread keeps its carrier until it blocks (on I/O, a lock,
sleepand so on) or callsThread.yield(). Then it is unmounted, and another virtual thread runs on that carrier. Article 94 covers virtual threads in depth.
Thread.yield() hints that the current thread is willing to give up the CPU. For platform threads the hint can be ignored, and correct programs never depend on it. Thread.onSpinWait() (Java 9) is a related hint for busy-wait loops. It lets the CPU save power or favour a hyperthread sibling, and the demo's spinner uses it.
BLOCKED, WAITING and TIMED_WAITING
These three states all mean the thread is inactive. It executes no code and uses almost no CPU until something reactivates it. What differs is the reason.
BLOCKED. The thread tried to acquire an intrinsic lock, entering a synchronized method or block, and another thread holds it. It becomes runnable once the lock is released and the scheduler hands the lock to it. This state appears only for intrinsic (synchronized) locks, including one more case: a thread woken from wait() is BLOCKED while it re-acquires the monitor before wait returns.
WAITING. The thread is waiting, with no time limit, for another thread to do something:
Object.wait(), until another thread callsnotify/notifyAllon the same objectThread.join(), until the joined thread terminatesLockSupport.park(), until unparked. This is the primitive under thejava.util.concurrentlocks, so a thread waiting inLock.lock()orCondition.await()shows as WAITING, not BLOCKED.
TIMED_WAITING. The same kinds of waits, but with a timeout: Thread.sleep, and the timed versions of wait, join, LockSupport.parkNanos, Lock.tryLock and Condition.await. The thread wakes when the event happens or the time runs out, whichever comes first.
When a thread enters any of these states, the scheduler runs another thread. When the thread is reactivated, it goes back to RUNNABLE and has to be scheduled again before it actually runs. In everyday conversation, people say "blocked" for all three, and the distinction rarely matters until you read a thread dump.
TERMINATED
A thread terminates for one of two reasons:
- Its
runmethod returns normally. - An uncaught exception escapes
run. The thread dies, the exception goes to the thread's uncaught-exception handler (article 94), and by default its stack trace is printed toSystem.err.
A terminated thread object still exists, and you can query its name and state, but it can never run again.
Waiting for termination: join
t.join() puts the caller into WAITING until t terminates. join(millis) or join(Duration) puts it into TIMED_WAITING for at most that long. After a timed join returns, check t.isAlive() to see whether the thread actually finished or the time just ran out.
Methods you must not use
Java 1.0 had stop(), which killed a thread from outside, and suspend()/resume(), which froze and thawed one. All three were deprecated in Java 1.2:
stopaborts a thread at an arbitrary point, perhaps halfway through updating an object, and releases its locks. Other threads then see the object in a corrupted state.suspendfreezes a thread while it still holds its locks. If the thread that would callresumeneeds one of those locks, the program deadlocks.
suspend and resume were deprecated for removal in Java 14, and stop in Java 18. Since Java 20, stop() throws UnsupportedOperationException, and Java 23 removed suspend() and resume() entirely, so code that calls them no longer compiles, and old class files fail with NoSuchMethodError. The only supported way to end a thread is cooperatively: ask it to stop with interrupt(), and write tasks that check for interruption and exit cleanly. That is the main topic of the next article.
A complete example
To print each state reliably, the demo polls getState() until the thread reaches the expected state. Without polling, timing would make the output differ between runs. Note how each state is produced: a spin loop for RUNNABLE, contention on a synchronized lock for BLOCKED, join for WAITING, and sleep for TIMED_WAITING.
import java.time.Duration;
import java.util.concurrent.CountDownLatch;
public class Solution {
static final Object lock = new Object();
static volatile boolean keepSpinning = true;
// poll until the thread reaches the expected state, so the demo prints the same thing every run
static void await(Thread t, Thread.State expected) throws InterruptedException {
while (t.getState() != expected) Thread.sleep(1);
System.out.printf("%-8s %s%n", t.getName(), t.getState());
}
@SuppressWarnings("removal")
public static void main(String[] args) throws InterruptedException {
// NEW: constructed, not started
Thread spinner = new Thread(() -> { while (keepSpinning) Thread.onSpinWait(); }, "spinner");
System.out.printf("%-8s %s%n", spinner.getName(), spinner.getState());
// RUNNABLE: started and executing (or ready to execute)
spinner.start();
await(spinner, Thread.State.RUNNABLE);
// BLOCKED: trying to enter a synchronized block whose lock another thread holds
Thread blocked;
synchronized (lock) {
blocked = new Thread(() -> { synchronized (lock) { /* got the lock */ } }, "blocked");
blocked.start();
await(blocked, Thread.State.BLOCKED);
} // main releases the lock; blocked can proceed
blocked.join();
// WAITING: waiting indefinitely for another thread (here: join on the spinner)
Thread joiner = new Thread(() -> {
try { spinner.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
}, "joiner");
joiner.start();
await(joiner, Thread.State.WAITING);
// TIMED_WAITING: sleeping, or waiting with a timeout
var started = new CountDownLatch(1);
Thread sleeper = new Thread(() -> {
started.countDown();
try { Thread.sleep(Duration.ofMinutes(1)); } catch (InterruptedException e) { /* woken early: end */ }
}, "sleeper");
sleeper.start();
started.await();
await(sleeper, Thread.State.TIMED_WAITING);
// TERMINATED: run has returned (normally, or because of an uncaught exception)
keepSpinning = false; // lets the spinner finish, which releases the joiner
spinner.join();
joiner.join();
sleeper.interrupt(); // cuts the one-minute sleep short
sleeper.join();
await(spinner, Thread.State.TERMINATED);
await(joiner, Thread.State.TERMINATED);
await(sleeper, Thread.State.TERMINATED);
Thread failing = new Thread(() -> { throw new IllegalStateException("boom"); }, "failing");
failing.setUncaughtExceptionHandler((t, e) -> System.out.println(t.getName() + " died abruptly: " + e.getMessage()));
failing.start();
failing.join();
await(failing, Thread.State.TERMINATED);
// a thread can't be restarted
try {
failing.start();
} catch (IllegalThreadStateException e) {
System.out.println("start() on a terminated thread: IllegalThreadStateException");
}
// the old stop method no longer works
try {
new Thread(() -> { }).stop();
} catch (UnsupportedOperationException e) {
System.out.println("Thread.stop(): UnsupportedOperationException");
}
// join with a timeout returns even if the thread is still running
Thread slow = new Thread(() -> {
try { Thread.sleep(Duration.ofSeconds(5)); } catch (InterruptedException e) { /* end */ }
}, "slow");
slow.start();
slow.join(Duration.ofMillis(50));
System.out.println("after join(50 ms): slow alive? " + slow.isAlive());
slow.interrupt();
slow.join();
System.out.println("after interrupt and join: slow alive? " + slow.isAlive());
}
}
spinner NEW
spinner RUNNABLE
blocked BLOCKED
joiner WAITING
sleeper TIMED_WAITING
spinner TERMINATED
joiner TERMINATED
sleeper TERMINATED
failing died abruptly: boom
failing TERMINATED
start() on a terminated thread: IllegalThreadStateException
Thread.stop(): UnsupportedOperationException
after join(50 ms): slow alive? true
after interrupt and join: slow alive? false
The failing thread terminates abruptly, and its custom uncaught-exception handler reports the cause instead of the default stack trace. The last lines show that a timed join can return while the thread is still alive.
Common questions
Why is there no RUNNING state? Java uses RUNNABLE for both "running now" and "ready to run". Whether a runnable thread is actually on a core changes constantly, and only the scheduler knows. A thread dump can't tell you more than "runnable".
What is the difference between BLOCKED and WAITING?
BLOCKED means the thread is waiting to enter a synchronized block or method. WAITING means it called a method that waits for another thread, such as Object.wait, join, or the park method used by java.util.concurrent locks. So a thread stuck in ReentrantLock.lock() shows as WAITING, not BLOCKED.
My thread is RUNNABLE in a thread dump, but it isn't doing anything. Why? It's probably blocked in native code, such as a socket read on a platform thread. The JVM can't see inside native calls, so it reports RUNNABLE. Look at the top frames of the stack to see where it is.
How do I stop a thread now that stop() doesn't work?
Call interrupt() and write the task to check isInterrupted() or to handle InterruptedException by finishing. For tasks in an executor, future.cancel(true) or shutdownNow() send the interrupt for you.
How can I tell whether a timed join finished or timed out?
join(Duration) returns true if the thread terminated and false on timeout (Java 19). With join(millis), which returns nothing, check t.isAlive() afterwards.
API reference
java.lang.Thread
| Method | Description |
|---|---|
Thread.State getState() (Java 5) | one of NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED |
boolean isAlive() | true if started and not yet terminated |
void join() | waits until this thread terminates |
void join(long millis), boolean join(Duration d) (Java 19) | waits at most the given time; the Duration version returns whether the thread terminated |
static void yield() | hints that the current thread is willing to give up the processor |
static void onSpinWait() (Java 9) | hints that the caller is in a busy-wait loop |
void stop() | deprecated for removal; throws UnsupportedOperationException since Java 20 (suspend and resume were removed in Java 23) |
Summary
- A thread is NEW until
start(), then RUNNABLE whether or not it currently has a CPU, and TERMINATED whenrunexits normally or through an exception. - BLOCKED means waiting for a
synchronizedlock. WAITING and TIMED_WAITING mean waiting for another thread's action (wait,join,park,java.util.concurrentlocks and conditions), the timed versions with a timeout. - Platform threads are scheduled preemptively by the OS. Virtual threads are scheduled by the JVM and give up their carrier when they block.
- Threads can't be restarted, and
stop,suspendandresumeno longer work. Termination must be cooperative. - Thread dumps (
jcmd <pid> Thread.print) show these states and are the first tool for diagnosing hangs.
Practice Questions
A thread is computing a large prime and currently has no CPU because other threads are running. What state is it in?
RUNNABLE. Java doesn't distinguish "running" from "ready to run".
Thread A waits in ReentrantLock.lock() for a lock that B holds. Is A BLOCKED or WAITING?
WAITING. java.util.concurrent locks park the thread with LockSupport.park. BLOCKED is reserved for threads waiting on intrinsic (synchronized) locks.
Name three calls that put a thread into TIMED_WAITING.
For example Thread.sleep(…), t.join(timeout), obj.wait(timeout), lock.tryLock(time, unit), or condition.await(time, unit).
What happens if you call start() twice on the same Thread object?
The second call throws IllegalThreadStateException, whether or not the thread has already finished. A thread can be started only once.
Why was Thread.stop considered unsafe?
It stops a thread at an arbitrary instruction and releases all its locks. Objects the thread was halfway through updating are left inconsistent and become visible to other threads. Termination has to be cooperative, using interruption.
Previous: Java Threads: Creating and Running Threads with Runnable and Thread
Next: Java Virtual Threads, Interrupts and Daemon Threads: Thread Properties Explained
Related reading
- Java Threads: Creating and Running Threads with Runnable and Thread
- Java Object Construction: Overloading, Default Fields, this(), and Initialization Blocks
- Java Block Scope and if/else Statements
- The Java String API, Code Points, StringBuilder and Text Blocks
- Java Long-Running Tasks in User Interfaces: Swing Worker Threads and Callbacks

More in Core Java I
Java volatile, Atomics, Deadlocks and ThreadLocal: Safe Sharing Between Threads
Share data between Java threads without bugs: memory visibility and volatile, final fields, AtomicInteger and compareAndSet, LongAdder, lazy holder initialization, safe publication, lock-ordering deadlocks, ThreadLocal, InheritableThreadLocal and ScopedValue.
Java Condition Objects and the synchronized Keyword: await, signalAll, wait and notify
Make threads wait for a condition safely with Condition.await and signalAll, then learn Java's built-in alternative: synchronized methods and blocks, intrinsic locks, wait and notifyAll, choosing lock objects, client-side locking, and the monitor concept.
Java Race Conditions and ReentrantLock: Synchronizing Shared Data
Why unsynchronized threads corrupt shared data, shown step by step with a lost-update race, and how to fix it with ReentrantLock: the lock/try/finally idiom, critical sections, reentrancy and hold counts, tryLock, fair locks, and the mistakes that cause bugs.
Java invokeAll, invokeAny and Fork-Join: Running Groups of Tasks
Coordinate many concurrent tasks in Java: invokeAll to wait for every result, invokeAny to take the first success, timeouts, ExecutorCompletionService for results in completion order, structured concurrency, and the fork-join framework with RecursiveTask, RecursiveAction and work stealing.
Discussion
Sign in to ask a question or share what you learned.