The Complexity of Testing Message-Passing Concurrency
Zheng Shi, Lasse Møldrup, Umang Mathur, Andreas Pavlogiannis
TL;DR
This work initiates a systematic complexity analysis of consistency testing for channel-based message-passing concurrency, parameterized by thread count, channel count, and channel capacities. It introduces two problems, VCh and VCh-rf, and develops frontier-graph based algorithms that yield tractable upper bounds when parameters are fixed, while establishing strong hardness results (including NP-hardness and OV-based lower bounds) in several natural regimes. The authors also provide linear-time solutions for fully synchronous channels and quadratic-time solutions on acyclic topologies, together with SETH-based lower bounds that pinpoint optimality of the approaches in those cases. An extensive empirical evaluation demonstrates that frontier-graph methods, especially when augmented with saturation, outperform SMT-based encodings on real Go benchmark traces and scale to large instances. Overall, the paper delineates a sharp boundary between tractable and intractable channel-consistency verification and offers practical algorithms for conjunction with predictive testing and model-checking workflows.
Abstract
A key computational question underpinning the automated testing and verification of concurrent programs is the consistency question - given a partial execution history, can it be completed in a consistent manner? Due to its importance, consistency testing has been studied extensively for memory models, as well as for database isolation levels. A common theme in all these settings is the use of shared-memory as the primal mode of interthread communication. On the other hand, modern programming languages, such as Go, Rust and Kotlin, advocate a paradigm shift towards channel-based (i.e., message-passing) communication. However, the consistency question for channel-based concurrency is currently poorly understood. In this paper we lift the study of fundamental consistency problems to channels, taking into account various input parameters, such as the number of threads executing, the number of channels, and the channel capacities. We draw a rich complexity landscape, including upper bounds that become polynomial when certain input parameters are fixed, as well as hardness lower bounds. Our upper bounds are based on algorithms that can drive the verification of channel consistency in automated verification tools. Our lower bounds characterize minimal input parameters that are sufficient for hardness to arise, and thus shed light on the intricacies of testing channel-based concurrency. In combination, our upper and lower bounds characterize the boundary of tractability/intractability of verifying channel consistency, and imply that our algorithms are often (nearly) optimal.
