Articles and videos
- Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated? ► The article explains the rational of these deprecations and how to correctly stop or suspend a thread.
- Threading lightly, Part 1: Synchronization is not the enemy — When do we have to synchronize, and how expensive is it really?🗑️ by (July 17th, 2001) ► After debunking the false ideas about the performance cost of synchronised, the author quickly reminds when synchronisation should be used.
- ↪Threading lightly, Part 2: Reducing contention — Improve application performance by staying out of your own way🗑️ by (September 5th, 2001) ► How to reduce contention due to thread synchronisation: synchronise blocks as short as possible, use monitors of small sub-objects instead of the monitor of the whole object and lock collapsing (instead of repetitively acquiring and release a lock, just acquire it once, do the whole job and release it).
-
↪Threading lightly, Part 3: Sometimes it's best not to share — Exploiting ThreadLocal to enhance scalability🗑️ by (October 16th, 2001) ► How to use the
ThreadLocal
andInheritableThreadLocal
classes. -
Java theory and practice: Safe construction techniques — Don't let the "this" reference escape during construction🗑️ by (June 2002) ► In order to avoid race conditions (the object being used before being fully constructed),
this
must not escape, explicitly or implicitly, from the constructor. -
Java theory and practice: Concurrency made simple (sort of) — An introduction to the util.concurrent package🗑️ by (November 1st, 2002) ► A description of ’s classes, for easier thread handling, which will be part of Java 1.5:
QueuedExecutor
,PooledExecutor
andFutureResult
. - Java theory and practice: Characterizing thread safety — Thread safety is not an all-or-nothing proposition🗑️ by (September 23rd, 2003) ► Thread-safetiness is not a simple Boolean flag. Goetz presents Bloch’s classification: immutable, thread-safe, conditionally thread-safe, tread-compatible, and thread-hostile.
-
Scheduling recurring tasks in Java applications — Introducing a simple generalisation of the Java language's Timer class🗑️ by (November 4th, 2003) ► The author describes how he wrote classes on top of
Timer
andTimerTask
to handle periodic tasks. - Java theory and practice: Fixing the Java Memory Model, Part 1 — What is the Java Memory Model, and how was it broken in the first place?🗑️ by (February 24th, 2004) ► A description of the problems with the current memory model.
- ↪Java theory and practice: Fixing the Java Memory Model, Part 2 — How will the JMM change under JSR 133?🗑️ by (March 30th, 2004) ► Reads/writes to volatile variables cannot be reordered with reads/writes to non-volatile variables, all final fields of an object are guaranteed to be correctly initialised by the constructor when other threads access the object.
-
Java theory and practice: Dealing with InterruptedException — You caught it, now what are you going to do with it?🗑️ by (May 23rd, 2006) ► An overview of thread interruption and the
InterruptedException
exception and how to deal with this one (rethrowing or restoring the interrupted status). -
Advanced Topics in Programming Languages: The Java Memory Model by (March 21st, 2007) ► Some explanation on the changes introduced with JSR-133, using
volatile
, thread safe lazy initialisation, usingfinal
… - Advanced Topics in Programming Languages: Effective Static Race Detection for Java by (June 4th, 2007) ► A high-level presentation of the algorithm used by Chord to find race conditions.
-
Java theory and practice: Managing volatility — Guidelines for using volatile variables🗑️ by (June 19th, 2007) ► Some patterns using
volatile
: status flag, publication of an immutable object, cheap read-write lock… - Java on a 1000 Cores - Tales of Hardware / Software CoDesign by (August 12th, 2009) ► The history and the technology of Azul Systems: highly parallel computers dedicated to Java.
-
5 things you didn't know about … java.util.concurrent, Part 1 — Multithreaded programming with concurrent Collections🗑️ by (May 18th, 2010) ►
TimeUnit
,CopyOnWriteArrayList
,BlockingQueue
,ConcurrentMap
, andSynchronousQueue
. -
↪5 things you didn't know about … java.util.concurrent, Part 2 — Concurrent programming means working smarter, not harder🗑️ by (June 1st, 2010) ►
Semaphore
,CountDownLatch
,Executor
/ExecutorService
,ScheduledExecutorServices
, and timeouts. -
5 things you didn't know about … multithreaded programming — On the subtleties of high-performance threading↓🗑️ by (November 9th, 2010) ► Some facts, on multithreading, missing examples and analysis: synchronised method vs. synchronised block,
ThreadLocal
,volatile
, andjava.util.concurrent.atomic
. - Multicore CPUs and the concurrency changes they bring — Why thread-based application parallelism is trumped in the multicore era↓🗑️ by (July 31st, 2012) ► The author explains that multithread applications are not adequate for multicore architectures, but there is no real explanation and he only points to an alternative (actors) in the conclusion.
- Turbo Charge CPU Utilization in Fork/Join Using the ManagedBlocker by Heinz Kabutz↑🚫 by (May 11th, 2017) ► A fast-paced demonstration on how to parallelise a Fibonacci computation.
-
AtomicStampedReference by (February 12th, 2020) ► A description of
AtomicStampedReference
. - Synchronization in Java, Part 1: Race conditions, locks, and conditions — The first article in this series on thread synchronization covers the fundamentals of race conditions, lock objects, condition objects, and the await, signal, and signalAll methods. by (February 4th, 2022) ► The subtitle says it all.
- ↪Synchronization in Java, Part 2: The synchronized keyword — This second article in a series on thread synchronization addresses intrinsic locks, the synchronized keyword, synchronized blocks, and ad hoc locks. by (February 18th, 2022) ► The subtitle says it all.
- ↪Synchronization in Java, Part 3: Atomic operations and deadlocks — This third article in a series on thread synchronization describes volatile fields, final variables, atomic operations, deadlocks, the deprecated stop and suspend methods, and on-demand initializations. by (March 2nd, 2022) ► The subtitle says it all.
- Quiz yourself: Multithreading and the Java keyword synchronized by and (January 16th, 2023) ► A simple question about synchronised class and instance methods.
-
Quiz yourself: Crossing Java’s CyclicBarrier in a multithreaded environment by and (May 15th, 2023) ► A question about
CyclicBarrier
. -
Quiz yourself: Locking mechanisms and Java’s postincrement ++ operator by and (June 19th, 2023) ► How to use
ReentrantLock.tryLock()
. -
Quiz yourself: The overloaded submit(…) methods in Java’s ExecutorService by and (August 21st, 2023) ► The differences between
Runnable
andCallable
. -
Mastering Concurrency: An In-Depth Guide to Java's ExecutorService — Java's ExecutorService is a powerful framework for managing and executing concurrent tasks in Java applications. It provides a higher-level abstraction over raw threads. by (February 5th, 2024) ► A good overview of
ExecutorService
. -
Double-checked locking
- The "Double-Checked Locking is Broken" Declaration by , , , , , , , , , , , and ► A technical description of the issue.
- Double-checked locking and the Singleton pattern🗑️ by (May 2002) ► A subtle synchronising bug when assigning a created object to a variable.
-
Collections
-
Java theory and practice: Concurrent collections classes — ConcurrentHashMap and CopyOnWriteArrayList offer thread safety and improved scalability🗑️ by (July 23rd, 2003) ► A short presentation of
ConcurrentHashMap
andCopyOnWriteArrayList
classes whose better locking mechanism ensures improved performance when many thread are accessing the collections. -
Java theory and practice: Building a better HashMap — How ConcurrentHashMap offers higher concurrency without compromising thread safety🗑️ by (August 21st, 2003) ► A description of how multithread safetyness has been implemented in
ConcurrentHashMap
. -
Taming Tiger: Concurrent collections — Moving beyond Map, Collection, List, and Set🗑️ by (June 16th, 2004) ► A short overview of the concurrent classes in Java 1.5:
Queue
and its derived classes,ConcurrentMap
,ConcurrentHashMap
andConcurrentHashMap
andCopyOnWriteArrayList
. - Advanced Topics in Programming Languages: A Lock-Free Hash Table by (March 28th, 2007) ► describes his hash table algorithm, how he proves this one works and presents some performance benchmarks.
-
Java theory and practice: Concurrent collections classes — ConcurrentHashMap and CopyOnWriteArrayList offer thread safety and improved scalability🗑️ by (July 23rd, 2003) ► A short presentation of
-
Thread pools
- Java theory and practice: Thread pools and work queues — Thread pools help achieve optimum resource utilization🗑️ by (July 2002) ► The title says it all.
-
Pooling threads to execute short tasks🗑️ (November 16th, 2004) ► A simple example of
Executors.newFixedThreadPool
.
-
JCSP
- CSP for Java programmers, Part 1 — Pitfalls of multithreaded programming on the Java platform🗑️ by (June 21st, 2005) ► Some generalities about Java multi-threading and its pitfalls.
- ↪CSP for Java programmers, Part 2 — Concurrent programming with JCSP🗑️ by (June 21st, 2005) ► A presentation of JCSP framework: how to build a network of processes linked by channels.
-
↪CSP for Java programmers, Part 3 — Advanced topics in JCSP🗑️ by (June 21st, 2005) ► Some advanced JCSP features (
Barrier
,Bucket
,CREW
,ProcessManager
…) with some non-convincing comparison with AOP and thejava.util.concurrent
package.
-
JVM concurrency
-
JVM concurrency: Java and Scala concurrency basics — Understand concurrency in the Java language and the added options that Scala provides🗑️ by (March 25th, 2014) ► A short recall of
synchronied
andvolatile
, a description of how to use thread pools and fork/join in Java, and callbacks,for
comprehension and waiting in Scala. -
↪JVM concurrency: Java 8 concurrency basics — See how Java 8 features make concurrent programming easier🗑️ by (April 8th, 2014) ►
CompletableFuture
and streams. -
↪JVM concurrency: To block, or not to block? — Compare blocking and nonblocking approaches to handling asynchronous events in Java 8🗑️ by (July 22nd, 2014) ► Using
CompletableFuture
s with a waiting thread or by combining them, and the performance / complexity of both solutions. -
↪JVM concurrency: Asynchronous event handling in Scala — Learn blocking and nonblocking techniques, including easy nonblocking code with the async macro🗑️ by (September 2nd, 2014) ► The same content as the previous article, but this time in Scala with the special
async
/await
macro. - ↪JVM concurrency: Acting asynchronously with Akka — Build actor systems for concurrent applications🗑️ by (April 8th, 2015) ► A presentation of Akka, an actor-based toolkit.
- ↪JVM concurrency: Building actor applications with Akka — Go beyond the basics to build applications that use actor interactions🗑️ by (August 12th, 2015) ► More information on Akka.
-
JVM concurrency: Java and Scala concurrency basics — Understand concurrency in the Java language and the added options that Scala provides🗑️ by (March 25th, 2014) ► A short recall of