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

determinate and timing predictable concurrency in
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Determinate and Timing-Predictable Concurrency in Reactive Systems
 


The Synchronous Approach 
 and the SCCharts Language

Reinhard von Hanxleden1 In collaboration with Joaquin Aguado2, David Broman3, Björn Duderstadt1, Insa Fuhrmann1, Michael Mendler2, Steven Loftus- Mercer4, Christian Motika1, Owen O’Brien4, Partha Roop5, Steven Smyth1, Alexander Schulz-Rosengarten1 and the KIELER and ELK teams

1 Kiel University 2 University of Bamberg 3 KTH, Stockholm 4 National Instruments 5 University of Auckland

C
  • n
s i s t e n t * C
  • m
p l e t e * W e l l d
  • c
u m e n t e d * E a s y t
  • r
e u s e *

*

E v a l u a t e d

* R T N S *

A r t i f a c t

KIELER

Kiel Integrated Environment for Layout Eclipse RichClient

Eclipse Layout Kernel
 www.eclipse.org/elk

slide-2
SLIDE 2

Tick

React ive Syst em En vir on m en t

[SEUS 2013]

Read Compute Write

input I

2

  • utput O

pause

Reactive Systems

slide-3
SLIDE 3

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)

slide-4
SLIDE 4

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

slide-5
SLIDE 5

1980s: Statecharts

5

Harel Statecharts: A Visual Formalism for Complex Systems Science of Computer Programming‚ 1987

slide-6
SLIDE 6

1990s: Many Statecharts

6

Michael von der Beeck A Comparison of Statecharts Variants Formal Techniques in Real-Time and Fault-Tolerant Systems, LNCS 863, 1994

slide-7
SLIDE 7

1991: 
 ARGOS

7

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

slide-8
SLIDE 8

1995: SyncCharts,
 a.k.a. Safe State Machines

8

Charles André SyncCharts: A Visual Representation of Reactive Behaviors Research Report 95-52, I3S, Sophia Antipolis, 1995

slide-9
SLIDE 9

Limitations of Strict Synchrony

9

if (!x) { … x = true; }

Forbidden in SyncCharts, Esterel, Lustre, …

slide-10
SLIDE 10

SCCharts – Motivation

10

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
slide-11
SLIDE 11

Enter Sequential Constructiveness …

It’s all about scheduling variable accesses within reaction

  • Sequential accesses to x: unconstrained
  • Concurrent accesses to x:


  • Causality cycles still possible, but less likely

11

von Hanxleden, Mendler, Aguado, et al. Sequentially Constructive Concurrency – 
 A Conservative Extension of the Synchronous Model of Computation ACM TECS '14

init
 x = 1 … ⇒ updates
 x += 2 … x += 5 … ⇒ reads
 y = x … z = x

slide-12
SLIDE 12

Interface declaration Initialization

slide-13
SLIDE 13

Interface declaration Superstate Initialization

slide-14
SLIDE 14

Interface declaration Region Superstate Initialization

slide-15
SLIDE 15

Interface declaration Initial state Region Superstate Initialization

slide-16
SLIDE 16

Interface declaration Final state Initial state Region Superstate Initialization

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

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

slide-21
SLIDE 21

SCChart Building Blocks

21

Region Trigger Effect Superstate State Normalized Core SCCharts

slide-22
SLIDE 22

Thread Conditional Assignment Concurrency Delay SCL t if (c) s1 else s2 x = e fork t1 par t2 join pause SCG Region Trigger Effect Superstate State Normalized Core SCCharts

M2M Mappings

slide-23
SLIDE 23

Some Syntactic Sugar: Core SCCharts

Region Trigger Effect Superstate State Normalized Core SCCharts

Interface declaration Final state Initial state Root state Named simple state Transition trigger/ effect Region ID Transition priority Anonymous simple state Termination Superstate Immediate transition Local declaration

slide-24
SLIDE 24

More Syntactic Sugar: Extended SCCharts

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

slide-25
SLIDE 25

25

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

slide-26
SLIDE 26

Taking Stock

Thread Conditional Assignment Concurrency Delay SCL t if ( x = e fork join pause SCG Region Trigger Effect Superstate State Normalized Core SCCharts

Interface declaration Final state Initial state Root state Named simple state Transition trigger/ effect Region ID Transition priority Anonymous simple state Termination Superstate Immediate transition Local declaration Connector Conditional termination History transition Entry/During/Exit actions Signal Suspension Strong abort Weak abort Deferred transition Count Delay Pre-Operator Initialization Complex final state

SCCharts defined by M2M Transformations

  • Extended SCCharts
  • Core SCCharts
  • Normalized Core SCCharts
  • SCL/SCG

Next: Downstream Synthesis

26

slide-27
SLIDE 27

Thread Conditional Assignment Concurrency Delay SCL t if (c) s1 else s2 x = e fork t1 par t2 join pause SCG

surf1 surf2 m

c g gfalse gtrue

x e g x0

m1 d1 m2 d2 d1 d2 gjoin

gsur

f

gdepth

Data- Flow Code d = gexit m = ¬


⋁surf ∈ t gsurf

g = ⋁gin gtrue = g ⋀ c gfalse = g ⋀ ¬c g = ⋁gin x’ = g ? e : x gjoin = (d1 ⋁ m1) ⋀ (d2 ⋁ m2) ⋀ (d1 ⋁ d2) gsurf = ⋁gin gdepth = pre (gsurf) Circuits

slide-28
SLIDE 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

slide-29
SLIDE 29

Timing Predictability

29

0" 5" 10" 0" 10" 20" 30" 40" 50" 60" 70" 80" 90" Priority" Data4Flow"

First 100 ticks of „cabin“ benchmark

msec ticks

slide-30
SLIDE 30

Classroom Test

30

slide-31
SLIDE 31

Classroom Test

31

  • 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
slide-32
SLIDE 32

32

Timing Program Points (TPPs) Timing Response

Interactive Timing Analysis Tool combines timing assumptions Modeling Tool flat/deep, fractional/local WCET

Timing Program Points (TPPs) Timing Request Timing Analysis Interface

Insa Fuhrmann, David Broman, Reinhard von Hanxleden, Alexander Schulz-Rosengarten 
 Time for Reactive System Modeling: Interactive Timing Analysis with Hotspot Highlighting. 
 RTNS’16

slide-33
SLIDE 33

33

slide-34
SLIDE 34

34

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

slide-35
SLIDE 35
slide-36
SLIDE 36

SCCharts Wrap-Up

KIELER

Kiel Integrated Environment for Layout Eclipse RichClient

Language

  • 5 core constructs
  • Smörgåsboard of extensions

Model of Computation

  • Relaxed synchrony
  • Still determinate

Compilation

  • M2M transformations
  • Stress-tested in KIELER

Still plenty of things to do: Variants on SC MoC, optimize code generation, …

Region Trigger Effect Superstate State

slide-37
SLIDE 37
  • Insa Fuhrmann, David Broman, Reinhard von Hanxleden, Alexander Schulz-Rosengarten. 


Time for Reactive System Modeling: Interactive Timing Analysis with Hotspot Highlighting. 
 Proceedings of the 24th International Conference on Real-Time Networks and Systems (RTNS’16), 2016

  • Karsten Rathlev, Steven Smyth, Christian Motika, Reinhard von Hanxleden, Michael Mendler. SCEst: Sequentially

Constructive Esterel. 
 Proceedings of the 13th ACM-IEEE International Conference on Formal Methods and Models for System Design (MEMOCODE’15), Austin, TX, USA, September 2015.

  • Joaquín Aguado, Michael Mendler, Reinhard von Hanxleden, Insa Fuhrmann. 


Grounding Synchronous Deterministic Concurrency in Sequential Programming. 
 Proceedings of the 23rd European Symposium on Programming (ESOP’14), LNCS 8410, page 229–248, Grenoble, France, April 2014. Springer.

  • Reinhard von Hanxleden, Björn Duderstadt, Christian Motika, Steven Smyth, Michael Mendler, Joaquín Aguado,

Stephen Mercer, Owen O’Brien. 
 SCCharts: Sequentially Constructive Statecharts for Safety-Critical Applications. 


  • Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’14), Edinburgh,

UK, June 2014. ACM.

  • Reinhard von Hanxleden, Michael Mendler, Joaquín Aguado, Björn Duderstadt, Insa Fuhrmann, Christian Motika,

Stephen Mercer, Owen O’Brien, Partha Roop. 
 Sequentially Constructive Concurrency—A Conservative Extension of the Synchronous Model of Computation. 
 ACM Transactions on Embedded Computing Systems, Special Issue on Applications of Concurrency to System Design, 13(4s):144:1–144:26, July 2014.

  • Christian Schneider, Miro Spönemann, Reinhard von Hanxleden. 


Just Model! – Putting Automatic Synthesis of Node-Link-Diagrams into Practice. 
 Proceedings of the IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC’13), page 75–82, San Jose, CA, USA, Sep. 2013.

  • Xin Li, Reinhard von Hanxleden. 


Multi-Threaded Reactive Programming—The Kiel Esterel Processor. 
 IEEE Transactions on Computers, 61(3):337–349, March 2012.

slide-38
SLIDE 38