Download the JDK
Search the Tutorials
Hide the TOC
Trail: Essential Classes
Lesson: Concurrency
Concurrency
Processes and Threads
Thread Objects
Defining and Starting a Thread
Pausing Execution with Sleep
Interrupts
Joins
The SimpleThreads Example
Synchronization
Thread Interference
Memory Consistency Errors
Synchronized Methods
Intrinsic Locks and Synchronization
Atomic Access
Liveness
Deadlock
Starvation and Livelock
Guarded Blocks
Immutable Objects
A Synchronized Class Example
A Strategy for Defining Immutable Objects
High Level Concurrency Objects
Lock Objects
Executors
Executor Interfaces
Thread Pools
Concurrent Collections
Atomic Variables
For Further Reading
Questions and Exercises
Home Page > Essential Classes > Concurrency
Synchronization

> Threads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of errors possible: thread interference and memory consistency errors. The tool needed to prevent these errors is synchronization.
> - Thread Interference describes how errors are introduced when multiple threads access shared data.
> - Memory Consistency Errors describes errors that result from inconsistent views of shared memory.
> - Synchronized Methods describes a simple idiom that can effectively prevent thread interference and memory consistency errors.
> - Implicit Locks and Synchronization describes a more general synchronization idiom, and describes how synchronization is based on implicit locks.
> - Atomic Access talks about the general idea of operations that can't be interfered with by other threads.

Previous page: The SimpleThreads Example
Next page: Thread Interference