liveBook · Manning

Lockless technique

As explained in 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.

Lock-free synchronization guarantees system-wide progress: within a finite number of steps, some thread completes its operation. It does not guarantee that every thread completes, making it weaker than wait-free synchronization but stronger than blocking approaches. section 8.5 section 8.5.1

Use lock-free progress conditions to reason about concurrent operations and latency:

  • Contrast blocking synchronization, where mutex ownership provides essentially no progress guarantee and waiting times can become unpredictable. section 8.5.1
  • Distinguish lock-free from wait-free: lock-free guarantees that some thread progresses, while wait-free guarantees that every thread finishes within finite time. section 8.5
  • Treat lock-free synchronization as a low-latency alternative to mutexes, spinlocks, and read–write locks, while recognizing that wait-free synchronization provides the stronger guarantee. section 8.5.1 section 8.7

Why blocking progress is weaker

A thread waiting for a mutex may be delayed by a long critical section, deadlock, or another thread acquiring the mutex first. Lock-free progress avoids requiring every thread to acquire a shared lock before some operation can complete. section 8.5.1

Figure 8.3 The relationship between different wait-free and lock-free progress conditions
Figure 8.3: The relationship between different wait-free and lock-free progress conditions.

Use the progress-condition relationship to place lock-free synchronization between blocking or starvation-free approaches and wait-free guarantees. section 8.5.1

How Latency covers it

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 it assumes
Assumes concurrency and mutex terminology while establishing the progress-condition distinctions needed to compare synchronization approaches.
What you can do after
Evaluate concurrent designs by distinguishing system-wide lock-free progress from per-thread wait-free guarantees and blocking behavior.
How it connects
Connects lock-free synchronization with wait-free synchronization, blocking, starvation-free progress, mutexes, spinlocks, and read–write locks.

Also explained in

Compare how 3 books explain lockless technique →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.