Skip to main content
QUICK REVIEW

[Paper Review] Herding Cats - Modelling, simulation, testing, and data-mining for weak memory

Jade Alglave, Luc Maranget|arXiv (Cornell University)|Aug 30, 2013
Parallel Computing and Optimization TechniquesComputer Science48 references14 citations
TL;DR

This paper presents an axiomatic, generic framework for modeling weak memory behaviors across architectures like Power, ARM, x86-TSO, and C++ release-acquire semantics. It introduces the herd simulator and mole analysis tool, demonstrating superior performance in simulation and verification, and identifies hardware-level anomalies in ARM that were later acknowledged as bugs.

ABSTRACT

We propose an axiomatic generic framework for modelling weak memory. We show how to instantiate this framework for SC, TSO, C++ restricted to release-acquire atomics, and Power. For Power, we compare our model to a preceding operational model in which we found a flaw. To do so, we define an operational model that we show equivalent to our axiomatic model. We also propose a model for ARM. Our testing on this architecture revealed a behaviour later acknowledged as a bug by ARM, and more recently 33 additional anomalies. We offer a new simulation tool, called herd, which allows the user to specify the model of his choice in a concise way. Given a specification of a model, the tool becomes a simulator for that model. The tool relies on an axiomatic description; this choice allows us to outperform all previous simulation tools. Additionally, we confirm that verification time is vastly improved, in the case of bounded model-checking. Finally, we put our models in perspective, in the light of empirical data obtained by analysing the C and C++ code of a Debian Linux distribution. We present our new analysis tool, called mole, which explores a piece of code to find the weak memory idioms that it uses.

Motivation & Objective

  • To develop a unified, concise, and formally rigorous axiomatic framework for modeling weak memory across diverse architectures and high-level languages.
  • To address flaws in existing operational models of Power and ARM, particularly those leading to incorrect or undefined behaviors.
  • To enable efficient simulation and bounded model-checking by leveraging axiomatic descriptions over operational ones.
  • To analyze real-world C and C++ codebases (e.g., Debian Linux) to identify prevalent weak memory idioms and their implications.
  • To validate models against hardware behavior and architectural intent, ensuring practical relevance and correctness.

Proposed method

  • Propose a generic axiomatic framework that defines memory models through constraints on relations between memory accesses (e.g., happens-before, dependency, ordering).
  • Instantiate the framework for SC, TSO, C++ release-acquire, Power, and ARM, ensuring consistency and correctness across models.
  • Construct an operational model for Power that is proven equivalent to the axiomatic model, correcting a flaw in a prior operational model.
  • Implement the herd simulator, which uses the axiomatic model to efficiently simulate program behaviors across different memory models.
  • Develop the mole tool to statically analyze C/C++ codebases and extract weak memory idioms, such as release-acquire patterns and critical cycles.
  • Use bounded model-checking with CBMC to verify programs under the new axiomatic models, achieving significant performance improvements over operational approaches.

Experimental results

Research questions

  • RQ1Can a single, generic axiomatic framework model diverse weak memory behaviors across Power, ARM, x86-TSO, and C++ release-acquire semantics?
  • RQ2How can axiomatic models outperform operational models in simulation and verification efficiency?
  • RQ3What flaws exist in prior operational models of Power, and can they be corrected via an equivalent axiomatic formulation?
  • RQ4To what extent do real-world C/C++ codebases use weak memory idioms, and which patterns are most prevalent?
  • RQ5Do the proposed models align with architectural intent and actual hardware behavior, including known edge cases and bugs?

Key findings

  • The axiomatic framework successfully models SC, TSO, C++ release-acquire, Power, and ARM with a consistent, concise syntax, enabling model reuse and comparison.
  • The herd simulator, based on the axiomatic model, achieves significantly faster simulation and verification times compared to prior operational tools.
  • A flaw was identified in a prior operational Power model, corrected by constructing an equivalent operational model based on the new axiomatic framework.
  • The mole tool analyzed 200 million lines of Debian Linux code and revealed widespread use of release-acquire patterns, with real instances of critical cycles confirmed as genuine.
  • Testing on ARM uncovered 33 unexpected behaviors, later acknowledged as bugs by ARM, validating the model’s sensitivity to real hardware quirks.
  • The new models correctly prevent out-of-thin-air values and support stronger acyclicity guarantees than C++, aligning better with modular reasoning principles.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.