liveBook · Manning

Fine-grained locking

Fine-grained locking is a synchronization technique that protects smaller portions of shared state with separate locks, allowing independent portions to be accessed concurrently.

How 2 Manning books explain it

C++ Concurrency in Action, Second Edition

Fine-grained locking protects smaller portions of shared data with separate locks rather than one broad lock.

How it is used
Uses separate head and tail locks to increase concurrency beyond a queue protected by one mutex.
How deep it goes
Works through a linked-queue baseline, dummy-node redesign, two-mutex implementation, and condition-variable waiting.
Examples
Compares single-mutex and linked queues, then uses push, try_pop, and wait_and_pop implementations to expose lock boundaries.
What you can do after
Build it from scratch as a C++ queue whose producers and consumers can work at opposite ends under separate locks.

Read how C++ Concurrency in Action, Second Edition explains fine-grained locking →

Latency

Fine-grained locking is a synchronization technique that protects smaller portions of shared work or state with more numerous locks.

How it is used
Uses smaller lock scopes to increase concurrency and reduce contention in thread-based low-latency systems.
How deep it goes
Explains the coarse-versus-fine trade-off and convoying mitigation, but stops short of implementation details or correctness techniques.
Examples
Uses thread-based concurrency, kernel scheduling, context switching, and lock convoying as practical performance contexts.
What you can do after
Apply it to reduce lock contention and critical-section duration, while recognizing added complexity and synchronization overhead.

Read how Latency explains fine-grained locking →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.