Tag

non-fair lock

1 views collected around this technical thread.

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.

AQSFair LockJUC
0 likes · 19 min read
Deep Dive into ReentrantLock: Fair Lock vs Non-Fair Lock Implementation Principles
IT Architects Alliance
IT Architects Alliance
Jul 19, 2022 · Fundamentals

Understanding CAS, AQS, and Fair vs Non‑Fair Locks in Java

This article explains the principles of CAS, the ABA problem, and how Java's AbstractQueuedSynchronizer underpins ReentrantLock, comparing fair and non‑fair lock implementations, with code examples and discussion of their performance trade‑offs in.

AQSCASFair Lock
0 likes · 8 min read
Understanding CAS, AQS, and Fair vs Non‑Fair Locks in Java