23.2. Thread States: Life Cycle of a Thread

At any time, a thread is said to be in one of several thread states—illustrated in the UML state diagram in Fig. 23.1. Several of the terms in the diagram are defined in later sections.

Figure 23.1. Thread life-cycle UML state diagram.

A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread, which places it in the runnable state. A thread in the runnable state is considered to be executing its task.

Sometimes a runnable thread transitions to the waiting state while it waits for another thread to perform a task. A waiting thread transitions ...

Get Java™ How to Program, Seventh 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.