23.2 Thread States and Life Cycle

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. We include this discussion to help you understand what’s going on “under the hood” in a Java multithreaded environment. Java hides most of this detail from you, greatly simplifying the task of developing multithreaded applications.

Fig. 23.1

The u m l state diagram for the thread life cycle.

Thread life-cycle UML state diagram.

23.2.1 New and Runnable States

A new thread begins its life cycle in the new state. It remains in this state until the ...

Get Java How to Program, Early Objects, 11th 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.