Scheduling

After examining the thread state diagram shown in Figure 8.2, you might wonder exactly what causes a thread to move from one state to another. This section looks at how threads move between the ready and running states. Later sections will look at movement in and out of the waiting state.

A thread moves back and forth between the ready and running states because multithreading requires multiple threads to share execution time with each other, based on the availability of the system's CPU(s). The approach used to determine which threads should execute at a given time is referred to as scheduling. The Java runtime system performs scheduling based on a thread's priority. Higher priority threads are run before lower priority threads. Threads ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.