low level reactive languages
play

Low-Level Reactive Languages Jan Tobias Mhlberg - PowerPoint PPT Presentation

empty Low-Level Reactive Languages Jan Tobias Mhlberg jantobias.muehlberg@cs.kuleuven.be iMinds-DistriNet PLaNES Reading Club, KU Leuven, 13 th May 2015 13 th May 2015 1 /32 Low-Level Reactive Languages empty Motivation Around 2010:


  1. empty Low-Level Reactive Languages Jan Tobias Mühlberg jantobias.muehlberg@cs.kuleuven.be iMinds-DistriNet PLaNES Reading Club, KU Leuven, 13 th May 2015 13 th May 2015 1 /32 Low-Level Reactive Languages

  2. empty Motivation Around 2010: Course on “Reactive Systems Design” for MSc in Software Engineering and Gas Turbine Control at York • Focus on synchronous languages for reactive control systems 13 th May 2015 2 /32 Low-Level Reactive Languages

  3. empty Motivation Around 2010: Course on “Reactive Systems Design” for MSc in Software Engineering and Gas Turbine Control at York • Focus on synchronous languages for reactive control systems • Lectures: Mathematical foundations, Lustre, Esterel, Statecharts, compilation and design verification 13 th May 2015 2 /32 Low-Level Reactive Languages

  4. empty Motivation Around 2010: Course on “Reactive Systems Design” for MSc in Software Engineering and Gas Turbine Control at York • Focus on synchronous languages for reactive control systems • Lectures: Mathematical foundations, Lustre, Esterel, Statecharts, compilation and design verification • Practicals: SCADE and Lego Mindstorms 13 th May 2015 2 /32 Low-Level Reactive Languages

  5. empty Motivation SCADE: “The Standard for the Development of Safety-Critical Embedded Software in Aerospace & Defense, Rail Transportation, Energy and Heavy Equipment Industries” – http://www.esterel-technologies.com/ • Graphical modelling of reactive systems using synchronous language • Graphical debugging and efficient simulation • Design Verifier – formal verification • Generation of safe, efficient, small print production code (qual. DO-178B; cert. IEC 61508, EN 50128) 13 th May 2015 3 /32 Low-Level Reactive Languages

  6. empty Motivation SCADE: “The Standard for the Development of Safety-Critical Embedded Software in Aerospace & Defense, Rail Transportation, Energy and Heavy Equipment Industries” – http://www.esterel-technologies.com/ • Graphical modelling of reactive systems using synchronous language • Graphical debugging and efficient simulation • Design Verifier – formal verification • Generation of safe, efficient, small print production code (qual. DO-178B; cert. IEC 61508, EN 50128) What are the new trends for RP in safety-critical systems? 13 th May 2015 3 /32 Low-Level Reactive Languages

  7. empty This Talk To distinguish this from previous talks: Imperative languages, no distribution, deterministic w.r.t. timing, aiming at safety critical deployment & verification 13 th May 2015 4 /32 Low-Level Reactive Languages

  8. empty This Talk To distinguish this from previous talks: Imperative languages, no distribution, deterministic w.r.t. timing, aiming at safety critical deployment & verification Outline • Outline of synchronous languages • Reactive C [Bou91] • Synchronous C [vH09] (and SJ) • PRET-C [ARGT14] (2009) 13 th May 2015 4 /32 Low-Level Reactive Languages

  9. empty Synchronous Languages [BCC + 13] mentions Esterel, StateCharts, Lustre, LabVIEW, Simulink and others. 13 th May 2015 5 /32 Low-Level Reactive Languages

  10. empty Synchronous Languages [BCC + 13] mentions Esterel, StateCharts, Lustre, LabVIEW, Simulink and others. Overview & survey: [BCE + 03] (focusing on Esterel, Lustre and Signal) 13 th May 2015 5 /32 Low-Level Reactive Languages

  11. empty Synchronous Languages [BCC + 13] mentions Esterel, StateCharts, Lustre, LabVIEW, Simulink and others. Overview & survey: [BCE + 03] (focusing on Esterel, Lustre and Signal) Properties Include specific/dedicated features for programming reactive controllers with real-time constraints: • synchrony 13 th May 2015 5 /32 Low-Level Reactive Languages

  12. empty Synchronous Languages [BCC + 13] mentions Esterel, StateCharts, Lustre, LabVIEW, Simulink and others. Overview & survey: [BCE + 03] (focusing on Esterel, Lustre and Signal) Properties Include specific/dedicated features for programming reactive controllers with real-time constraints: • synchrony • typically first-order • concurrency • determinism 13 th May 2015 5 /32 Low-Level Reactive Languages

  13. empty Synchronous Languages The Synchrony Hypothesis: Let ∆( f ( x )) denote the time to compute a reaction f on inputs x . ∆( f ( x )) depends on (1) the implementation of f , (2) the target machine, and (3) the nature of x . Problem: We wish to abstract ∆( f ( x )) to some δ , but also require compositionality, i.e. if f ( x ) = g ( h ( x )) , then ∆ f = ∆ g + ∆ h . How can we obtain the required identity δ = δ + δ ? 13 th May 2015 6 /32 Low-Level Reactive Languages

  14. empty Synchronous Languages The Synchrony Hypothesis: Let ∆( f ( x )) denote the time to compute a reaction f on inputs x . ∆( f ( x )) depends on (1) the implementation of f , (2) the target machine, and (3) the nature of x . Problem: We wish to abstract ∆( f ( x )) to some δ , but also require compositionality, i.e. if f ( x ) = g ( h ( x )) , then ∆ f = ∆ g + ∆ h . How can we obtain the required identity δ = δ + δ ? Solutions (1) δ = 0 – synchrony , reactive control systems (2) δ = ? – asynchrony, interactive systems Synchronous languages achieve separation of concerns: qualitative (logical) time versus of quantitative (physical) time. 13 th May 2015 6 /32 Low-Level Reactive Languages

  15. empty Synchronous Languages Reality • Valid abstraction as long as δ i ≤ ∆ i • This needs to be checked and verified for the implementation (worst-case execution time analysis, etc.) • Two views of the system: • External view : Reactions are atomic • Internal view : Reactions are non-atomic 13 th May 2015 7 /32 Low-Level Reactive Languages

  16. empty Synchronous Programming . . . for Control Engineers in SCADE: ControlVehicle 13 th May 2015 8 /32 Low-Level Reactive Languages

  17. empty Synchronous Programming Synchronous Programming : OperateMotor 13 th May 2015 9 /32 Low-Level Reactive Languages

  18. empty Synchronous Programming Synchronous Programming : OperateMotor as SM 13 th May 2015 10 /32 Low-Level Reactive Languages

  19. empty Synchronous Programming Synchronous Programming : Compilation & Execution Event Driven Sample Driven Initialise Memory Initialise Memory for each input event do for each clock tick do Compute Outputs Read Inputs Update Memory Compute Outputs end Update Memory end e.g. Esterel e.g. Lustre 13 th May 2015 11 /32 Low-Level Reactive Languages

  20. empty Synchronous Programming Design Verification 13 th May 2015 12 /32 Low-Level Reactive Languages

  21. empty Synchronous Programming Design Verification 13 th May 2015 12 /32 Low-Level Reactive Languages

  22. empty Synchronous Programming Design Verification 13 th May 2015 12 /32 Low-Level Reactive Languages

  23. empty Reactive C 13 th May 2015 13 /32 Low-Level Reactive Languages

  24. empty Reactive C [Bou91] Frederic Boussinot, 1991. Extends C with parallelism, exceptions and reactive statements. Semantics of RC extensions is based directly on Esterel: parallelism is evaluated deterministically with no run-time concurrency. Embedding of RC in C is done by preprocessor. Compiler enforces deadlock freedom for reactive statements. 13 th May 2015 14 /32 Low-Level Reactive Languages

  25. empty Reactive C [Bou91] An Example: Time, Signals and Parallelism signal SYNC, REQ, OK, rproc alarm_handler() { NOK, ALARM; loop { watching { rproc req_handler() { await (present(SYNC)); every (present(SYNC)) { emit (ALARM); await (present(REQ)); } timeout await(present(SYNC)); emit (OK); stop; stop; } every (present(REQ)) } emit (NOK); } rproc sync_req_handler() { } par exec req_handler(); exec alarm_handler(); } 13 th May 2015 15 /32 Low-Level Reactive Languages

  26. empty Reactive C [Bou91] RC Esterel par 12 12 printf("1"); printf("2"); 13 th May 2015 16 /32 Low-Level Reactive Languages

  27. empty Reactive C [Bou91] RC Esterel par 12 12 printf("1"); printf("2"); invalid: present S valid causality cycle! else emit S end 13 th May 2015 16 /32 Low-Level Reactive Languages

  28. empty Reactive C [Bou91] RC Esterel par 12 12 printf("1"); printf("2"); invalid: present S valid causality cycle! else emit S end present S1 can be implemented valid: then emit S2 end || emit S1; present S2 with run-time checks instantaneous dialogue then emit S3 end 13 th May 2015 16 /32 Low-Level Reactive Languages

  29. empty Reactive C [Bou91] RC Esterel par 12 12 printf("1"); printf("2"); invalid: present S valid causality cycle! else emit S end present S1 can be implemented valid: then emit S2 end || emit S1; present S2 with run-time checks instantaneous dialogue then emit S3 end Signals, primitive types, Signals and Data Types structured data numeric values 13 th May 2015 16 /32 Low-Level Reactive Languages

  30. empty Reactive C [Bou91] RC Esterel par 12 12 printf("1"); printf("2"); invalid: present S valid causality cycle! else emit S end present S1 can be implemented valid: then emit S2 end || emit S1; present S2 with run-time checks instantaneous dialogue then emit S3 end Signals, primitive types, Signals and Data Types structured data numeric values Process Management dynamic static 13 th May 2015 16 /32 Low-Level Reactive Languages

Recommend


More recommend