The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Essential Java Classes
Lesson: Threads: Doing Two or More Tasks at Once

Summary

This chapter provides a great deal of information about using threads in the Java platform. This section provides information about where to find various classes, methods, and language features that relate to threads.

Package Support for Threads

The java.lang package provides basic support for threads with the following classes and interfaces: The java.util.concurrent.* packages define a wide range of concurrency utilities, including the following:

Language Support of Threads

The Java programming language has two keywords, volatile and synchronized, related to the synchronization of threads. Both of these language features help ensure the integrity of data that is shared between two concurrently running threads. The Synchronizing Threads (in the Essential Java Classes trail) section discusses thread synchronization issues.

Runtime Support of Threads

The Java runtime environment contains the scheduler, which is responsible for running all the existing threads. The scheduler uses a fixed-priority scheduling algorithm, which usually means that at any given time the highest-priority thread is running. However, this is not guaranteed. The thread scheduler may choose to run a lower-priority thread to avoid starvation. For this reason, use priority only to affect scheduling policy for efficiency purposes. Do not rely on thread priority for algorithm correctness.

Other Thread Information

This chapter has only scratched the surface on the topics of threads and concurrency control. For further information, refer to the following:

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.