November 2004
Intermediate to advanced
1024 pages
27h 50m
English
Threads can be in one of four states:
New
Runnable
Blocked
Dead
Each of these states is explained in the sections that follow.
When you create a thread with the new operator—for example, new Thread(r)—the thread is not yet running. This means that it is in the new state. When a thread is in the new state, the program has not started executing code inside of it. A certain amount of bookkeeping needs to be done before a thread can run.
Once you invoke the start method, the thread is runnable. A runnable thread may or may not actually be running. It is up to the operating system to give the thread time to run. (The Java specification does not call this a separate state, though. A running thread is still in ...
Read now
Unlock full access