Thread-Safety, Synchronization and State-Dependent Operations
Support for programming with multiple threads is a core feature of
the Java programming language, yet multithreading issues are ignored by
many if not most Java developers. Even innocent classes that do not
actively start and manage threads should be prepared for use by multiple
threads, which raises issues of thread-safety and synchronization.
In this introductory talk we discuss the basics of thread-safety and
concurrency control in general and the Java-specific features in particular.
We will also address typical problems such as the nested monitor problem
and its potential for deadlocks and we will learn how to apply common techniques
such as the conflict set method.
Thread Interruption and the Java Memory Model
This tutorial aims to explain some of the more challenging details
of the Java thread API. Specifically, we look into thread termination
due to an interrupt request or due to an uncaught exception. We will
answer questions such as: How does thread interruption work? Why
are the methods suspend() and resume() deprecated? What do we do
instead? How do we gracefully terminate a thread in response to a thread
interruption? What is the effect of uncaught exceptions on active
threads? How can we avoid that an uncaught exception prematurely
terminates a thread?
Another less commonly known topic is the Java memory model, which has
certain problems with atomicity and sequential consistency of access to
volatile variables. The Java language specification gives guarantees
for volatile variables, but not all Java implementations actually meet
these requirements. As Java developers we would like to know which
guarantees we can rely on and which areas we should better avoid.
Concurrency Control Patterns
This tutorial discusses patterns for concurrency control and how they
can be implemented in Java. We will look into various incarnations of the
adapter pattern and will se which kinds of adapters are relevant in concurrent
programming (immutablity adapters, synchonization adapters). We will learn
how to implement a reader-writer pattern in Java, including the before-after-technique.
We will talk about patterns for thread conpletion (like future, callbacks,
group proxies).
The tutorial is of interest to Java programmers, but also to developers
who implement concurrent programs in related languages such as C++.
|