Reactive Programming Description
Reactive Programming considers software systems whose behaviors basically consist in reacting to activations. These systems are often called reactive systems. System reactions, also called instants, can take various forms, for example sequences of successive phases, or oscillations eventually leading to stabilization. Reactive Programming put the focus on the semantics and the programming of such systems. More precisely: The project, previously called RC project, has started in 1988. From then, several programming models and languages have been designed and implemented: The first generation of software developped in the project had Reactive-C as basis; it includes NRP, SL, ROM, Reactive Scripts over the graphical Tcl/Tk toolkit, and an Icobjs system implemented with reactive scripts. The second generation of sofware is basically based on Java; it includes three versions of SugarCubes, Junior, REJO, and a new Icobjs system. Recently, FairThreads and LOFT propose a thread-based approach to reactive programming.

All software developed in the project is open source and is available on the Internet.

At the beginning, the reactive programming group has received support from France Telecom-R&D.

The rest of the page gives more details on the various languages and models considered in the project.

Reactive-C

The basic idea of Reactive-C was to propose a programming style close to C, in which program behaviors are defined in terms of reactions to activations. Reactive-C programs can react differently when activated for the first time, for the second time, and so on. Thus a new dimension appears for the programmer: the logical time induced by the sequence of activations, each pair of activation/reaction defining one instant.

The present Reactive-C compiler is the rcc version 3 compiler. It works as a pre-processor of C, and is about 2500 lines of ansi-C. It runs on several Unix platforms (mainly Sun and Linux), and also on DOS/PC.

Actually, Reactive-C appeared rapidly as being a kind of reactive assembly language that could be used to implement higher level formalisms based on the notion of an instant.


Nets of Reactive Processes

The first formalism implemented in Reactive-C is NRP (Nets of Reactive Processes). In this formalism, programs are made of reactive processes executed in parallel and communicating through unbounded first-in/first-out files called channels.

Reactive processes are sequential reactive programs which can put messages in their output channels, and get messages from their input channels. The key point is that a process which tries to get a message from an empty channel does not remain stuck forever on the channel: reactive processes can test for channel emptyness. Because all processes share the same notion of an instant, nets of reactive processes are deterministic.

The NRP model is actually an extension of the Kahn model, introduced in 1974, which allows processes to test channels for emptyness, while preserving determinism. The test for channel emptyness gives NRP a more expressive power than Kahn's networks. For example, it becomes possible to reset a process when it receives a message on a priority channel, which was not possible in Kahn's model.

A first implementation of Nets of reactive processes exists in Reactive-C; a second implementation exists in Java using SugarCubes.

The SL Language

The SL language is a member of the family of synchronous languages in which reactions are instantaneous. The syntax is close to Esterel, but in SL hypotheses about signal presence/absence are disallowed. One decides that a signal is absent during an instant only at the end of this instant, so, reaction to the absence is delayed to the next instant.

Sources of causal circularities (the so-called causality cycles) are avoided, while the main features of the synchronous approach still remain: the expressive simplicity and power of the parallel instruction, the ease of specification and debugging for deterministic programs, and the power and modularity of event broadcasting. However, "strong" preemption is not possible in SL, which only allows the "weak" one.

Forbidding immediate reactions to signal absences simplifies the implementation to a large extent (the existing implementation is less than 1000 lines of Reactive-C). In addition to directly execute programs, the implementation can also produce explicit automata by symbolic evaluation.


The RLib Library

The RLib library provides primitives to program event-driven systems made of reactive agents. The basic model of RLib is called POR.

RLib is written in Reactive-C and was developed by a company called Soft Mountain. Parts of the Process Control tool PROTOP/IX of Modcomp/AEG have been written in RLib. PROTOP/IX has been used to pilot several cement factories of the Lafarge company.


Reactive Objects

The Reactive Object Model (ROM) merges an object approach with the notion of a global instant. In this model, methods can be invoked using instantaneous non-blocking send orders which are immediately processed (that is, processed during the current instant). Moreover, a method cannot execute more than once at each instant. The semantics of ROM has been studied in cooperation with Cosimo Laneve from Bologna University (Italy).

The extension of ROM to distribution is called DROM. In DROM, systems are decomposed into reactive areas where agents communicate inside their area by instantaneous orders, and between distinct areas by usual unbounded delay orders.

A prototype language for ROM has been implemented in Reactive-C, as a set of macros and a library. An implementation of DROM in Java, called Rhum, has been developped by Laurent Hazard at France Telecom R&D. It is based on Junior for the reactive part and on Jonathan, an open source ORB written in Java, for distribution aspects.


Reactive Scripts

Reactive Scripts are programs intended to be run by reactive interpretors. Reactive scripts interpretors can run several commands in parallel and manage broadcast events. Instants of reactive scripts are actually identified to the reactions of the interpretor. The Language of Reactive Scripts is a mix of two formalisms: the SL synchronous language, and the ROM model.

A Reactive Scripts interpretor called rsi-tk has been implemented in Reactive-C, using the graphical toolkit Tcl/Tk as interpretor of basic actions. An interpretor of Reactive Scripts has also been developped by Jean-Ferdy Susini with SugarCubes.


Icobj Programming

Icobj Programming is a simple and fully graphical programming method, using a powerful means to combine behaviors. This programming is based on the notion of an icobj which has a behavioral aspect (object part), a graphical aspect (icon part), and which can be animated at screen.

Icobj Programming comes from the reactive approach and provides parallelism, broadcast event communication and migration through the network.

Several experimental systems based on this approach are implemented. A first Icobjs system is implemented with Reactive Scripts in Reactive-C and Tcl/Tk. It is present in the software distribution related to Reactive-C. This experimental system has been awarded by Pirelli

The new Icobjs system is now implemented in Java. It is used for simulations in Physics, in the context of games, and for interpretation of the Ambient calculus. The new system is described in Chritian Brunette's thesis.


SugarCubes

SugarCubes is a set of Java classes for implementing:

A comparison of SugarCubes with the standard Java threading mechanism is available. It shows that SugarCubes proposes a simple and structured approach to concurrency which can be seen as an alternative to Java threads, especially when dynamic combinations of communicating concurrent components are needed.

The version 3 of SugarCubes is described in the thesis of J-F. Susini


Junior

Junior is a kernel model for reactive programming, issued froom SugarCubes. It basically defines concurrent reactive instructions communicating with broadcast events. At the basis of Junior is the rejection of immediate reaction to absence, which is one of the major difference with synchronous formalisms.

The parallel operator in Junior is basically non-deterministic. This is the main difference with SugarCubes which is totally deterministic. Operational semantics has been provided for Junior.

Junior has an efficient implementation in which the whole program has not to be walked through at each micro-step. In this implementation, developped by Laurent Hazard, instructions stuck on events are stored in queues, and generation of an event directly fires all instructions stuck on it. Others implementations have been developped in various contexts; one of them is under construction by Louis Mandel.


ROS/REJO

REJO isv an extension of Java that defines reactive objects having their own data and their own set of reactive instructions. These objects might also be considered as mobile agents which can migrate using a platform, named ROS, based on JavaRMI.

REJO and ROS are built over Junior. The programming model of REJO is close to that of Junior and SugarCubes and produces reactive instructions that are executed in a reactive machine.

REJO and ROS are described in details in the thesis of R. Acosta-Bermejo


FairThreads

FairThreads offers a very simple framework for concurrent and parallel programming. Basically, it defines schedulers which are synchronization servers, to which fair threads are linked. All threads linked to the same scheduler are executed in a cooperative way, at the same pace, and they can synchronize and communicate using broadcast events. Threads which are not linked to any scheduler are executed by the OS in a preemptive way, at their own pace.

FairThreads is implemented in C, Java, and Scheme. Implementations differ by the way unlinked threads are defined. In Scheme, unlinked threads, called service threads, are not user-defined. In Java and C, unlinked threads are mapped to kernel threads and programming constructs are provided for dynamically linking and unlinking threads.


LOFT

LOFT is a thread-based language for concurrent programming in C. LOFT is closely related to FairThreads (actually, LOFT stands for Language Over Fair Threads). Objectives are:

Contacts



This Html page has been produced by Skribe.
Last update Mon Oct 23 12:08:28 2006.