Archive Post

The Fork/Join Framework – Concurrency: Part II

23.3 The Fork/Join Framework To harness the benefits of multicore architectures, the Fork/Join Framework in…

Writing Thread-Safe Code – Concurrency: Part II

23.4 Writing Thread-Safe Code Thread-safety is a critical property of a concurrent application. Threads can…

Immutability 2 – Concurrency: Part II

All reads and writes are atomic actions for all volatile fields, regardless of whether they…

Atomic Variables 2 – Concurrency: Part II

The while loop ensures that the value is always incremented by 1 from the previous…

Atomic Variables – Concurrency: Part II

Atomic Variables Unless the action on a shared volatile variable is atomic, thread-safety cannot be…

Immutability – Concurrency: Part II

Immutability We have seen how to implement thread-safe access to shared resources in synchronized code…

Intrinsic Locking Revisited – Concurrency: Part II

Intrinsic Locking Revisited Intrinsic locking provides a blocking, lock-based, thread-safe solution for concurrent threads accessing…

Reentrant Lock – Concurrency: Part II

Reentrant Lock The ReentrantLock class implements the Lock interface. Instances of the Reentrant-Lock class are…

Reentrant Lock 2 – Concurrency: Part II

More details are provided below about the lock acquisition policy implemented by the methods mentioned…

Reentrant Lock 3 – Concurrency: Part II

Example 23.12 illustrates using a reentrant lock to implement a thread-safe counter. The class ReentrantLockCounter…