[Paper Review] New Lace and Arsenic: adventures in weak memory with a program logic
This paper presents New Lace, a program logic for weak memory concurrency based on Hoare logic within threads and rely/guarantee reasoning between threads. It introduces novel modalities—B, sofar, and ouat—to manage propagation and global coherence, enabling formal verification of weak-memory litmus tests and a token ring protocol, though it currently excludes heap, arrays, and synchronizing instructions like CAS.
We describe a program logic for weak memory (also known as relaxed memory). The logic is based on Hoare logic within a thread, and rely/guarantee between threads. It is presented via examples, giving proofs of many weak-memory litmus tests. It extends to coherence but not yet to synchronised assignment (compare-and-swap, load-logical/store-conditional). It deals with conditionals and loops but not yet arrays or heap. The logic uses a version of Hoare logic within threads, and a version of rely/guarantee between threads, with five stability rules to handle various kinds of parallelism (external, internal, propagation-free and two kinds of in-flight parallelism). There are $\mathbb{B}$ and $\mathbb{U}$ modalities to regulate propagation, and temporal modalities $\mathsf{since}$, $\mathbb{S}\mathsf{ofar}$ and $\mathbb{O}\mathsf{uat}$ to deal with global coherence (SC per location). The logic is presented by example. Proofs and unproofs of about thirty weak-memory examples, including many litmus tests in various guises, are dealt with in detail. There is a proof of a version of the token ring. In version 2: The correspondence with Herding Cats has been clarified. The stability rules have been simplified: in particular the sat and x= x tests have been eliminated from external stability checks. The embedding is simplified and has a more transparent relation to the mechanisms of the logic. Definitions of U, Sofar and Ouat have been considerably altered. The description of modalities and the treatment of termination has been reworked. Many proofs are reconstructed. A comprehensive summary of the logic is an appendix.
Motivation & Objective
- To develop a formal program logic for reasoning about weak memory models in concurrent programs.
- To address the challenges of verifying concurrent programs under relaxed memory semantics, particularly propagation and global coherence.
- To extend Hoare logic and rely/guarantee reasoning to handle weak memory behaviors without requiring full hardware-specific modeling.
- To provide a foundation for verifying concurrent algorithms like the token ring under weak memory, using a minimal yet expressive formalism.
Proposed method
- The logic uses a thread-local Hoare logic framework with five stability rules to model various forms of parallelism, including external, internal, and in-flight parallelism.
- It introduces the B modality to capture interference effects and the sofar and ouat modalities to reason about propagation and global coherence.
- The logic employs temporal modalities such as since, sofar, and ouat to express conditions on memory order and visibility across threads.
- It defines effect relations for interference and guarantee inclusion, ensuring that thread interactions are soundly modeled through logical constraints.
- The approach uses a constraint-based embedding to represent memory states and transitions, with explicit handling of composite writes and variable assignments.
- Proofs are constructed via a series of examples, including litmus tests and the token ring, demonstrating the logic’s applicability to real weak-memory patterns.
Experimental results
Research questions
- RQ1How can a program logic be designed to reason about weak memory concurrency while maintaining composability and modularity?
- RQ2What modalities are necessary to capture propagation and global coherence in weak memory models?
- RQ3Can a Hoare-style logic be extended to handle interference and rely/guarantee reasoning in the presence of relaxed memory semantics?
- RQ4How can the logic be applied to verify standard concurrent algorithms like the token ring under weak memory?
- RQ5What are the limitations of the current logic in handling real-world features such as atomic operations, heap, and compiler optimizations?
Key findings
- The logic successfully verifies a range of weak-memory litmus tests and the token ring algorithm, demonstrating its practical applicability to common concurrency patterns.
- The introduction of the sofar and ouat modalities enables reasoning about global coherence and propagation without requiring explicit memory barriers.
- The stability rules effectively model different kinds of parallelism, including in-flight and propagation-free cases, enhancing the logic’s expressiveness.
- The logic handles composite writes as atomic units, ensuring consistency in memory updates across threads.
- Despite its expressiveness, the logic currently cannot verify the RDW litmus test or handle synchronizing instructions such as CAS, lwarx/stwcx, or ldrex/strex.
- The framework is not yet soundly proven, and it lacks support for heap, arrays, and library abstraction, indicating ongoing work in these areas.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.