Reactivity of Cooperative Systems: Application to ReactiveML

Louis Mandel and Cédric Pasteur
SAS 2014


Cooperative scheduling enables efficient sequential implementations of concurrency. It is widely used to provide lightweight threads facilities as libraries or programming constructs in many programming languages. However, it is up to programmers to actually cooperate to ensure the reactivity of their programs.

We present a static analysis that checks the reactivity of programs by abstracting them into so-called behaviors using a type-and-effect system. Our objective is to find a good compromise between the complexity of the analysis and its precision for typical reactive programs. The simplicity of the analysis is mandatory for the programmer to be able to understand error messages and how to fix reactivity problems.

Our work is applied and implemented in the functional synchronous language ReactiveML. It handles recursion, higher-order processes and first-class signals. We prove the soundness of our analysis with respect to the big-step semantics: a well-typed program is reactive. The analysis is easy to implement and generic enough to be applicable to other models of concurrency such as coroutines.


When compiling a ReactiveML file, adding the options -dreactivity and-dtypes allows to display types and reactivity behaviors in emacs. To do so, the ReactiveML emacs mode has to be installed. Then C-c C-t displays types of the expression under the editing point and C-c C-s displays the behavior.

The JavaScript version of the ReactiveML toplevel provided here is compiled to display reactivity behaviors.