The Non-Blocking Progress Hierarchy: Wait-Freedom, Lock-Freedom, and Obstruction-Freedom #
This module formalizes the three classical non-blocking progress conditions for asynchronous
shared-memory concurrent object implementations over processes P ([Her91], §§2.2–2.3,
pp. 128–129; [HLM03], §1, pp. 1–2; [MS04], §1.1.3, pp. 1-5–1-6):
- Wait-freedom (
ProgressSystem.IsWaitFree): in every infinite execution starting from a reachable state, any processpwith a pending operation that takes infinitely many implementation steps eventually completes an operation. - Lock-freedom (
ProgressSystem.IsLockFree): in every infinite execution starting from a reachable state in which infinitely many implementation steps are taken, infinitely many operations complete. - Obstruction-freedom (
ProgressSystem.IsObstructionFree): from every reachable state, any processpwith a pending operation completes within finitely many steps when scheduled in isolation (soloIter).
Unlike Cslib.Distributed.SharedMemory.Protocol (which models one-shot consensus where each
process decides once and halts), ProgressSystem separates relational new-operation invocations by
idle processes (Invoke) from a deterministic, always-enabled per-process implementation step
(step : State → P → State × Bool), capturing long-lived concurrent objects where fast processes
may repeatedly invoke and complete new operations while a slow process retries. Because active
implementation steps cannot be passively disabled, passive conditional or lock waiting is modeled as
spin-waiting (.exec p false): consequently, [Her91] §2.3 (p. 129)'s non-blocking Condition
(2) follows from Condition (1) via IsWaitFree.isObstructionFree, and IsObstructionFree inspects
the unique solo trajectory soloIter rather than quantifying over nondeterministic solo runs.
Main definitions #
Cslib.Distributed.ConcurrentObjects.StepLabel: transition label (invokeorexec).Cslib.Distributed.ConcurrentObjects.ProgressSystem: asynchronous concurrent-object transition system with relational invocations and deterministic per-process implementation steps overCslib.LTS.Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsWaitFree,Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsLockFree,Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsObstructionFree: the three non-blocking progress properties.Cslib.Distributed.ConcurrentObjects.atomicIncSystem: single-step atomic increment witness.Cslib.Distributed.ConcurrentObjects.casCounterSystem: original two-stepCASfetch-and-increment counter model illustratingCAS-loop starvation ([MS04], §1.1.3, p. 1-6).Cslib.Distributed.ConcurrentObjects.racingClaimSystem: original minimal two-step shared-register claim-and-verify model isolating two-thread contention livelock ([HLM03], §1, pp. 1–2).
Main results #
Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsWaitFree.isLockFree: in a deterministicProgressSystemover[Finite P], wait-freedom implies lock-freedom (after [MS04], §1.1.3, p. 1-5).Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsLockFree.isObstructionFree,Cslib.Distributed.ConcurrentObjects.ProgressSystem.IsWaitFree.isObstructionFree: in a deterministicProgressSystem, lock-freedom and wait-freedom imply obstruction-freedom (for arbitraryP, without finiteness).Cslib.Distributed.ConcurrentObjects.ProgressSystem.isLockFree_of_bounded_shared_changes: original reusable lock-freedom criterion for optimisticCASimplementations (shared bycasCounterSystemandTreiberStack).Cslib.Distributed.ConcurrentObjects.casCounterSystem_isLockFree,Cslib.Distributed.ConcurrentObjects.casCounterSystem_not_isWaitFree,Cslib.Distributed.ConcurrentObjects.exists_lockFree_not_waitFree: concrete strict separation of lock-freedom from wait-freedom.Cslib.Distributed.ConcurrentObjects.racingClaimSystem_isObstructionFree,Cslib.Distributed.ConcurrentObjects.racingClaimSystem_not_isLockFree,Cslib.Distributed.ConcurrentObjects.exists_obstructionFree_not_lockFree: concrete strict separation of obstruction-freedom from lock-freedom.
References #
Label of an asynchronous step in a ProgressSystem: either an idle process proc invoking a
new operation, or an active process proc executing one implementation step (which finishes its
pending operation iff completed = true).
Process taking the step.
Whether the step is an implementation step (rather than a new invocation).
Whether the step completes a pending operation.
Operational transition system of a concurrent shared-memory object implementation over
processes P with per-process pending operations ([Her91], §§2.2–2.3, pp. 128–129;
[HLM03], §1, pp. 1–2; [MS04], §1.1.3, pp. 1-5–1-6). Invocations
Invoke are relational, whereas step : State → P → State × Bool is deterministic and always
enabled whenever Active s p holds (modeling passive lock or conditional waiting via non-completing
spin steps .exec p false, so each active process has a unique soloIter trajectory).
- State : Type u
Global configuration (shared memory together with per-process local execution phases).
- init : self.State
Initial global configuration.
Active s pholds when processphas an uncompleted pending operation in states.Invoke s p s'transitions idle processpinto a new pending operation in states'.step s p = (s', done)executes one implementation step of active processp, returning the successor states'and whetherp's pending operation completed (done = true).Only an idle process may invoke a new operation.
- active_after_invoke {s : self.State} {p : P} {s' : self.State} : self.Invoke s p s' → self.Active s' p
Invoking an operation makes
pactive. - invoke_frame_active {s : self.State} {p q : P} {s' : self.State} : self.Invoke s p s' → q ≠ p → (self.Active s' q ↔ self.Active s q)
An invocation by
pdoes not change whether any other processq ≠ pis active. - active_after_step_false {s : self.State} {p : P} : self.Active s p → (self.step s p).2 = false → self.Active (self.step s p).1 p
A non-completing step (
done = false) keepspactive. - idle_after_step_true {s : self.State} {p : P} : self.Active s p → (self.step s p).2 = true → ¬self.Active (self.step s p).1 p
A completing step (
done = true) returnspto idle. - step_frame_active {s : self.State} {p q : P} : self.Active s p → q ≠ p → (self.Active (self.step s p).1 q ↔ self.Active s q)
An implementation step by
pdoes not change whether any other processq ≠ pis active.
Labelled transition system of a ProgressSystem.
State s is reachable from sys.init via a finite sequence of invocations and implementation
steps.
An infinite execution of sys starting from a reachable state states 0.
Sequence of global states visited along the execution.
Sequence of transition labels taken along the execution.
Every index
nis a valid transitionTr (states n) (labels n) (states (n + 1)).
State reached after k solo implementation steps of process p starting from s.
Wait-freedom ([Her91], §2.3, p. 129; [MS04], §1.1.3, p. 1-5): in every
infinite execution from a reachable state, if process p has a pending operation at index t₀ and
takes infinitely many implementation steps at or after t₀, then p completes its pending
operation at some index n ≥ t₀.
Lock-freedom ([HLM03], §1, p. 1; [MS04], §1.1.3, p. 1-5): in every infinite execution from a reachable state in which infinitely many implementation steps are taken, infinitely many operations complete.
Obstruction-freedom ([HLM03], §1, p. 1; [MS04], §1.1.3,
p. 1-5): from every reachable state s, any active process p completes its pending operation
within finitely many steps when scheduled in isolation.
Preservation of active status without completions and finite-process properties #
If no operation completes in [n₁, n₂), any process active at n₁ remains active at n₂.
Without completions in [N, ∞), no process can invoke more than once at or after N.
Over finitely many processes [Finite P], if no operation completes at or after N, then
eventually every transition is an implementation step (.exec).
Over finitely many processes [Finite P], every infinite execution takes infinitely many
implementation steps (.exec).
The Non-Blocking Progress Hierarchy (IsWaitFree → IsLockFree → IsObstructionFree) #
In a deterministic ProgressSystem over finitely many processes ([Finite P]), wait-freedom
implies lock-freedom (after [MS04], §1.1.3, p. 1-5): in any infinite execution taking
infinitely many implementation steps, some process steps infinitely often by infinite pigeonhole
(Finite.exists_infinite_fiber) and therefore completes infinitely often.
In a deterministic ProgressSystem, lock-freedom implies obstruction-freedom (after
[HLM03], §1, p. 1; [MS04], §1.1.3, p. 1-5): if an active process p
failed to complete in every finite prefix of its solo trajectory soloIter from a reachable state
s, scheduling p forever in isolation would yield a valid infinite execution with zero
completions.
In a deterministic ProgressSystem over arbitrary P (including infinite process sets,
without [Finite P]), wait-freedom implies obstruction-freedom (after [Her91], §2.3, p. 129;
[MS04], §1.1.3, p. 1-5): scheduling an active process p along its always-enabled solo
trajectory soloIter gives p infinitely many implementation steps, so IsWaitFree forces p to
complete at some step n.
Reusable bounded-shared-change engine for lock-free CAS implementations #
Concrete separating shared-memory implementations #
Wait-free single-step atomic increment system over processes P.
Single-step atomic increment is wait-free.
Separating Lock-Freedom from Wait-Freedom: Two-Step CAS Counter #
Local execution phase of a process in the two-step CAS fetch-and-increment counter
([MS04], §1.1.3, p. 1-6).
- idle : CASCounterPhase
No pending operation.
- readCounter : CASCounterPhase
Ready to read the current value of the shared counter.
- tryCAS (expected : ℕ) : CASCounterPhase
Read
expectedfrom the shared counter; ready to executeCAS(&counter, expected, expected + 1), retrying fromreadCounteron failure.
Global configuration of the two-step CAS fetch-and-increment counter over processes P.
- counter : ℕ
Shared
CASregister holding the current counter value. - threads : P → CASCounterPhase
Per-process local control phase.
Original two-step optimistic CAS fetch-and-increment counter model (illustrating the CAS
retry-loop starvation mechanism discussed in [MS04], §1.1.3, p. 1-6):
each operation reads c := counter in one step and attempts CAS(&counter, c, c + 1) in the next,
retrying from readCounter whenever a concurrent CAS has modified counter.
Original lock-freedom proof for casCounterSystem over finitely many processes ([Finite P],
illustrating [MS04], §1.1.3, p. 1-6).
Original CAS-starvation witness over [Nontrivial P] (illustrating [MS04], §1.1.3,
p. 1-6): casCounterSystem P is not wait-free because a fast process repeatedly invoking,
reading, and succeeding at CAS starves a slow process whose CAS continually sees a stale
counter value and retries forever.
Original concrete ProgressSystem separation of lock-freedom from wait-freedom (illustrating
[MS04], §1.1.3, p. 1-6): there exists a finite-process concurrent-object transition
system that is lock-free yet not wait-free.
Separating Obstruction-Freedom from Lock-Freedom: Racing Claim-and-Verify Protocol #
Local execution phase of a process in the original minimal shared-register claim-and-verify witness isolating two-thread contention livelock ([HLM03], §1, pp. 1–2).
- idle : ClaimPhase
No pending operation.
- writeClaim : ClaimPhase
Ready to write own process ID into the shared
ownerregister. - verifyClaim : ClaimPhase
Wrote own ID into
owner; ready to verifyowner = some pand complete if uncontested, or retry fromwriteClaimif overwritten by a concurrent process.
Global configuration of the racing shared-register claim-and-verify protocol over P.
- owner : Option P
Shared atomic register recording the last process to execute
writeClaim. - threads : P → ClaimPhase
Per-process local control phase.
Original minimal shared-register claim-and-verify system (isolating the two-thread livelock
mechanism discussed in [HLM03], §1, pp. 1–2): an active process writes its ID to
owner (writeClaim) and completes on the next step (verifyClaim) iff no other process overwrote
owner in between; otherwise it retries from writeClaim.
Original obstruction-freedom proof for racingClaimSystem (illustrating
[HLM03], §1, p. 1): from any state, any active process p completes within at
most 3 solo steps (k ∈ {0, 1, 2}).
Original two-thread livelock witness over [Nontrivial P] (illustrating
[HLM03], §1, pp. 1–2): racingClaimSystem P is not lock-free because two
active processes alternating writeClaim and verifyClaim out of phase overwrite each other's
claim on every cycle so neither operation ever completes.
Original concrete ProgressSystem separation of obstruction-freedom from lock-freedom
(illustrating [HLM03], §1, pp. 1–2): there exists a finite-process
concurrent-object transition system that is obstruction-free yet not lock-free.