Decidable Models of Recursive Asynchronous Concurrency

Jonathan Kochems, C.-h. Luke OngarXiv 2014

Abstract

Asynchronously communicating pushdown systems (ACPS) that satisfy the empty-stack constraint are a popular decidable model for recursive programs with asynchronous atomic procedure calls. We study a relaxation of the empty-stack constraint for ACPS that permits concurrency and communication actions at any stack height, called the shaped stack constraint, thus enabling a larger class of concurrent programs to be modelled. We establish a close connection between ACPS with shaped stacks and a novel extension of Petri nets: Nets with Nested Coloured Tokens (NNCTs). Tokens in NNCTs are of two types: simple and complex. Complex tokens carry an arbitrary number of coloured tokens. The rules of NNCT can synchronise complex and simple tokens, inject coloured tokens into a complex token, and eject all tokens of a specified set of colours to predefined places. We show that the coverability problem for NNCTs is Tower-complete. To our knowledge, NNCT is the first extension of Petri nets, in the class of nets with an infinite set of token types, that has primitive recursive coverability. This result implies Tower-completeness of coverability for ACPS with shaped stacks.

Introduction

Modern software—from web servers to distributed systems—relies heavily on asynchronous programming, where recursive procedures call each other and communicate via message passing. Verifying that these programs are safe (e.g., "will this server ever reach an error state?") is notoriously difficult.

The standard mathematical model for this, Asynchronously Communicating Pushdown Systems (ACPS), usually requires an "empty-stack restriction." This means a process can only receive a message if its call stack is completely empty. While this makes the math easier, it doesn't reflect how people actually write code. Real-world programs often need to receive data while they are deep in a recursive loop. However, if you remove the empty-stack restriction entirely, the verification problem becomes undecidable. This paper seeks a "middle ground": a model that allows receiving messages at various stack heights while remaining mathematically decidable.

Methods: The Shaped Stack and NNCTs

The authors bridge the gap between programming models and formal verification through several key steps:

  1. The Shaped Stack Constraint: Instead of requiring an empty stack, they introduce the K-shape constraint. This limits the number of "blocking" operations (like a receive call) that can be active on the stack at once to a constant $K$, while allowing an unlimited number of "non-blocking" operations (like send or spawn).
  2. Nets with Nested Coloured Tokens (NNCTs): To analyze these systems, the authors invented a new extension of Petri nets. Unlike standard Petri nets where tokens are simple dots, NNCTs feature "complex tokens" that carry their own multisets of "coloured tokens."
An illustration of a Net with Nested Coloured Tokens (NNCT), showing complex tokens containing multisets of coloured tokens.
  1. Vertical Transfers: A crucial feature of NNCTs is the ability to "eject" coloured tokens from inside a complex token out into the main net. This mechanism is used to simulate the way a recursive procedure "returns" a summary of its side effects to the caller.
  2. Complexity Analysis: To prove the limits of this model, the authors used a "Nested Rackoff Argument" (a geometric technique to bound the search space) for the upper bound and a "yardstick construction" to prove the lower bound.

Key Insights

  • Summarization: The authors use "alternative semantics" to summarize the effects of commutative (non-blocking) procedures. Instead of tracking every step of a recursive call, they precompute its total effect and store it as a "summary" on the stack.
  • The Power of Nesting: By allowing tokens to contain other tokens, NNCTs can model the hierarchical nature of recursive calls much more naturally than standard Petri nets.
  • The "K" Factor: Surprisingly, the stack bound $K$ isn't the primary driver of complexity. It influences the number of colors and places in the model, but the core difficulty (the "tower" of exponentials) is driven by the number of simple places in the net.

Results and Complexity

The paper establishes that the coverability problem (checking if an error state is reachable) is decidable for ACPS with shaped stacks. The complexity of this problem is shown to be TOWER-complete. This means the time or space required to solve the problem grows as a "tower" of exponentials ($2^{2^{2^\dots}}$), where the height of the tower depends on the size of the program.

Diagram showing the reductions between various models and the resulting TOWER complexity bounds.

The authors successfully proved that K-shaped ACPS, APCPS (Partially Commutative systems), and NNCTs are all inter-reducible, meaning a solution for one provides a solution for the others.

Conclusion

While the problem is "decidable," TOWER-complete complexity is extremely high. This suggests that while a general algorithm exists, it may be slow for large programs without further optimizations. The authors suggest that "abstract interpretation"—simplifying real code into these formal models—is the next logical step for practical tool building, with potential applications in languages like Erlang.

Summary updated

BibTeX
@misc{kochems2014decidable,
  author = {Jonathan Kochems and C.-H. Luke Ong},
  title = {{Decidable Models of Recursive Asynchronous Concurrency}},
  year = {2014},
  eprint = {1410.8852},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1410.8852},
}
Figure