- Chapter 1
-
This chapter forms a basic introduction to the topic of threads: why
they are useful and our approach to discussing them.
- Chapter 2
-
This chapter shows you how to create threads and runnable objects
while explaining the basic principles of how threads work.
- Chapter 3
-
This chapter discusses the basic level at which threads share data
safely梒oordinating which thread is allowed to access data at
any time. Sharing data between threads is the underlying topic of our
next four chapters.
- Chapter 4
-
This chapter discusses the basic technique threads use to communicate
with each other when they have changed data. This allows threads to
respond to data changes instead of polling for such changes.
- Chapter 5
-
This chapter discusses classes and programming methods that achieve
data safety while using a minimal amount of synchronization.
- Chapter 6
-
In this chapter, we complete our examination of data sharing and
synchronization with an examination of deadlock, starvation, and
miscellaneous locking classes.
- Chapter 7
-
Swing classes are not threadsafe. This chapter discusses how
multithreaded programs can take full advantage of Swing.
- Chapter 8
-
Java collection classes are written for a variety of circumstances.
Some are threadsafe and some are not, and J2SE 5.0 introduces new
collection classes for use specifically with thread utilities. We
sort all that out in this chapter.
- Chapter 9
-
Scheduling is the process whereby a single CPU selects a thread to
run. Thread scheduling is more a property of an operating system (OS)
than a Java program, and this chapter discusses the relationship
between the virtual machine and the OS in this area.
- Chapter 10
-
This chapter discusses thread pools梐 collection of threads
that can be used to run arbitrary tasks. We use the thread pool
implementation of J2SE 5.0 for discussion of the general principles
of using thread pools.
- Chapter 11
-
Task schedulers execute a task one or more times at some point in the
future. This set of classes includes timers (Java has had timer
classes since JDK 1.3) and a general task scheduler available in J2SE
5.0.
- Chapter 12
-
Dealing with I/O is one of the primary reasons why developers use
threads in Java. In this chapter, we use all of
Java's threading features to show you how to handle
I/O effectively in multithreaded programs.
- Chapter 13
-
In this chapter, we complete our examination of thread-related
features of Java by examining thread security, thread groups, thread
stacks, and other topics.
- Chapter 14
-
Performance of thread-related features梐nd particularly
synchronization constructs梚s key to writing multithreaded
programs. In this chapter, we test various low-level programming
features and explore some truths and myths about thread performance.
- Chapter 15
-
In this chapter, we show a process for exploiting the power of
multiprocessor machines to calculate CPU-intensive loops in parallel.
- Appendix A
-
J2SE 5.0 introduces a number of thread-related classes. Many of these
classes are similar to classes developed in previous editions of this
book; we list those classes in this appendix as an aid to developers
who cannot yet upgrade to J2SE 5.0.