Concurrent histories, real-time precedence, and linearizability definitions #
Core definitions and basic structural properties for concurrent invocation/response histories over multiple typed shared objects ([HW90], §§2.1–2.2, §3.3, pp. 467–472) with the amended L2 condition of [SHP21] (§4, Definition 4.1, p. 6).
Main definitions #
Cslib.Distributed.ConcurrentObjects.Event,Cslib.Distributed.ConcurrentObjects.History: invocation and response events and finite execution histories over processesPand object-indexed operationsOp/ responsesResp.Cslib.Distributed.ConcurrentObjects.History.procSubhistory,Cslib.Distributed.ConcurrentObjects.History.objSubhistory: process (H | P) and object (H | x) subhistory projections ([HW90], §2.1, p. 467).Cslib.Distributed.ConcurrentObjects.History.IsSequential,Cslib.Distributed.ConcurrentObjects.History.WellFormed,Cslib.Distributed.ConcurrentObjects.History.Equivalent,Cslib.Distributed.ConcurrentObjects.History.complete,Cslib.Distributed.ConcurrentObjects.History.IsExtension: sequentiality, per-process well-formedness, process-subhistory equivalence, maximal completed subhistorycomplete(H), and response-append extensions ([HW90], §§2.1–2.2, pp. 467–469).Cslib.Distributed.ConcurrentObjects.OpId,Cslib.Distributed.ConcurrentObjects.History.IsCompletedOp,Cslib.Distributed.ConcurrentObjects.History.prec: per-process operation identifiers(proc, idx)and the irreflexive real-time precedence partial order<_H([HW90], §2.2, p. 468).Cslib.Distributed.ConcurrentObjects.SeqSpec,Cslib.Distributed.ConcurrentObjects.SeqSpec.ofMachine,Cslib.Distributed.ConcurrentObjects.SeqSpec.IsTotalOp,Cslib.Distributed.ConcurrentObjects.History.IsLegal: prefix-closed single-object sequential specifications, deterministic state-machine specifications, total operations, and legal sequential histories ([HW90], §2.1, p. 468).Cslib.Distributed.ConcurrentObjects.IsLinearizable,Cslib.Distributed.ConcurrentObjects.IsSequentiallyConsistent: Herlihy–Wing linearizability ([HW90], §2.2, p. 469; amended L2 of [SHP21], §4, Definition 4.1, p. 6) and sequential consistency (extending [HW90], §3.3, p. 472 to incomplete histories viaHistory.IsExtensionandHistory.complete).
Main results #
Cslib.Distributed.ConcurrentObjects.History.prec_irrefl,Cslib.Distributed.ConcurrentObjects.History.prec_trans,Cslib.Distributed.ConcurrentObjects.History.isIntervalOrder_prec_completed:<_His a strict partial order and forms aRelation.IsIntervalOrderon completed operations.Cslib.Distributed.ConcurrentObjects.IsLinearizable.isSequentiallyConsistent: every linearizable history is sequentially consistent (after [HW90], §3.3, p. 472).
References #
Events, histories, and subhistory projections #
A single invocation or response event in a concurrent object history ([HW90], §2.1,
p. 467), parameterized by process type P, object index type Obj, and per-object operation and
response families Op and Resp.
Process subhistory H | p ([HW90], §2.1, p. 467): the subsequence of all events in
H whose process is p.
Object subhistory H | x ([HW90], §2.1, p. 467): the subsequence of all events in
H whose object is x.
Process and object subhistory projections commute.
Object subhistory projection is idempotent.
Projecting onto two distinct objects yields the empty history.
If every event of H targets x, then H | x = H.
If no event of H targets x, then H | x = [].
Two histories are equivalent if they have identical process subhistories for every process p
([HW90], §2.1, p. 467).
Reflexivity of History.Equivalent.
Symmetry of History.Equivalent.
Transitivity of History.Equivalent.
Equivalent histories have equivalent object subhistories on every object x.
Sequential history ([HW90], §2.1, p. 467): starts with an invocation (when nonempty),
alternates invocations with immediately matching responses (proc and obj agree), and optionally
ends with a single pending invocation.
Instances For
A history is well-formed if every process subhistory H | p is sequential
([HW90], §2.1, p. 467).
The empty history is well-formed.
Restricting a sequential history to a single object preserves sequentiality.
Restricting a well-formed history to a single object preserves well-formedness.
Process subhistory commutes with List.flatMap OpCall.toEvents.
Object subhistory commutes with List.flatMap OpCall.toEvents.
Expanding any list of completed OpCalls yields a well-formed history.
Every sequential history decomposes into completed OpCalls optionally followed by one
trailing pending invocation.
Every even-length sequential history is the expansion of a list of completed OpCalls.
Appending a matched [inv, resp] pair to an even-length sequential history preserves
sequentiality.
Maximal completed subhistory complete(H) ([HW90], §2.1, p. 467): drops pending
invocations (those with no subsequent event of the same process) while retaining all matched
invocations and responses.
Process subhistory commutes with History.complete.
Completing a sequential history yields an even-length sequential history.
An even-length sequential history has no pending invocations, so complete H = H.
Completing a well-formed history preserves well-formedness.
On well-formed histories, complete commutes with object subhistory projection.
Extensions by response events #
H' is a well-formed completion extension of H obtained by appending zero or more response
events ([HW90], §2.2, p. 469).
Every well-formed history is a trivial extension of itself.
Operation positions and real-time precedence <_H #
Position in H of the n-th event belonging to process p (none if p has at most n
events in H).
e is a completed operation in H when its matching response is present in H
(2 * e.idx + 1 < (H | e.proc).length).
Real-time precedence e₀ <_H e₁ ([HW90], §2.2, p. 468): the response of e₀
strictly precedes the invocation of e₁ in H.
e is completed in H iff 2 * e.idx + 1 < (H | e.proc).length.
Equivalent histories have the same set of completed operations.
Every operation with a response at index r has an earlier invocation at some index i < r.
Real-time precedence <_H is transitive ([HW90], §2.2, p. 468).
On the subtype of completed operations of H, real-time precedence <_H forms a
Relation.IsIntervalOrder (Cslib.Foundations.Relation.Defs).
Completed operations of the same process are ordered in <_H by their invocation index.
Sequential specification, legality, linearizability, and sequential consistency #
A sequential specification for object x : Obj ([HW90], §2.1, p. 468): a
nonempty, prefix-closed set of single-object sequential histories on x.
Set of allowed single-object sequential histories for
x.The empty history is allowed.
Every allowed history contains only events for object
x.Every allowed history is sequential.
Prefix-closure ([HW90], §2.1, p. 468).
Evaluate a single-object sequential history on x against a deterministic state machine
(s, step), permitting an optional trailing pending invocation so the resulting set is event-wise
prefix-closed.
Construct a SeqSpec for object x from a deterministic sequential state machine
(init, step).
An operation op : Op x is total for spec ([HW90], §2.1, p. 468 & §3.2,
Theorem 2, p. 471) if every complete legal history of x can be extended by op for any invoking
process p with some valid response res.
Every operation of a deterministic total state machine SeqSpec.ofMachine is total.
A sequential history S is legal with respect to spec if for every object x,
History.objSubhistory S x belongs to (spec x).allowed ([HW90], §2.1, p. 468).
Linearizability ([HW90], §2.2, p. 469, with the amended L2 condition of
[SHP21], §4, Definition 4.1, p. 6): history H can be extended by appending zero
or more responses to a well-formed history H' such that:
- L1:
complete(H')is equivalent to some legal sequential historyS, and - L2: real-time precedence
<_H(History.prec H) on all operations completed inH'(History.IsCompletedOp H', equivalently<_{H'} ⊆ <_SbyHistory.prec_append_resp_iff) is preserved by<_S.
Unlike the literal printed L2 in [HW90] (which restricts <_H to operations already
completed in H and fails locality and nonblocking; see [SHP21], §§3.2–3.3,
pp. 5–6), History.prec H e₀ e₁ sees invocations e₁ pending in H and IsLinearizable enforces
precedence across all operations completed in the extension H'.
Sequential consistency (extending [HW90], §3.3, p. 472 to incomplete histories
via History.IsExtension and History.complete in parallel with IsLinearizable, coinciding with
§3.3 on complete histories): history H can be extended by appending zero or more responses to a
well-formed history H' such that complete(H') is equivalent to some legal sequential history S
(preserving per-process program order without requiring cross-process real-time precedence
<_H ⊆ <_S).
Every linearizable history is sequentially consistent (after [HW90], §3.3, p. 472).