Tagged articles
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
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.

CountDownLatchJavaLockSupport
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.

CountDownLatchJavaLockSupport
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.

AQSCustomLockJava
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.

AQSCLHQueueJava
0 likes · 8 min read
How Java AQS Uses CLH Queues and LockSupport to Manage Thread Blocking