Nowadays a big number of applications react with another systems, this interaction led to the construction of systems specially adapted to this kind of behavior and to the development of new techniques to build it, for instance the synchronous approach. The notion of reactive system was introduced by D. Harel and A. Pnueli [1] who were the first that identified these systems. Using this definition, there were created an important number of languages that use the reactivity, for example Esterel, Lustre, Signal, etc.
This section presents the general concepts of one of the implementations of the synchronous approach which is used for implementing REJO, Junior. In fact Junior presents some important differences with the Synchronous model that allows it to eliminates causalities problems, for instance the delayed reaction to the absence and the weak preemption. For more information about Junior and the Synchronous approach read [3, 4, 5] and respectively [2, 12].
As you can see, each activation of the system defines a step in the
evolution of it. This notion of step is called instant and
defines a sort of virtual clock in which each instant can take any time.
Each reactive instruction can be activated or restarted. Each activation returns one of the following codes:
The activation of a set of instructions, that we'll call reactive program or just program, is performed by a Java program called reactive machine. At the beginning, the reactive machine contains the reactive instruction Nothing that doesn't do anything and finishes instantaneously. The new instructions, added dynamically to the program, are executed in parallel with the others.
A reactive machine has two main roles: to define the instants of its program and to carry out its events. A machine finishes the actual instant when all the parallel instructions of the program are finished or stopped (any instruction of the program is suspended). Otherwise, while there are suspended instructions, the machine activates cyclically the program. At the end of each activation, the machine tests whether there was a change during the activation (in fact the machine tests if there was generated a new event), if there isn't anyone, there is no possibility that other activations unblock the situation. In that case a flag is set for defining the end of instant, this allows the suspended instructions to be stopped.
The next figure shows the syntactic tree generated by a reactive program as well as the first phase of the instruction's activation.
Syntactic tree of a reactive program.