Tagged articles

LockSupport

8 articles · Page 1 of 1
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Jan 21, 2025 · Fundamentals

Understanding CAS: Solving the ABA Problem and Other Pitfalls in Java Concurrency

This article explains the classic ABA issue in Java's Compare‑And‑Swap (CAS) operations, outlines why long spin loops and single‑variable limitations can degrade performance, and presents practical solutions such as AtomicStampedReference, LockSupport, ReentrantLock, and optimized data structures to mitigate these challenges.

ABA problemCASJava concurrency
0 likes · 4 min read
Understanding CAS: Solving the ABA Problem and Other Pitfalls in Java Concurrency
Architect's Guide
Architect's Guide
Dec 26, 2023 · Fundamentals

Java Thread Communication Techniques: volatile, wait/notify, CountDownLatch, ReentrantLock with Condition, and LockSupport

This article demonstrates five Java thread‑communication approaches—using a volatile flag, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—each illustrated with complete code examples and explanations of their behavior and limitations.

CountDownLatchLockSupportReentrantLock
0 likes · 10 min read
Java Thread Communication Techniques: volatile, wait/notify, CountDownLatch, ReentrantLock with Condition, and LockSupport
Top Architect
Top Architect
Aug 17, 2023 · Backend Development

Thread Communication in Java: volatile, wait/notify, CountDownLatch, ReentrantLock+Condition, and LockSupport

This article explains five Java thread‑communication techniques—volatile variables, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—providing code examples and detailed explanations of how each method works and its synchronization behavior, including sample programs that add elements to a list, demonstrate notification timing, and show how locks are acquired and released.

CountDownLatchLockSupportReentrantLock
0 likes · 11 min read
Thread Communication in Java: volatile, wait/notify, CountDownLatch, ReentrantLock+Condition, and LockSupport
Architect
Architect
Aug 16, 2023 · Backend Development

5 Practical Ways to Implement Thread Communication in Java

This article compares five Java thread‑communication techniques—volatile flag, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—by presenting concrete code examples, explaining their underlying mechanisms, and discussing their advantages and drawbacks.

CountDownLatchLockSupportReentrantLock
0 likes · 13 min read
5 Practical Ways to Implement Thread Communication in Java
JavaEdge
JavaEdge
Jan 4, 2020 · Backend Development

Mastering Java’s Unsafe park/unpark and AQS: Build Custom Locks with LockSupport

This article explains how Java’s Unsafe class provides low‑level park and unpark methods, how the LockSupport utility wraps them for easier use, and demonstrates building a simple exclusive lock with AbstractQueuedSynchronizer, covering state handling, blocking mechanisms, and thread‑queue management.

AQSCustomLockLockSupport
0 likes · 7 min read
Mastering Java’s Unsafe park/unpark and AQS: Build Custom Locks with LockSupport
Programmer DD
Programmer DD
Jun 16, 2018 · Fundamentals

How Java AQS Uses CLH Queues and LockSupport to Manage Thread Blocking

This article explains the internal mechanisms of Java's AbstractQueuedSynchronizer, detailing how the CLH synchronization queue, the shouldParkAfterFailedAcquire method, and the LockSupport utility work together to decide when a thread should spin, block, or be unblocked, with full code examples and step‑by‑step analysis.

AQSCLHQueueLockSupport
0 likes · 8 min read
How Java AQS Uses CLH Queues and LockSupport to Manage Thread Blocking
Java Backend Technology
Java Backend Technology
Nov 1, 2017 · Backend Development

Mastering ReentrantReadWriteLock: Deep Dive into Java’s Read‑Write Lock Mechanics

This article explains the structure, features, and internal workings of Java's ReentrantReadWriteLock, compares it with ReentrantLock and synchronized, provides usage examples, analyzes state management with bitwise operations, and covers lock acquisition, release, downgrade, and the role of LockSupport.

LockSupportReadWriteLockReentrantLock
0 likes · 10 min read
Mastering ReentrantReadWriteLock: Deep Dive into Java’s Read‑Write Lock Mechanics