9.5. Thread Transitions

Thread States

Understanding the life cycle of a thread is valuable when programming with threads. Threads can exist in different states. Just because a thread's start() method has been called, it does not mean that the thread has access to the CPU and can start executing straight away. Several factors determine how it will proceed.

Figure 9.3 shows the states and the transitions in the life cycle of a thread.

  • Ready-to-run state

    A thread starts life in the Ready-to-run state (see p. 369).

  • Running state

    If a thread is in the Running state, it means that the thread is currently executing (see p. 369).

  • Dead state

    Once in this state, the thread cannot ever run again (see p. 380).

  • Non-runnable states

    A running thread can transit to ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.