Thread States in Java

A thread can be in one of Four states for threads: new, runnable, blocked, dead.
Step 1: When a thread has just been created using the new operator, it is in the new state.

Step 2: Once start method is invoked (which calls the run method), the thread becomes runnable.
  • A runnable thread might not be running.
  • There can be many runnable threads. But only one of them can be running at any time point.
  • OS decides which thread to run. More on this later.
Step 3: A runnable thread enters the blocked state when
  • The thread is currently running and method Thread.sleep is called
  • suspend method of the thread is called. (deprecated)
  • The thread calls the await method.
  • The thread tries to lock an object locked by another thread.
  • The thread calls an operation that is blocked on i/o.
Step 4: A blocked reenters runnable state when
  • It has slept the specified amount of time.
  • resume method of the thread is called. (deprecated)
  • Another method calls signal or signalAll  
  • Object lock released by other thread
  • I/O completed.
Step 5: A runnable thread enters the dead state when
  • Its run method exits. Natural death.
  • stop method of the thread is called. (deprecated)
  • An exception is thrown but not caught.