Concurrent Separation Logic

Concurrent separation logic uses invariants and ghost resources to connect local thread proofs. Iris makes these obligations explicit through a semantics of resource composition.

Source
Anbloq
Language
English
Created
Updated
Chapters
3
Reading time
2 min
In this article3 chapters
  1. Ghost state records protocol knowledge
  2. An invariant ties the ghost value to memory
  3. Local proof rules still need a protocol

Ghost state records protocol knowledge

Resources can describe physical heap cells or logical facts that do not exist in machine memory. For a monotone counter, an authoritative ghost value \(n\) represents the current count. A fragment \(m\) can express a lower bound. In a resource algebra based on the maximum of natural numbers, compatible fragments combine by maximum and a valid authoritative–fragment pair satisfies

\[ \operatorname{valid}(\bullet n\cdot\circ m)\ \Longrightarrow\ m\le n. \]

Increasing the authoritative value preserves all previously issued lower bounds. This is an example of a frame-preserving update. Its legality is checked against resources other threads might hold, including fragments absent from the local proof context.

A mutex invariant gives a small example of state protected across handoffs. For an externally visible operation, a linearization point relates the concurrent execution to its abstract effect.

An invariant ties the ghost value to memory

Place the physical counter cell and the corresponding authoritative resource in an invariant. At an atomic increment a thread can open the invariant, relate the actual transition to a ghost update, and restore it with the new value. A thread that has retained an old lower-bound fragment can still combine it with information learned later. Opening an invariant across arbitrary steps would expose shared resources to conflicting uses. Iris uses masks and rules governing atomicity to restrict when invariants may be opened and how they are restored.

Local proof rules still need a protocol

A proof of a lock, queue or counter needs an invariant that captures the state promised by its interface. Logical atomicity can present a multi-step operation as an atomic transition to clients under a suitable specification. At the system level this relates to linearizability. The underlying heap split comes from separation logic, while the machine-level interpretation of atomic accesses depends on the memory model.[1]

References

  1. Ralf Jung et al., Iris from the Ground Up: A Modular Foundation for Higher-Order Concurrent Separation Logic ↩