| ||||
Copyright 1999 Sams Publishing |
|
Summary |
In this chapter I showed you how to use a few more parts of the Thread API: |
Thread.MAX_PRIORITY , Thread.NORM_PRIORITY , and Thread.MIN_PRIORITY |
getPriority() |
setPriority() |
Thread.yield() |
The thread scheduler chooses which thread to move from the ready-to-run state to the running state. Thread priorities provide suggestions to the scheduler to help it pick the next thread to run. Generally, higher-priority threads get more processor time than lower-priority threads. |
Thread scheduling varies from VM to VM and from operating system to operating system. Because of these differences, prioritization should only be used to try to improve responsiveness and efficiency, and should not be relied upon for program correctness. |
| |||
Toc |