Snapshot registers, scan orders, histories, and linearizability #
Defines single-writer multi-reader registers (SnapshotReg), collect scan orders (ScanOrder),
client history records (SnapshotOpKind, SnapshotOpStatus, SnapshotOpRecord), and
Herlihy–Wing linearizability (IsSnapshotLinearization, SnapshotLinearizable) against the
canonical sequential snapshot specification (seqSnapshotValid,
[AAD+93], §2.1, Figure 1, Definition 1).
Main definitions #
Cslib.Distributed.SetAgreement.SnapshotReg,Cslib.Distributed.SetAgreement.memSnapshot,Cslib.Distributed.SetAgreement.ScanOrder,Cslib.Distributed.SetAgreement.ScanOrder.fin: single-writer registers and duplicate-free collect orders.Cslib.Distributed.SetAgreement.SnapshotOpKind,Cslib.Distributed.SetAgreement.SnapshotOpStatus,Cslib.Distributed.SetAgreement.SnapshotOpRecord: execution history records.Cslib.Distributed.SetAgreement.seqSnapshotValid,Cslib.Distributed.SetAgreement.seqSnapshotMemAfter,Cslib.Distributed.SetAgreement.IsSnapshotLinearization,Cslib.Distributed.SetAgreement.SnapshotLinearizable: sequential snapshot validity and Herlihy–Wing linearizability.
Main results #
Cslib.Distributed.SetAgreement.ScanOrder.length_eq_card: scan-order length equals|P|.Cslib.Distributed.SetAgreement.seqSnapshotValid_append: sequential replay across append.
Single-writer registers and scan orders #
Single-writer, multi-reader (SWMR) register owned by one process in the unbounded snapshot
algorithm ([AAD+93], §3, Figure 3, p. 8).
Initial register state (dInit, 0, fun _ => dInit).
Instantaneous snapshot of the data fields across all single-writer registers
(snapshot(τ_k) in [AAD+93], §3.1, p. 8).
Duplicate-free register reading order covering all processes P for collect.
Client operations, history records, and canonical snapshot linearizability #
Client operation kind on a single-writer atomic snapshot memory.
- scan {Data : Type u_1} : SnapshotOpKind Data
Instantaneous full-memory read (
ScanRequest_i). - update {Data : Type u_1} (val : Data) : SnapshotOpKind Data
Single-writer word update (
UpdateRequest_i(val)).
Completion status of a recorded client operation in an execution history.
- pending {P : Type u_1} {Data : Type u_2} : SnapshotOpStatus P Data
Invoked and not yet returned.
- doneScan {P : Type u_1} {Data : Type u_2} (respStep : ℕ) (snap : P → Data) : SnapshotOpStatus P Data
Completed
scanreturningsnapat trace transitionrespStep. - doneUpdate {P : Type u_1} {Data : Type u_2} (respStep : ℕ) : SnapshotOpStatus P Data
Completed
updatereturning at trace transitionrespStep.
Recorded operation entry in an execution history of a snapshot memory.
- caller : P
Invoking process
i : P(forupdate, also the updated cell index). - kind : SnapshotOpKind Data
- invStep : ℕ
Trace step index at which the client invoked the operation.
- status : SnapshotOpStatus P Data
Current completion status and response timestamp/payload.
Whether a recorded snapshot operation has returned.
Response step of a completed operation (none if still pending).
Sequential canonical single-writer snapshot check (Figure 1 of
[AAD+93], p. 4): replay operation indices seq from initial memory
mem : P → Data, updating mem caller := val on completed updates and verifying snap = mem on
completed scans.
Sequential memory state produced after replaying a list of operation indices from mem.
seq is a valid Herlihy–Wing linearization of snapshot history hist from initial value
dInit ([AAD+93], §2.1, Definition 1):
seqis duplicate-free (seq.Nodup) with all indices< hist.length,- every completed operation in
histappears inseq(and any other entry inseqis a pendingupdatethat has already taken effect), - real-time precedence holds (
respStep op₁ ≤ invStep op₂impliesop₁precedesop₂inseq), seqSnapshotValid (fun _ => dInit) hist seqholds.
- nodup : seq.Nodup
No operation is linearized twice.
Every index in
seqrefers to a valid entry inhist.Every completed operation in
histis linearized inseq.- realTime (i : ℕ) : i ∈ seq → ∀ j ∈ seq, ∀ (r : ℕ), hist[i]?.bind SnapshotOpRecord.respStep? = some r → ∀ (recJ : SnapshotOpRecord P Data), hist[j]? = some recJ → r ≤ recJ.invStep → List.idxOf i seq < List.idxOf j seq
Real-time order: if
ireturned at steprandjwas invoked at stepuwithr ≤ u, theniprecedesjinseq. - valid : seqSnapshotValid (fun (x : P) => dInit) hist seq
Sequential canonical single-writer snapshot validity along
seq.
An execution history hist is linearizable against the canonical single-writer snapshot
memory with initial value dInit.