Abstract
Predicate abstraction is a key enabling technology for applying finite-state model checkers to programs written in mainstream languages. It has been used very successfully for debugging sequential system-level C code. Although model checking was originally designed for analyzing concurrent systems, there is little evidence of fruitful applications of predicate abstraction to shared-variable concurrent software. The goal of this paper is to close this gap. We have developed a symmetry-aware predicate abstraction strategy: it takes into account the replicated structure of C programs that consist of many threads executing the same procedure, and generates a Boolean program template whose multi-threaded execution soundly overapproximates the concurrent C program. State explosion during model checking parallel instantiations of this template can now be absorbed by exploiting symmetry. We have implemented our method in the satabs predicate abstraction framework, and demonstrate its superior performance over alternative approaches on a large range of synchronization programs.
Introduction
Model checking concurrent software is notoriously difficult due to the "state explosion problem," where the number of possible thread interleavings grows exponentially with the number of threads. While predicate abstraction—the process of simplifying complex C programs into finite-state "Boolean programs" by tracking specific logical properties—has revolutionized the verification of sequential system code, its application to concurrent software has remained limited.
The primary obstacle is the presence of mixed predicates: logical properties that reference both a thread's local variables (e.g., a loop counter i) and shared global variables (e.g., a buffer size N). Handling these predicates naively leads to a dilemma: tracking them as local variables may miss updates from other threads (unsoundness), while tracking them as shared variables loses the ability to distinguish between individual thread states (imprecision).
Symmetry-Aware Predicate Abstraction (SAPA)
This paper introduces Symmetry-Aware Predicate Abstraction (SAPA), a methodology designed to handle mixed predicates without sacrificing soundness or destroying the program's inherent symmetry. The core innovation lies in a "notify-all" broadcast mechanism.
The SAPA Workflow
- Predicate Classification: Predicates are categorized into three types: shared (referencing only globals), local (referencing only thread-locals), and mixed.
- Local Tracking of Mixed Predicates: To preserve thread-specific information, mixed predicates are stored in local Boolean variables within the abstracted program.
- Notify-All Updates (Broadcasts): When a thread performs an action that updates a shared variable involved in a mixed predicate, the abstraction generates a broadcast assignment. This instruction forces all other threads to simultaneously update their local copies of that mixed predicate, ensuring the global state remains consistent across all thread views.
- Symmetry Exploitation: By generating a "template" where every thread executes identical code, the authors can utilize symmetry reduction. Using an extended model checker (B-BOOM), the system verifies the program for many threads simultaneously by treating interchangeable threads as equivalent, rather than checking every unique interleaving.
- Aliasing and Pointer Support: The framework integrates pointer analysis to ensure that "notify-all" logic correctly identifies affected predicates even when variables are accessed via pointers.
Experimental Evaluation
The SAPA method was implemented within the satabs framework and evaluated against a suite of 14 concurrent C programs, including:
- Synchronization Primitives: Ticket Locks and Test-and-Set (TAS) Locks.
- Concurrent Data Structures: Thread-safe stacks and counters utilizing both lock-based and lock-free (Compare-and-Swap) logic.
- Parallel Algorithms: The
FindMaxalgorithm, which uses parallel reduction to find the maximum element in an array.
These benchmarks represent the high-concurrency, low-level code typically found in OS kernels and systems libraries—environments where concurrency bugs are most prevalent and difficult to detect.
Key Results and Insights
Scalability and Performance
The SAPA approach significantly outperformed Symmetry-Oblivious Predicate Abstraction (SOPA). In the Increment benchmark, SAPA successfully verified 20 threads in under an hour. In contrast, the symmetry-oblivious approach timed out after reaching only 10 threads. Because the abstraction is performed at the template level, the time required to generate the Boolean program is independent of the total number of threads.
The Necessity of Mixed Predicates
The research demonstrates that for many concurrent programs, correctness cannot be proven without the use of mixed predicates. Attempts to use "naive" or unsound handling of these predicates resulted in either a failure to find injected bugs or "refinement failures," where the abstraction was too coarse to be useful. The "notify-all" logic proved essential for reliable, sound verification.
Precision vs. Computational Cost
Updating the state of passive threads based on the actions of an active thread is computationally expensive. The authors identified a "sweet spot" for precision: allowing update logic to see the shared state and the local states of both the active and passive threads provides sufficient detail for verification without overwhelming the model checker.
Limitations and Future Directions
While SAPA represents a major step forward, several challenges remain:
- Memory Models: The current implementation assumes sequential consistency. Extending the framework to handle "weak memory models" (such as TSO or PowerPC), which allow for more complex interleavings, is a primary goal for future work.
- Refinement Complexity: Automatically refining the broadcast logic when an abstraction is too coarse remains a difficult technical problem.
- Broadcast Overhead: In specific lock-free scenarios (e.g., the
Prngbenchmark), the high frequency of broadcast operations can occasionally slow the model checker compared to simpler, less precise methods.
Conclusion
By introducing a symmetry-aware strategy that correctly handles mixed predicates through broadcast updates, this work bridges the gap between predicate abstraction and concurrent software verification. The result is a framework capable of verifying complex, multi-threaded C code with a level of scalability previously unattainable through symmetry-oblivious methods.
Summary updated