Partial Orders for Efficient BMC of Concurrent Software

Jade Alglave, Daniel Kroening, Michael TautschnigarXiv 2013

Abstract

The vast number of interleavings that a concurrent program can have is typically identified as the root cause of the difficulty of automatic analysis of concurrent software. Weak memory is generally believed to make this problem even harder. We address both issues by modelling programs' executions with partial orders rather than the interleaving semantics (SC). We implemented a software analysis tool based on these ideas. It scales to programs of sufficient size to achieve first-time formal verification of non-trivial concurrent systems code over a wide range of models, including SC, Intel x86 and IBM Power.

Introduction

Verifying concurrent programs is notoriously difficult due to two major hurdles. First, the Interleaving Explosion: traditional tools assume Sequential Consistency (SC), where execution is a total order of instructions. As threads grow, the number of possible interleavings explodes exponentially. Second, Unrealistic Hardware Assumptions: modern processors (x86, Power) use weak memory models that allow instruction reordering. Tools restricted to SC miss critical, architecture-specific bugs.

Methodology: From Interleavings to Partial Orders

The authors abandon the interleaving approach, instead modeling concurrent executions as partial orders using an axiomatic memory model framework. A C program is translated into a logical formula for an SMT solver, consisting of:

  1. ssa (Static Single Assignment): Captures data and control flow for each thread.
  2. pord (Partial Order): Captures inter-thread communication and memory model rules (SC, TSO, Power).
Execution of a simple concurrent program modeled as a partial order graph.

To ensure efficiency, the tool uses clock constraints to enforce orderings. Unlike previous global approaches that suffered from $O(N^6)$ complexity, this method generates constraints strictly per memory address and treats memory barriers as standalone events, keeping the math lightweight.

Experimental Evaluation

The tool was evaluated against synthetic benchmarks and real-world systems code, including 4,500 "litmus tests"—small programs designed to expose weak memory artifacts.

A four-thread litmus test (IRIW) illustrating complex reads-from (rf) and from-read (fr) relations.

Key Results

  • Scalability: On the Fibonacci benchmark, the tool scaled to N=300 loop unrollings, while competitors timed out at N=10.
  • Speed: It verified all 4,500 litmus tests in an average of 0.22 seconds each.
  • Real-World Impact: The tool confirmed a subtle bug in PostgreSQL and achieved first-time formal verification of the Linux RCU mechanism and Apache’s fdqueue module (~28,000 lines of code) in under 3 seconds.

Discussion and Insights

A key insight is that verifying against weak memory models can be faster than SC because relaxed ordering rules result in fewer constraints for the solver. Furthermore, the paper demonstrates that simulating every sequence of states is unnecessary; formulating the problem as a consensus of partial orders is computationally superior.

While the tool relies on Bounded Model Checking (BMC) and loop unrolling, it remains sound for natively bounded loops. Future work aims to incorporate over-approximation techniques to handle unbounded loops efficiently.

Summary updated

BibTeX
@misc{alglave2013partial,
  author = {Jade Alglave and Daniel Kroening and Michael Tautschnig},
  title = {{Partial Orders for Efficient BMC of Concurrent Software}},
  year = {2013},
  eprint = {1301.1629},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1301.1629},
}
Figure