Tagged articles
78 articles
Page 1 of 1
Tech Freedom Circle
Tech Freedom Circle
Aug 18, 2025 · Interview Experience

How to Hand‑Write a Simple AbstractQueuedSynchronizer (AQS) for High‑Pay Java Interviews

This article walks through the fundamentals of Java's AbstractQueuedSynchronizer, covering lock‑queue relationships, CLH lock internals, dummy head nodes, state management, and step‑by‑step implementations of acquire, addWaiter, acquireQueued, shouldParkAfterFailedAcquire, and release methods, complete with runnable example code.

AQSAbstractQueuedSynchronizerJava
0 likes · 29 min read
How to Hand‑Write a Simple AbstractQueuedSynchronizer (AQS) for High‑Pay Java Interviews
Architect's Guide
Architect's Guide
Jun 27, 2025 · Backend Development

Demystifying Java Locks: From Pessimistic vs Optimistic to ReentrantLock Internals

This article explains the classification of Java locks—including pessimistic, optimistic, fair, and unfair variants—details their state transitions from biased to heavyweight, and walks through the source code of ReentrantLock and Condition to illustrate how synchronization, queuing, and thread parking are implemented in the JVM.

AQSConditionLocks
0 likes · 20 min read
Demystifying Java Locks: From Pessimistic vs Optimistic to ReentrantLock Internals
Cognitive Technology Team
Cognitive Technology Team
May 6, 2025 · Backend Development

Understanding Java's AbstractQueuedSynchronizer (AQS): Core Components, Design, and Practical Applications

AbstractQueuedSynchronizer (AQS) is the core framework for building Java locks and synchronizers, providing state management, FIFO queuing, and blocking/unblocking mechanisms; this article explains its components, design patterns, thread safety operations, and real-world implementations such as ReentrantLock and Semaphore, with code examples.

AQSJavaLocks
0 likes · 11 min read
Understanding Java's AbstractQueuedSynchronizer (AQS): Core Components, Design, and Practical Applications
Sohu Tech Products
Sohu Tech Products
Apr 29, 2025 · Backend Development

Mastering Java Concurrency: Deep Dive into Threads, Locks, and AQS

This comprehensive guide explores Java multithreading fundamentals, covering thread creation, lifecycle, synchronization challenges, context switching costs, deadlock detection, various lock mechanisms such as synchronized, ReentrantLock, ReadWriteLock, and the underlying AbstractQueuedSynchronizer architecture with practical code examples and performance tips.

AQSConditionJava
0 likes · 42 min read
Mastering Java Concurrency: Deep Dive into Threads, Locks, and AQS
Sohu Tech Products
Sohu Tech Products
Feb 19, 2025 · Fundamentals

Deep Dive into ReentrantLock: Fair Lock vs Non-Fair Lock Implementation Principles

The article explains Java’s ReentrantLock implementation, contrasting fair locks that queue threads in request order with non‑fair locks that allow immediate acquisition, detailing the internal Sync, FairSync and NonfairSync classes, lock/unlock mechanisms, performance trade‑offs, and guidance on selecting the appropriate lock type.

AQSJUCJava concurrency
0 likes · 19 min read
Deep Dive into ReentrantLock: Fair Lock vs Non-Fair Lock Implementation Principles
Senior Tony
Senior Tony
Jan 13, 2025 · Backend Development

How Java’s AQS Powers ReentrantLock – A Deep Dive into the Source

This article explains the core concepts of Java’s AbstractQueuedSynchronizer (AQS), its exclusive and shared modes, the template‑method design it uses, and walks through the actual source code showing how ReentrantLock implements both fair and non‑fair locking, complete with diagrams and code snippets for interview preparation.

AQSJavaLock
0 likes · 10 min read
How Java’s AQS Powers ReentrantLock – A Deep Dive into the Source
Su San Talks Tech
Su San Talks Tech
Oct 23, 2024 · Backend Development

Unlocking Java’s AQS: A Deep Dive into AbstractQueuedSynchronizer and Concurrency Primitives

This article explores the origins of Java's JUC package, explains the core concepts of AbstractQueuedSynchronizer—including template methods, exclusive and shared acquisition, CLH queues, CAS, and LockSupport—and demonstrates how locks, conditions, and synchronization mechanisms are implemented and used in real-world Java concurrency.

AQSConditionJava
0 likes · 30 min read
Unlocking Java’s AQS: A Deep Dive into AbstractQueuedSynchronizer and Concurrency Primitives
Sanyou's Java Diary
Sanyou's Java Diary
Oct 14, 2024 · Fundamentals

Unlocking Java’s AQS: How AbstractQueuedSynchronizer Powers Locks and Synchronizers

This article explains Java's AbstractQueuedSynchronizer (AQS) framework, detailing its FIFO queue, state handling, entry‑wait queue, exclusive and shared lock acquisition, condition‑variable queues, and how core concurrency utilities like ReentrantLock, ReadWriteLock, CountDownLatch, Semaphore, and ThreadPoolExecutor are built on it.

AQSLocksSynchronization
0 likes · 31 min read
Unlocking Java’s AQS: How AbstractQueuedSynchronizer Powers Locks and Synchronizers
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Jun 7, 2024 · Fundamentals

Understanding Java CAS and AQS: Unlock Lock-Free Concurrency

This article explains the principles and implementation of Java's Compare-and-Swap (CAS) and AbstractQueuedSynchronizer (AQS), illustrating how CAS enables lock‑free algorithms and how AQS underpins high‑level synchronization constructs like ReentrantLock and CountDownLatch, while also providing practical step‑by‑step examples.

AQSCASJava
0 likes · 5 min read
Understanding Java CAS and AQS: Unlock Lock-Free Concurrency
Su San Talks Tech
Su San Talks Tech
Feb 11, 2024 · Backend Development

How to Retrieve Async Return Values with Java FutureTask?

This article explains how to obtain return values from asynchronous Java methods using FutureTask, covering its AQS foundation, execution flow, get() behavior, and provides concrete source code examples for practical implementation.

AQSAsyncFuture
0 likes · 13 min read
How to Retrieve Async Return Values with Java FutureTask?
HelloTech
HelloTech
Jul 28, 2023 · Backend Development

Understanding Java's AbstractQueuedSynchronizer (AQS) and ReentrantLock Implementation

The article explains Java’s AbstractQueuedSynchronizer framework and how ReentrantLock uses its inner Sync classes—FairSync and NonfairSync—to manage lock acquisition via CAS, queueing, spinning, and parking, detailing the acquire/release loops, fair vs non‑fair behavior, and interview‑ready insights.

AQSJavaLock
0 likes · 12 min read
Understanding Java's AbstractQueuedSynchronizer (AQS) and ReentrantLock Implementation
Selected Java Interview Questions
Selected Java Interview Questions
May 5, 2023 · Backend Development

High‑Frequency Java Concurrency Questions: AQS, Locks, Thread Pools, Blocking Queues, CountDownLatch, Semaphore, CopyOnWriteArrayList, and ConcurrentHashMap

This article explains the core concepts and common pitfalls of Java's AbstractQueuedSynchronizer (AQS) and its derived utilities such as ReentrantLock, ReentrantReadWriteLock, CountDownLatch, Semaphore, as well as the design and behavior of blocking queues, thread‑pool parameters, CopyOnWriteArrayList, and ConcurrentHashMap, providing code examples and practical guidance.

AQSBlockingQueueConcurrentHashMap
0 likes · 21 min read
High‑Frequency Java Concurrency Questions: AQS, Locks, Thread Pools, Blocking Queues, CountDownLatch, Semaphore, CopyOnWriteArrayList, and ConcurrentHashMap
Top Architect
Top Architect
Feb 7, 2023 · Fundamentals

Understanding Java Heavyweight Locks: ObjectMonitor vs AQS

This article explains the differences and similarities between Java's ObjectMonitor and the AbstractQueuedSynchronizer (AQS) implementations of heavyweight locks, covering their internal data structures, waiting queues, lock acquisition order, and how synchronized interacts with wait/notify mechanisms.

AQSJVMJava
0 likes · 11 min read
Understanding Java Heavyweight Locks: ObjectMonitor vs AQS
Su San Talks Tech
Su San Talks Tech
Dec 30, 2022 · Fundamentals

Unlocking Java Concurrency: A Deep Dive into AQS, Locks, and Condition Queues

This article explains Java's AbstractQueuedSynchronizer (AQS) framework, covering its MESA monitor model, entry and condition wait queues, exclusive and shared lock acquisition and release, and how core concurrency utilities like ReentrantLock, ReadWriteLock, CountDownLatch, Semaphore, ThreadPoolExecutor, and CyclicBarrier are built upon it.

AQSConditionJava
0 likes · 30 min read
Unlocking Java Concurrency: A Deep Dive into AQS, Locks, and Condition Queues
Top Architect
Top Architect
Oct 17, 2022 · Backend Development

Understanding Java Locks: volatile, synchronized, monitor, CAS, and AQS

This article explains why locks are needed in Java, describes the fundamentals of volatile and synchronized, details the monitor‑based implementation of synchronized, introduces CAS operations, and outlines advanced lock mechanisms such as biased, lightweight, lock coarsening, elimination, and the AbstractQueuedSynchronizer framework.

AQSCASJava
0 likes · 11 min read
Understanding Java Locks: volatile, synchronized, monitor, CAS, and AQS
IT Architects Alliance
IT Architects Alliance
Aug 27, 2022 · Backend Development

Understanding ReentrantLock and the AQS Framework in Java

This article explains how Java's ReentrantLock works, detailing the role of the AbstractQueuedSynchronizer framework, the lock's internal architecture, the FIFO wait‑queue implementation, lock acquisition and release processes, and how these mechanisms avoid the herd effect in multithreaded environments.

AQSJavaReentrantLock
0 likes · 11 min read
Understanding ReentrantLock and the AQS Framework in Java
Top Architect
Top Architect
Apr 5, 2022 · Backend Development

Deep Dive into Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities

This article provides an in‑depth analysis of Java's AbstractQueuedSynchronizer (AQS), explaining its internal data structures, lock acquisition and release mechanisms for ReentrantLock and ReentrantReadWriteLock, and demonstrates how higher‑level concurrency utilities such as Condition, CountDownLatch, CyclicBarrier, and Semaphore are built on top of AQS.

AQSJUCJava
0 likes · 28 min read
Deep Dive into Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities
Ziru Technology
Ziru Technology
Mar 15, 2022 · Backend Development

Unlocking Java Concurrency: How CountDownLatch Works Inside JDK 1.8

This article explores the inner workings of Java’s CountDownLatch from JDK 1.8, detailing its core concepts such as the counter, thread synchronization, shared mode, and AQS mechanisms, and demonstrates practical usage through step‑by‑step code analysis and examples.

AQSBackend DevelopmentCountDownLatch
0 likes · 5 min read
Unlocking Java Concurrency: How CountDownLatch Works Inside JDK 1.8
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Nov 11, 2021 · Fundamentals

Understanding and Implementing the CLH Spin Lock in Java

This article explains the concepts of spin locks and mutexes, introduces the CLH lock as a fair spin lock used in Java's AbstractQueuedSynchronizer, and provides a detailed step‑by‑step walkthrough of its initialization, lock acquisition, release, testing, and common pitfalls with illustrative code and diagrams.

AQSCLHLockJava
0 likes · 17 min read
Understanding and Implementing the CLH Spin Lock in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 28, 2021 · Backend Development

Deep Dive into Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities

This article provides a comprehensive explanation of Java's JUC origins, the design and implementation of AbstractQueuedSynchronizer (AQS), its template methods for exclusive and shared locks, the CLH queue mechanism, lock implementations, condition queues, and related code examples, illustrating how high‑performance concurrency primitives such as ReentrantLock, CountDownLatch, Semaphore, and ReentrantReadWriteLock work under the hood.

AQSConditionJava
0 likes · 26 min read
Deep Dive into Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 10, 2021 · Fundamentals

Understanding Java Semaphore: Usage Scenarios, Code Example, and Source‑Code Deep Dive

This article introduces Java's Semaphore as a thread‑synchronization tool, explains its flow‑control use cases such as database connections and parking lots, provides a complete parking‑lot simulation code sample, and analyzes the underlying AQS‑based implementation including fairness, acquire/release mechanics, and auxiliary methods.

AQSFairnessJava
0 likes · 13 min read
Understanding Java Semaphore: Usage Scenarios, Code Example, and Source‑Code Deep Dive
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Jan 13, 2021 · Backend Development

Understanding Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities

This article provides an in-depth explanation of Java's AbstractQueuedSynchronizer (AQS) framework, covering its role in JUC concurrency utilities such as locks, semaphores, CountDownLatch, ReentrantReadWriteLock, and Condition, including template methods, state management, node structures, queue algorithms, and practical code examples.

AQSConditionJUC
0 likes · 25 min read
Understanding Java's AbstractQueuedSynchronizer (AQS) and Concurrency Utilities
Code Ape Tech Column
Code Ape Tech Column
Aug 22, 2020 · Fundamentals

How ReentrantLock Works Under the Hood: A Deep Dive into Java’s AQS

This article breaks down the inner workings of Java’s ReentrantLock, explaining spin locks, the role of AbstractQueuedSynchronizer, fair vs. non‑fair locking, and step‑by‑step thread execution with code examples and diagrams to illustrate the complete lock acquisition and release process.

AQSJavaLock
0 likes · 17 min read
How ReentrantLock Works Under the Hood: A Deep Dive into Java’s AQS
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Jul 24, 2020 · Fundamentals

Understanding Java's AbstractQueuedSynchronizer (AQS): Concepts, Internal Implementation, and Resource Acquisition/Release

This article explains the core concepts of Java's AbstractQueuedSynchronizer (AQS), its internal FIFO double‑linked list structure, key code snippets, how threads acquire and release resources in exclusive and shared modes, and provides practical insights for mastering Java concurrency.

AQSAbstractQueuedSynchronizerJava
0 likes · 12 min read
Understanding Java's AbstractQueuedSynchronizer (AQS): Concepts, Internal Implementation, and Resource Acquisition/Release
Programmer DD
Programmer DD
Jun 28, 2020 · Fundamentals

Unlocking Java AQS Shared Mode: How Semaphore Works Under the Hood

This article explains the shared‑mode acquisition in Java's AbstractQueuedSynchronizer, walks through the core template methods, compares them with exclusive mode, and demonstrates a classic application by dissecting the Semaphore source code and its usage patterns.

AQSJavaSharedLock
0 likes · 14 min read
Unlocking Java AQS Shared Mode: How Semaphore Works Under the Hood
Youzan Coder
Youzan Coder
Jun 12, 2020 · Fundamentals

When to Use synchronized vs. Lock: Mastering Java Locks

This article explains Java's lock mechanisms, comparing synchronized and the Lock interface, detailing their usage, implementation via AQS, system‑level primitives, and providing code examples to help developers choose the appropriate synchronization tool.

AQSJavaLock
0 likes · 11 min read
When to Use synchronized vs. Lock: Mastering Java Locks
Selected Java Interview Questions
Selected Java Interview Questions
Jun 2, 2020 · Backend Development

Deep Dive into ThreadPoolExecutor: Principles, State Control, and Source Code Analysis

This article provides a comprehensive analysis of Java's ThreadPoolExecutor, covering its underlying JUC synchronizer framework, core and non‑core thread handling, state management, key configuration parameters, and detailed walkthrough of critical source‑code methods such as execute, addWorker, and runWorker, supplemented with illustrative code examples.

AQSCoreThreadPoolExecutor
0 likes · 30 min read
Deep Dive into ThreadPoolExecutor: Principles, State Control, and Source Code Analysis
Selected Java Interview Questions
Selected Java Interview Questions
May 18, 2020 · Backend Development

Understanding Java's java.util.concurrent (J.U.C) Framework and AQS Mechanism

This article provides a comprehensive overview of Java's java.util.concurrent package, detailing its core components such as atomic classes, locks, collections, executors, tools, as well as an in‑depth explanation of the AbstractQueuedSynchronizer (AQS) framework, its fields, methods, and related concurrency utilities like FutureTask, BlockingQueue, ForkJoin, and work‑stealing algorithms.

AQSForkJoinFutureTask
0 likes · 22 min read
Understanding Java's java.util.concurrent (J.U.C) Framework and AQS Mechanism
Programmer DD
Programmer DD
Mar 22, 2020 · Fundamentals

Why Use Locks in Java? Understanding volatile, synchronized, and CAS

This article explains why Java uses locks to prevent dirty reads and data inconsistency, compares volatile and synchronized mechanisms, details monitor-based lock implementation, lock optimizations like biased and lightweight locks, introduces CAS and AbstractQueuedSynchronizer, and illustrates these concepts with code examples and diagrams.

AQSCASJava
0 likes · 13 min read
Why Use Locks in Java? Understanding volatile, synchronized, and CAS
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
Architecture Digest
Architecture Digest
Jan 4, 2020 · Backend Development

Java Concurrency: Thread Safety, Visibility, Atomicity, and Lock Mechanisms

This article provides a comprehensive overview of Java concurrency concepts, covering thread‑safety issues, variable visibility, atomic operations, the use of synchronized, volatile, ReentrantLock, ReadWriteLock, CountDownLatch, and other AQS‑based synchronizers, with code examples illustrating each mechanism.

AQSJavaLocks
0 likes · 34 min read
Java Concurrency: Thread Safety, Visibility, Atomicity, and Lock Mechanisms
Big Data Technology & Architecture
Big Data Technology & Architecture
Feb 14, 2019 · Fundamentals

Java Lock Types and Their Implementation Details

This article provides a comprehensive overview of various Java lock mechanisms—including fair, non‑fair, reentrant, read/write, biased, lightweight, heavyweight, and spin locks—explaining their classifications, usage, underlying AQS implementation, and includes illustrative code snippets for each type.

AQSJavaLocks
0 likes · 22 min read
Java Lock Types and Their Implementation Details
Java Captain
Java Captain
Jan 26, 2019 · Fundamentals

Classification and Implementation of Various Java Locks

This article explains the different types of Java locks—including fair, reentrant, exclusive, read‑write, optimistic, pessimistic, segment, biased, lightweight, heavyweight, and spin locks—describes their characteristics, usage scenarios, and provides concrete code examples for each implementation.

AQSJavaReentrantLock
0 likes · 15 min read
Classification and Implementation of Various Java Locks
Hujiang Technology
Hujiang Technology
Oct 29, 2018 · Backend Development

Implementing a Custom Java AQS Lock from Scratch

This tutorial walks through building a simple Java lock using AbstractQueuedSynchronizer (AQS), starting with a basic MyLock class, adding thread parking with Unsafe, creating a FIFO thread container, and refining lock and unlock methods to achieve correct synchronization and avoid lock starvation.

AQSJavaLock
0 likes · 15 min read
Implementing a Custom Java AQS Lock from Scratch
Java Captain
Java Captain
Aug 17, 2018 · Fundamentals

Understanding Java ReadWriteLock: Theory, Implementation, and Usage

This article explains why read‑write locks are needed, presents a simple Java implementation, and dives into the inner workings of ReentrantReadWriteLock, covering state encoding, acquisition and release algorithms, lock downgrading, and fairness policies.

AQSJavaLock
0 likes · 18 min read
Understanding Java ReadWriteLock: Theory, Implementation, and Usage
Architect's Tech Stack
Architect's Tech Stack
Aug 12, 2018 · Backend Development

Understanding and Analyzing the Implementation of Java's Semaphore

This article explains the internal workings of Java's Semaphore, detailing its AQS-based architecture, fair and non‑fair synchronization strategies, core methods such as acquire, release, and their implementations, and provides a practical example demonstrating semaphore usage for thread coordination.

AQSJavaSynchronization
0 likes · 12 min read
Understanding and Analyzing the Implementation of Java's Semaphore
Architect's Tech Stack
Architect's Tech Stack
Aug 8, 2018 · Backend Development

Deep Dive into Java AQS Shared‑Lock Implementation

This article explains the execution flow, source‑code details, and wake‑up logic of Java's AbstractQueuedSynchronizer shared‑lock mode, covering acquireShared, doAcquireShared, setHeadAndPropagate, doReleaseShared, and releaseShared methods with full code snippets and practical guidance.

AQSJavaSharedLock
0 likes · 11 min read
Deep Dive into Java AQS Shared‑Lock Implementation
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
Programmer DD
Programmer DD
Jun 11, 2018 · Fundamentals

Understanding Java’s CLH Sync Queue: How AQS Manages Threads

This article explains the internal CLH FIFO queue used by Java's AbstractQueuedSynchronizer, detailing the Node structure, how threads are enqueued with addWaiter and enq methods, and how they are dequeued to acquire synchronization state, complete with code examples and diagrams.

AQSCLH
0 likes · 7 min read
Understanding Java’s CLH Sync Queue: How AQS Manages Threads
Programmer DD
Programmer DD
Jun 10, 2018 · Backend Development

Unlocking Java Concurrency: How AQS Powers Modern Locks

This article explains the role of Java's AbstractQueuedSynchronizer (AQS) as the core framework for building locks and other synchronizers, detailing its state management, FIFO queue mechanism, and the essential methods developers need to implement custom concurrency utilities.

AQSBackendJava
0 likes · 7 min read
Unlocking Java Concurrency: How AQS Powers Modern Locks
21CTO
21CTO
May 9, 2018 · Backend Development

Why Use Locks? Deep Dive into Java Synchronization, Volatile, and AQS

This article explains why locks are needed in concurrent programming, explores the fundamentals of volatile and synchronized, details monitor mechanisms, lock optimizations like biased and lightweight locks, compares CAS and AQS, and illustrates Java lock implementations with diagrams and code examples.

AQSCASJava
0 likes · 11 min read
Why Use Locks? Deep Dive into Java Synchronization, Volatile, and AQS
Java Captain
Java Captain
May 8, 2018 · Fundamentals

Understanding Java Locks: volatile, synchronized, Monitor, CAS, and AQS

This article explains why locks are needed in Java, describes the fundamentals of volatile and synchronized, details monitor-based synchronization, explores lock optimizations such as biased and lightweight locks, and covers CAS and the AbstractQueuedSynchronizer framework for building concurrent structures.

AQSCASJava
0 likes · 12 min read
Understanding Java Locks: volatile, synchronized, Monitor, CAS, and AQS
Architecture Digest
Architecture Digest
Nov 17, 2017 · Backend Development

A Comprehensive Overview of Java Concurrency Programming

This article provides a high‑level summary of Java concurrency, covering thread creation methods, thread models, thread pools, Future and CompletableFuture, the Fork/Join framework, volatile, CAS, AQS, synchronized locks, and concurrent queue implementations, with code examples and reference links for deeper study.

AQSCASFuture
0 likes · 39 min read
A Comprehensive Overview of Java Concurrency Programming