This chapter concentrates mostly on threads, which are sub-processes
that run within a Java program.
Java
- Introduction to
threads - a brief overview of threads and the two ways to
create threads.
- Stopping Threads
- stopping a thread requires killing the thread process entirely
by making it return from its run()
method.
- Multi-Processing
- more about topics related using multiple threads.
- Thread Tasks
- more about where threads are useful.
- Animations
- threads are often used to create animated graphics.
- We discuss four basic types of multiple thread programs and
include a demo for each:
- Non-interacting
- threads run with no interaction among each other.
- Task
Splitting - several threads attack different parts of
the same problem.
- Exclusivity
- multiple threads attempt to access the same data. Synchronization
techniques must be applied to avoid interference problems
such as data race conditions.
- Communicating
- multiple threads access each other and also must synchronize
to avoid interference problems.
- Priority/Scheduling
issues of threads.
- More about
threads - - brief discussions of some additional thread topics.
- Exercises
Supplements
- Java2D
Animation - use the Java2D graphics techniques to do an animation
example.
- Threads
in the processor - a cartoon view of how multiple processes
appear to run simultaneously on a single processor.
- Cloning
- making copies of objects
Tech
We use thread techniques to illustrate several enhancements to
our histogram classes. We also look at sorting tools in Java.
- Timers - the
Java core language comes with two different timer classes for
running tasks after a given delay and periodically if needed.
- Histogram with
Adaptable Range - create a histogram whose limits can expand
to include new data values outside the current lower/upper range
limits.
- Sorting in Java
- Java also comes with tools to sort arrays and collections.
- Histogram Median
- use sort tool to obtain the median of a distribution.
- Refactoring
- reorganize class design and heirarchies as they grow and multiply.
- Error Bars
- offer the option of displaying the histogram as points with
error bars rather than vertical bars.
- Exercises
Physics
We continue the development of some numerical analysis techniques
(least squares fits) and then look at the issues of discrete approximations
and animation timing and how they affect simulations.
|