determinate and timing predictable concurrency in
play

Determinate and Timing-Predictable Concurrency in Reactive Systems - PowerPoint PPT Presentation

Determinate and Timing-Predictable Concurrency in Reactive Systems The Synchronous Approach and the SCCharts Language A r t Reinhard von Hanxleden 1 i * f a S C o m p * l t e n N t e e c t * s T i W s In


  1. 
 Determinate and Timing-Predictable Concurrency in Reactive Systems 
 The Synchronous Approach 
 and the SCCharts Language A r t Reinhard von Hanxleden 1 i * f a S C o m p * l t e n N t e e c t * s T i W s In collaboration with Joaquin Aguado 2 , David Broman 3 , Björn n R e t o l l C d * o * * Duderstadt 1 , Insa Fuhrmann 1 , Michael Mendler 2 , Steven Loftus- c e u s m u d e E e r n o t t e Mercer 4 , Christian Motika 1 , Owen O’Brien 4 , Partha Roop 5 , Steven v e d y s a * E a t a l u Smyth 1 , Alexander Schulz-Rosengarten 1 and the KIELER and ELK teams KIELER 1 Kiel University Kiel Integrated Environment for Layout Eclipse RichClient 2 University of Bamberg 3 KTH, Stockholm Eclipse Layout Kernel 
 4 National Instruments www.eclipse.org/elk 5 University of Auckland

  2. Reactive Systems pause En vir on m en t input I output O React ive Syst em Read Compute Write Tick [SEUS 2013] 2

  3. Thursday, December 3 Session 4.1, Chair: Marc Pouzet 09:00 - 10:00 Gregoire Hamon, Getco LLC: 
 A Synchronous Approach to Trading (Invited Talk) 3

  4. http://www.dagstuhl.de/de/programm/kalender/semhp/?semnr=9448

  5. 1980s: Statecharts Harel Statecharts: A Visual Formalism for Complex Systems Science of Computer Programming‚ 1987 5

  6. 1990s: Many Statecharts Michael von der Beeck A Comparison of Statecharts Variants Formal Techniques in Real-Time and Fault-Tolerant Systems, LNCS 863, 1994 6

  7. 1991: 
 ARGOS Florence Maraninchi The Argos language: Graphical Representation of Automata and Description of Reactive Systems IEEE Workshop on Visual Languages, Kobe, Japan, 1991 7

  8. 1995: SyncCharts, 
 a.k.a. Safe State Machines Charles André SyncCharts: A Visual Representation of Reactive Behaviors Research Report 95-52, I3S, Sophia Antipolis, 1995 8

  9. Limitations of Strict Synchrony if (!x) { … x = true; } Forbidden in SyncCharts, Esterel, Lustre, … 9

  10. SCCharts – Motivation Preserve nice properties of synchronous programming • Determinacy • Sound semantic basis • Efficient synthesis Reduce the pain • Make it easy to adapt for mainstream programmer • Reject only models where determinacy is compromised 10

  11. 
 Enter Sequential Constructiveness … It’s all about scheduling variable accesses within reaction • Sequential accesses to x : unconstrained • Concurrent accesses to x : 
 ⇒ reads 
 ⇒ updates 
 init 
 y = x … z = x x += 2 … x += 5 … x = 1 … • Causality cycles still possible, but less likely von Hanxleden, Mendler, Aguado, et al. Sequentially Constructive Concurrency – 
 A Conservative Extension of the Synchronous Model of Computation ACM TECS '14 11

  12. Interface declaration Initialization

  13. Interface declaration Initialization Superstate

  14. Interface declaration Initialization Superstate Region

  15. Interface declaration Initialization Superstate Region Initial state

  16. Interface declaration Initialization Superstate Region Initial state Final state

  17. Interface Delayed declaration Transition (+ Trigger) Initialization Superstate Region Initial state Final state

  18. Interface Delayed declaration Transition (+ Trigger) Initialization Immediate transition Superstate (+ Effect) Region Initial state Final state

  19. Interface Delayed declaration Transition (+ Trigger) Initialization Immediate transition Superstate (+ Effect) Region Strong abort Initial state Final state

  20. Interface Delayed declaration Transition (+ Trigger) Initialization Immediate transition Superstate (+ Effect) Region Strong abort Initial state Termination Final state

  21. SCChart Building Blocks Region Trigger Effect Superstate State Normalized Core SCCharts 21

  22. Region Trigger Effect Superstate State Normalized Core SCCharts M2M Mappings Thread Conditional Assignment Concurrency Delay fork t 1 par t 2 if ( c ) s 1 else s 2 SCL t x = e pause join SCG

  23. Some Syntactic Sugar: Core SCCharts Interface Root state declaration Local declaration Region ID Transition trigger/ Superstate effect Anonymous Initial state simple state Immediate Termination transition Named simple state Transition priority Final state Region Trigger Effect Superstate State Normalized Core SCCharts

  24. More Syntactic Sugar: Extended SCCharts Signal Suspension Initialization Connector Entry/During/Exit Count Delay actions History transition Deferred transition Conditional Strong abort termination Pre-Operator Complex final state Weak abort Interface Root state declaration Local declaration Region ID Transition trigger/ Superstate effect Anonymous

  25. Stephan Lenga Model-based Compilation of Legacy C Programs Bachelor Thesis, Kiel University, CS Dept., 2016 25

  26. Taking Stock Signal Suspension Initialization Connector Entry/During/Exit Count Delay actions History transition Deferred transition Conditional Strong abort termination Pre-Operator SCCharts defined by M2M Complex final state Weak abort Transformations Interface Root state declaration Local declaration Region ID Transition trigger/ Superstate effect • Extended SCCharts Anonymous Initial state simple state Immediate Termination transition Named simple state Transition priority Final state • Core SCCharts Region Trigger Effect Superstate State Normalized Core • Normalized Core SCCharts SCCharts • SCL/SCG Thread Conditional Assignment Concurrency Delay fork if ( SCL t x = e pause join Next: Downstream Synthesis SCG 26

  27. Thread Conditional Assignment Concurrency Delay SCL t if ( c ) s 1 else s 2 x = e fork t 1 par t 2 join pause SCG g = ⋁ g in g surf = ⋁ g in g join = ( d 1 ⋁ m 1 ) d = g exit Data- g = ⋁ g in m = ¬ 
 Flow g true = g ⋀ c ⋀ ( d 2 ⋁ m 2 ) g depth = x’ = g ? e : x ⋁ surf ∈ t g surf Code ⋀ ( d 1 ⋁ d 2 ) pre ( g surf ) g false = g ⋀ ¬ c m 1 d 1 c g false x x 0 surf 1 m 2 Circuits g join m e g sur g depth f d 2 surf 2 g true g g d 1 d 2

  28. Downstream Compilation So far, two alternative compilation strategies from SCL/SCG to C/VHDL Dataflow Priority Accepts instantaneous loops – + Can synthesize hardware + – Can synthesize software + + Size scales well (linear in size of SCChart) + + Speed scales well (execute only active parts) – + Instruction-cache friendly (good locality) + – Pipeline friendly (little/no branching) + – WCRT predictable (simple control flow) + +/– Low execution time jitter (simple/fixed flow) + – von Hanxleden, Duderstadt, Motika, et al. SCCharts: Sequentially Constructive Statecharts for Safety-Critical Applications PLDI'14 28

  29. Timing Predictability msec 10" Priority" 5" Data4Flow" 0" 0" 10" 20" 30" 40" 50" 60" 70" 80" 90" ticks First 100 ticks of „cabin“ benchmark 29

  30. Classroom Test 30

  31. Classroom Test • 10.000 / 135.000 SCChart nodes 
 before/after normalization • 650.000 lines of C-code • Compiles in about 2 min’s • 2 ms reaction time 31

  32. Modeling Tool flat/deep, fractional/local WCET Timing Analysis Interface Timing Timing Response Request Timing Program Timing Program Points (TPPs) Points (TPPs) Interactive Timing Analysis Tool combines timing assumptions Insa Fuhrmann, David Broman, Reinhard von Hanxleden, Alexander Schulz-Rosengarten 
 Time for Reactive System Modeling: Interactive Timing Analysis with Hotspot Highlighting. 
 RTNS’16 32

  33. 33

  34. 25 23 21 19 17 15 minutes 13 11 9 7 5 3 1 Overall WCET Region Hotspot Hotspot & Region 34

  35. SCCharts Wrap-Up Language Region Trigger Effect Superstate State • 5 core constructs • Smörgåsboard of extensions Model of Computation • Relaxed synchrony • Still determinate Compilation KIELER • M2M transformations Kiel Integrated Environment for Layout Eclipse RichClient • Stress-tested in KIELER Still plenty of things to do: Variants on SC MoC, optimize code generation, …

Recommend


More recommend