Interview Prep Zoneby CuriouserLabs

Question 1 of 5 · senior level

Walk me through the Java thread lifecycle. What is the difference between BLOCKED and WAITING?

🎤 Say this first

A thread goes NEW → RUNNABLE → (BLOCKED | WAITING | TIMED_WAITING) → TERMINATED. BLOCKED means the thread wants to enter a `synchronized` region but another thread holds the monitor — it is involuntary. WAITING* means the thread voluntarily parked itself (wait(), join(), LockSupport.park()) and needs another thread to wake it. The distinction matters in thread dumps: lots of BLOCKED threads point to lock contention; lots of WAITING threads are usually normal pool workers idling.

The full picture

🎬 Thread lifecycle states

1 / 7
NEWjust an objectRUNNABLEready / eligibleOn CPUstill RUNNABLEBLOCKEDwaiting for monitorWAITINGwait() / join()TERMINATEDrun() finishedstart()scheduledmonitor busylock → wait()notify()run() endsOne thread 🟣 moving through its lifecycle — BLOCKED vs WAITING is a favourite senior interview probe.

new Thread(task) creates a Thread object — state NEW. No OS thread exists yet; it is just a Java object.

Step through one thread's journey across all six states.
  • NEW — the Thread object exists, but no OS thread does. start() has not been called.
  • RUNNABLE — eligible to run. Java folds ready and actually running on a CPU into this single state; the OS scheduler decides which.
  • BLOCKED — parked by the JVM because the monitor it needs (synchronized) is owned by another thread.
  • WAITING / TIMED_WAITING — parked voluntarily via wait(), join(), park() (or their timed variants, plus sleep(t)).
  • TERMINATEDrun() returned or threw. A thread can never be restarted; start() twice throws IllegalThreadStateException.

🔄 Likely follow-up questions

  • Why is stop() deprecated, and how do you actually cancel a thread? (interrupts, cooperative cancellation)
  • What does join() do to the caller's state?
  • How would virtual threads change this picture?