Actors have become widespread in programming languages and programming frameworks focused on parallel and distributed computing. While actors provide a more disciplined model for concurrency than threads, their interactions, if not constrained, admit nondeterminism. As a consequence, actor programs may exhibit unintended behaviors and are less amenable to rigorous testing. The same problem exists in other dominant concurrency models, such as threads, shared-memory models, publish-subscribe systems, and service-oriented architectures.We propose “reactors,” a new model of computation that combines synchronous-reactive principles with a sophisticated model of time to enable determinism while preserving much of the style and performance of actors. Reactors promote modularity and allow for distributed execution. The relationship that reactors establish between events across timelines allows for:
1. the construction of programs that react predictably to unpredictable external events;
2. the formulation of deadlines that grant control over timing; and
3. the preservation of a deterministic distributed execution semantics under quantifiable assumptions.
We bring the deterministic concurrency and time-based semantics of reactors to the world of mainstream programming languages through Lingua Franca (LF), a polyglot coordination language with support (so far) for C, C++, Python, and TypeScript. In LF, program logic is given in one or more of those target languages, enabling developers to use familiar languages and integrate extensive libraries and legacy code.
The main contributions of this work consist of a formalization of reactors, the implementation of an efficient runtime system for the execution of reactors, and the design and implementation of LF.