Design and Implementation of GALS systems Alain Girault

  • Slides: 35
Download presentation
Design and Implementation of GALS systems Alain Girault, Avinash Malik and Zoran Salcic Synchron,

Design and Implementation of GALS systems Alain Girault, Avinash Malik and Zoran Salcic Synchron, November 2011

2 Embedded Systems – Challenges Reactions to the events and interaction with the physical

2 Embedded Systems – Challenges Reactions to the events and interaction with the physical environment (timing constraints) Physical world Embedded system Application Execution on the computer platform (its timing, resource and non-functional constraints) Physical world Computing platform

3 Smart Distributed Surveillance System (SDSS) Video archiving server System server Mobile and fixed

3 Smart Distributed Surveillance System (SDSS) Video archiving server System server Mobile and fixed supervisor Network Control Box Control box Camera Sensor BTT Control Box BTT Video and other sensors BT

4 System Component – Control Box JPEG decompression Motion vectors calculation and other image

4 System Component – Control Box JPEG decompression Motion vectors calculation and other image related algorithms for single camera Detecting objects in the Fo. V and tracking the biggest object Track other object on operator request Sensor fusion (Virtual) Tripwire implementation Communication with neighboring cameras Handover/takeover implementation Communication with operator Mode transition (Auto-Manual-Auto) Control Box BTT

5 Requirements on Design, Specification and Programming Language(s) How to describe and design such

5 Requirements on Design, Specification and Programming Language(s) How to describe and design such complex systems? System design language plays the key role Language requirements Concurrency – synchronous and asynchronous Simple and reliable synchronization and communication Behavioral and structural hierarchy – modularity and refinement Scalability Formal semantics - verifiability Shift from static to dynamic - change of system configuration

6 Our current approach – GALS-centric GALS model (static or dynamic) Static (fixed number

6 Our current approach – GALS-centric GALS model (static or dynamic) Static (fixed number of concurrent behaviours) System. J lib. GALS New Language (includes Java) Dynamic (time-varying number of concurrent behaviors) DSystem. J DGALS Library and run-time support (C/C++)

7 Language-based Approach Based on formal Mo. C - GALS (Globally Asynchronous Locally Synchronous)

7 Language-based Approach Based on formal Mo. C - GALS (Globally Asynchronous Locally Synchronous) System. J = Java embedded into concurrency and reactivity constructs System. J = Java + Esterel +CSP Java - for object oriented modeling and algorithmic parts Esterel - for synchronous concurrency with reactivity and safe communication of synchronous behaviors CSP - for asynchronous concurrency, message passing and safe communication of asynchronous behaviors DSystem. J = System. J + Dynamic creation + Mobility (π-calculus)

8 System. J Program Example Graphical equivalent of System. J program (Static) ENVIRONMENT Signal

8 System. J Program Example Graphical equivalent of System. J program (Static) ENVIRONMENT Signal A Signal B Signal C R 11 Ch C 12 E Signal R 12 F R 21 (Simple) R 31 Ch C 32 Java 1 System. J 1 Java 2 Signal D R 321 Ch C 23 Signal tosend R 322 CD 1 CD 2 System. J Program/System CD 3

9 System. J (static subset) – The Kernel Statements System. J kernel statements Meaning

9 System. J (static subset) – The Kernel Statements System. J kernel statements Meaning pause Consumes a logical tick [output][input][type]signal S Signal declaration emit S[(exp)] Emitting a signal p 1; p 2 Sequential statements while(true) { p } Infinite loop (temporal) present (S) { p 1 } else { p 2} Conditional statement [weak]abort([immediate]S){p} Watchdog await (S) Wait until signal present

1 0 System. J (static subset) – The Kernel Statements System. J kernel statements

1 0 System. J (static subset) – The Kernel Statements System. J kernel statements Meaning trap (T) { p 1. . exit(T); . . p 2} Software exception p 1 || p 2 Synchronous parallel operator output [type] channel C Output channel declaration input [type] channel C Input channel declaration p 1 >< p 2 Asynchronous parallel operator send C ([exp]) Sending on channel receive C Receiving on channel

1 1 Dsystem. J (dynamic set) – The Kernel Statements DSystem. J kernel statements

1 1 Dsystem. J (dynamic set) – The Kernel Statements DSystem. J kernel statements Meaning unique-name CD([args]) Declare a named CD unique-name { } Declare an un-named CD run unique-name ([args]) Run CD unique-name run #channel-name([args]) Run CD received via channel-name [input][output][type] channel C Declare channel C

1 2 System. J Simple Program Example R 11 waits on presence of signal

1 2 System. J Simple Program Example R 11 waits on presence of signal S Then emits A to trigger R 12 to send a message to CD 2(R 21) ENVIRONMENT Signal S Signal A R 12 R 21 receives and prints the message R 21 (Simple) R 11 CD 1 Ch CH receive print CD 2 System. J Program/System

1 3 System. J Simple Program Example system { interface { input int channel

1 3 System. J Simple Program Example system { interface { input int channel CH; output int channel CH; input signal S; } { { signal A; { await(S); emit A; } || { await(A); while(true){ send CH(123); pause; } } } >< { receive CH; int i = #CH; system. out. println(i); } } } Interface declaration Inputs, outputs, channels Synchronous reaction R 11 Clock domain CD 1 Synchronous reaction R 12 Clock domain CD 2 Java data call

Example surveillance system in DSystem. J PTZ cameras track a moving object indoors. Two

Example surveillance system in DSystem. J PTZ cameras track a moving object indoors. Two machines take part in the system (avedon –the camera controller and strange-love the code repository) Camera controller asks for code from the repository when a camera is attached (shown via input signals) – channel based communication between CDs. Camera controller code can be modified at runtime to account for changes in the tracking algorithm etc. Load balancing and resilience to fault is provided by the multiple servers providing source code for GUIListener clients and the one-to-many communication protocol.

Surveillance system in DSystem. J Code on avedon Code on strange-love

Surveillance system in DSystem. J Code on avedon Code on strange-love

1 7 What is lib. GALS? A run-time library in C to support GALS

1 7 What is lib. GALS? A run-time library in C to support GALS Mo. C Provides application programming interface to describe lib. GALS: A Library for GALS Programming constructs are intuitive – no low-level details of communication and synchronization Not only for single processor systems, but also for multi core/multi-processing architectures Ported to a number of operating systems (Windows, Linux, RTEMS, µCOS II, p. So. S, etc).

1 8 lib. GALS Program Signals and channels in lib. GALS systems

1 8 lib. GALS Program Signals and channels in lib. GALS systems

1 9 lib. GALS Positioning lib. GALS is implemented by using OS services Reactions

1 9 lib. GALS Positioning lib. GALS is implemented by using OS services Reactions and synchronizers are implemented using lib. GALS itself and Other OS services Other software communicates with reactions via I/O functions

2 0 lib. GALS Implementation Data structures are established to implement abstractions of clock

2 0 lib. GALS Implementation Data structures are established to implement abstractions of clock domains, reactions, signals and channels Clock domain is a container which groups reactions and signals and is registered with channels Each reaction is a thread (task, pthread) Synchronizer process enforces synchronization between reactions within each clock domain lib. GALS program is multi-threaded Semaphores are used internally in lib. GALS (available in all operating systems) portability Inputs and outputs implemented as functions – interfaces to other software and device drivers

2 1 lib. GALS API Function Name create. Clock. Domain create. Reaction Description Create

2 1 lib. GALS API Function Name create. Clock. Domain create. Reaction Description Create a clock domain Create a reaction within a clock domain create[Signal | Trap] Create an instance of a signal or a trap start. Clock. Domain Start running a clock domain init. Reaction/ Initialize a reaction and endinit. Reaction initialization of the reaction get. Argument Get an argument passed to the reaction end. Reaction End a reaction, called if the reaction is not a child reaction register[Emitter|Trap] Register a process as a signal emitter or a trap thrower emit | sustain Emit/broadcast (or sustain) a signal present Check if a signal is present pause Enforce end of tick for a reaction await Wait for the presence of a signal

2 2 lib. GALS API Function Name [strong|weak] abort/end. Abort Description Start and end

2 2 lib. GALS API Function Name [strong|weak] abort/end. Abort Description Start and end of a preemption block; preempt if monitored signals are present suspend/end. Suspend a reaction by one tick if a d monitored signals are present set. Trap/end. Trap Set and end the scope of the trap exit. Trap Exit the trap, the reaction will jump to the end of the trap scope fork/join Fork out children reactions and wait for join of the children reactions AND, OR, NOT, REP Form a combined signal expression value Acquire the value of a signal pre[Value] Get the presence status and value of a signal in the previous tick create. Channel Create a channel connecting two clock domains send/receive Send and receive data between reactions in different clock domains via a channel

2 3 System. J Compilation and Execution Strategies System. J/DSystem. J program System. J

2 3 System. J Compilation and Execution Strategies System. J/DSystem. J program System. J compiler – front-end (Lexer and Parser Abstract Syntax Tree – AST Error Checks AST 2 AGRC optimizations JVM only platforms Java back-end code generation Standard Java byte codes Embedded Systems platforms Optimized AGRC optimization for ESP and separation of control and data oriented code Standard + reactive Java byte codes JCF Java byte codes CRCF code Platforms with separated CRCF and JCF Singlethreaded Java code (no networking) Singlethreaded Java code (networking) Multithreaded Java code (networking) J 2 SE, J 2 ME, Squawk, Dalvik, specialized, JOP RJOP Tandem Virtual Machine (TVM) Tandem Processors (TP) Hybrid processors (GALS-JOP, JOP-Plus) Heterogeneo us Multicores (HMP, HMPJOP, CMP, …)

Compiling DSystem. J programs Asynchronous Graph Code (AGRC) is used as an intermediate format

Compiling DSystem. J programs Asynchronous Graph Code (AGRC) is used as an intermediate format for compilation. AGRC is derived from GRC used for compiling Esterel. Includes extra nodes to represent asynchronous CD forking (><) operator Channel based communication ∞ based termination codes to describe unresolved signal dependencies.

Implementing rendezvous in distributed environment reaction R (: ){ send C (2); } ><

Implementing rendezvous in distributed environment reaction R (: ){ send C (2); } >< reaction M(: ){ receive C; C_R 1_data C_R 1_ask Init ask C_M 1_res Ask ask C_N 1_ack } >< C_N 1_res ack resp reaction N(: ){ receive C; } Data data

Experimental results – System. J

Experimental results – System. J

Lib. GALS Vs System. J Lib. GALS requires around 42% more lines of code

Lib. GALS Vs System. J Lib. GALS requires around 42% more lines of code to describe the system The loss in programming abstraction is gained in execution speed

Experimental results Dsystem. J Vs DGALS vs JADE

Experimental results Dsystem. J Vs DGALS vs JADE

2 9 Building/testing and debugging Complex Software Systems GALS (System. J) programs easily coexist

2 9 Building/testing and debugging Complex Software Systems GALS (System. J) programs easily coexist each with the other or with the programs written in other languages Condition: other programs “understand” signal abstraction Communication can be “direct” or through the operating system (using sockets as universal mechanism for external signals implementation) Execution platform is “hidden” by the operating system (can be single and/or multicore and/or distributed)

3 0 Building Complex Software Systems PHYSICAL ENVIRONMENT Dedicated Drivers Signals Complex Software System

3 0 Building Complex Software Systems PHYSICAL ENVIRONMENT Dedicated Drivers Signals Complex Software System Other programs System. J Program 1 Operating System. J Program 2 Signals

Software Test-Bench 1 Environment emulator and observer of System. J design under test (DUT)

Software Test-Bench 1 Environment emulator and observer of System. J design under test (DUT) added as another clock domain Minor modification necessary in the DUT System. J program/DUT Existing clock domain New reaction to communicate with test-bench Test-bench = System. J program = DUT + EE (CD) Testbench channels Environment emulator and observer (clock domain) 31

Software Test-Bench 2 Environment emulator and observer of System. J design under test (DUT)

Software Test-Bench 2 Environment emulator and observer of System. J design under test (DUT) added as another System. J program No modification of DUT necessary DUT and Environment emulator (EE) can run on different processors/network Test-bench = DUT +EE They communicate through signals System. J program/DUT Operating System Environment emulator and observer (system) EE Test-bench signals 32

Building Distributed Systems Distributed systems can be composed without changing individual System. J programs

Building Distributed Systems Distributed systems can be composed without changing individual System. J programs NETWORK Computer N Computer 1 Core 2 System. J Other programs Program Operating System. J Program Operating System PHYSICAL ENVIRONMENT System. J Program 33

Conclusions GALS-based approach addresses needs of wide range of future embedded and distributed systems

Conclusions GALS-based approach addresses needs of wide range of future embedded and distributed systems Formal Mo. C Systematic design with models that can be analyzed System. J/DSystem. J - Adoption of existing Java code Flexibility – with or w/o OS Range of target platforms – from standard (general purpose) to specialized (customized) 34

On-going and Future Work Time in System. J to make it more “real-time” language

On-going and Future Work Time in System. J to make it more “real-time” language Formal analysis and verification of SJ/DSJ programs Control processor ISA optimization Marriage with Java processors More. . from Java to other languages 35

Thank you! 36

Thank you! 36