Lock-free
Lock-free is a concurrency progress guarantee under which at least one operation completes within a finite number of steps despite contention, without relying on mutual-exclusion locks.
C++ Concurrency in Action, Second Edition
A progress guarantee under which, when threads continue taking steps, at least one operation completes despite contention.
- How it is used
- Provides a progress criterion for concurrent data structures that avoid mutex-protected operations.
- How deep it goes
- Defines progress guarantees and explains compare/exchange retries, then exposes unresolved reclamation in an initial stack.
- Examples
- Contrasts an atomic-flag spin-lock mutex with a compare/exchange stack whose initial pop leaks nodes.
- What you can do after
- Evaluate/understand it by checking whether concurrent operations progress and spotting starvation, hidden locks, and unsafe stack-node deletion.
Read how C++ Concurrency in Action, Second Edition explains lock-free →
Modern C, Third Edition
The lock-free property indicates that operations on an atomic type do not require a hidden lock and are indivisible with respect to signal interruption.
- How it is used
- Supports indivisible operations on shared state in asynchronous signal handlers.
- How deep it goes
- Explains observable indivisibility and demonstrates a conditional counter, without detailing how the runtime enforces it.
- Examples
- Uses a conditionally compiled atomic signal counter and contrasts it with sig_atomic_t increments.
- What you can do after
- Evaluate signal-handler counter choices and recognize when the demonstrated counter falls back to a no-op.
Latency
Lock-free synchronization is a concurrency technique that guarantees system-wide progress by ensuring that some thread completes an operation within a finite number of steps, without guaranteeing progress for every thread.
- How it is used
- Uses lock-free progress to reason about low-latency concurrent systems without requiring every thread to complete each operation.
- How deep it goes
- Defines system-wide finite progress and contrasts it with blocking and wait-free conditions, but does not detail an implementation algorithm.
- Examples
- Uses mutex waiting, long critical sections, deadlock, and competing lock acquisition to illustrate unpredictable blocking progress.
- What you can do after
- Evaluate concurrent designs by distinguishing system-wide lock-free progress from per-thread wait-free guarantees and blocking behavior.
Also covered in
- Data-Oriented Programming: Reduce software complexity
- C# Concurrency: Asynchronous and multithreaded programming
What to know first
- deadlockA deadlock is a state in which concurrent activities cannot progress because each is waiting for a resource, event, or action that depends on another blocked activity.
- lockingLocking is a synchronization technique that controls concurrent access to a shared resource or protected operation.
Related concepts
- atomicityuses · Atomicity is the property that an operation or group of operations takes effect as an indivisible whole, without observable partial effects.
- optimistic concurrency controlincludes · Optimistic concurrency control is a concurrency-control technique that allows operations to proceed with limited locking and detects conflicting changes through validation before committing updates.
- spinlockcontrasts with · A spinlock is a mutual-exclusion synchronization primitive in which a waiting thread repeatedly checks or attempts to acquire the lock rather than blocking.
- atomincludes · An atom is a Clojure reference type that supports synchronous, independent, coordinated updates to shared state without explicit locks.
- compare-and-swapuses · Compare-and-swap is an atomic operation that replaces a value with a desired value only if the current value matches an expected value.
- ImmutableInterlockedimplemented by · ImmutableInterlocked is a .NET API that provides atomic operations for updating references to immutable collections and related immutable values.
Questions about lock-free
What is lock-free?
Lock-free is a concurrency progress guarantee under which at least one operation completes within a finite number of steps despite contention, without relying on mutual-exclusion locks.
Which Manning books explain lock-free?
C++ Concurrency in Action, Second Edition, Modern C, Third Edition and Latency.
What should I know before learning lock-free?
Manning books that teach lock-free usually introduce deadlock and locking first.
What is the difference between lock-free and spinlock?
Lock-free is a concurrency progress guarantee under which at least one operation completes within a finite number of steps despite contention, without relying on mutual-exclusion locks. A spinlock is a mutual-exclusion synchronization primitive in which a waiting thread repeatedly checks or attempts to acquire the lock rather than blocking.
What kinds of lock-free are there?
Kinds of lock-free include optimistic concurrency control and atom.
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.


