Java Concurrency Tutorial

This tutorial consists of several posts that explain the main concepts of concurrency in Java. It starts with the basics with posts about the main concerns or risks of using non-synchronized programs, and it then continues with more specific features.


Basics


Atomicity and race conditions
Atomicity is one of the main concerns in concurrent programs. This post shows the effects of executing compound actions in non-synchronized code.

Visibility between threads
Another of the risks of executing code concurrently is how values written by one thread can become visible to other threads accessing the same data.

Thread-safe designs
After looking at the main risks of sharing data, this post describes several class designs that can be shared safely between different threads.


Synchronization


Locking - Intrinsic locks
Intrinsic locks are Java's built-in mechanism for locking in order to ensure that compound actions within a synchronized block are atomic and create a happens-before relationship.

Locking - Explicit locks
Explicit locks provide additional features to the Java synchronization mechanism. Here, we take a look at the main implementations and how they work.

Labels: , ,