Synchronous programming language
A synchronous programming language is a programming language that is mainly suitable for reactive systems due to its behavior .
General
Synchronous programming languages are basically based on the synchronous hypothesis, which consists of the following assumptions:
- multi-form time,
- zero-delay model of circuits,
- perfectly synchronous model.
Multi-form time : The basic sequence of a synchronous program is based on this. The time is determined solely by the ranking of entries. A period of time can be defined by the number and form of inputs, for example receiving a self-defined MINUTE signal three times results in a period of three minutes.
Zero-delay model of circuits : A program sequence can be broken down into individual ( process ) steps. A process step means the transition from one (program) state to the next, e.g. B. closing an open elevator door: current state = door open, next state = door closed. The linear program code for the process step is processed in a finite, predictable time, but without any further time resolution. To stay with the example of lift door: The program can either run the state transition when the door closed to ( timeout or »«key) or when the door is actually closed, but it can not perceive the process of closing. In order to implement the functionality that a user can interrupt closing ( «»button, light barrier, foot), another state would have to be provided.
Perfectly synchronous model : According to this model, all process steps (at least in the concept) run in parallel (= simultaneously). If the smallest unit of time (between two differently timed entries) is a cycle and several processes interact with one another, they generally communicate at the same time, i.e. in the same cycle. The output of a process serves as input for another process in the same cycle, similar to a chain. A light bulb and a brightness sensor serve as a simple example . If the light bulb switches on, the sensor recognizes this immediately and, ideally, outputs a result in the same cycle.
Determined behavior , a peculiarity of Esterel and Luster , for example , forms the basis for simple program verification and options for determining (program) runtimes. The latter is very complex in the case of non-determined systems or languages such as Ada . Therefore, acyclic (linear) programs that do not contain loops are generally to be preferred.
Synchronous programming languages
Advantages and disadvantages
Synchronous programming languages are mainly used in safety-critical systems. Due to their deterministic structure and the easier to estimate runtime, synchronous languages have a clear advantage over imperative languages . By the machine structure is the verification of programs using model checking ( model checking ) possible and are therefore additional security during implementation.
Languages like Esterel can generate a static scheduling (fixed sequence of instructions for all processes involved), since all concurrent processes occurring in this program and all instructions are known at compile time . Static scheduling programs are safe in terms of concurrency .
Of course, synchronous languages are not suitable for every type of problem. What gives them security, for example knowing how many processes actually occur, comes at the expense of dynamic properties. So it can z. B. processes are not created spontaneously that serve a network connection, the process would have to be created at compile time. Neither is memory allocated or released dynamically. So they are z. B. also unsuitable for database systems, since enormous amounts of data can accumulate here and the predictability of the required memory is not or only partially given.
Software for microcontrollers with pipelining and caching cannot be created either, as undefined states resulting from caching can occur here. This type of complex program is only possible in conjunction with other languages.
They are well suited, for example, for control engineering applications, or in general for everything that can be reasonably expressed in a finite automaton with the appropriate semantics.
Further literature
- D. Potop-Butucaru, R. de Simone, J.-P. Talpin: The synchronous hypothesis and synchronous languages. In: R. Zurawski (ed.), The Embedded Systems Handbook. CRC Press. to appear (2005)
Web links
- The synchronous group (English)