modeling heterogeneous modeling heterogeneous real time
play

Modeling Heterogeneous Modeling Heterogeneous Real- -time - PowerPoint PPT Presentation

Modeling Heterogeneous Modeling Heterogeneous Real- -time Components in BIP time Components in BIP Real Joseph Sifakis Sifakis Joseph in collaboration with Ananda Basu and Marius Bozga VERIMAG Composition of Embedded Systems Scientific


  1. Modeling Heterogeneous Modeling Heterogeneous Real- -time Components in BIP time Components in BIP Real Joseph Sifakis Sifakis Joseph in collaboration with Ananda Basu and Marius Bozga VERIMAG Composition of Embedded Systems Scientific and Industrial Issues Monterey Workshop Paris, October 16-18, 2006 1

  2. Component- -based construction based construction – – Objectives Objectives Component Develop a rigorous and general basis for real-time system design and implementation: • Concept of component and associated composition operators for incremental description and correctness by construction • Concept for real-time architecture encompassing heterogeneity, paradigms and styles of computation e.g. � Synchronous vs. asynchronous execution � Event driven vs. data driven computation � Distributed vs. centralized execution • Automated support for component integration and generation of glue code meeting given requirements 2

  3. Approches involving components Approches involving components • Theory such as process algebras and automata • SW Component frameworks, such as � Coordination languages extensions of programming languages : Linda, Javaspaces, TSpaces, Concurrent Fortran, NesC � Middleware e.g. Corba, Javabeans, .NET � Software development environments: PCTE, SWbus, Softbench, Eclipse • System modeling languages: SystemC, Statecharts, UML, Simulink/Stateflow, Metropolis, Ptolemy • Architecture Description Languages focusing on non-functional aspects e.g. AADL Lack of • frameworks treating interactions and system architecture as first class entities that can be composed and analyzed (usually, interaction by method call) • rigorous models for behavior and in particular aspects related to time and resources. 3

  4. Sources of heterogeneity heterogeneity [ Sources of [Henzinger Henzinger& &Sifakis Sifakis FM06] FM06] Heterogeneity of interaction • Atomic or non atomic • Rendezvous or Broadcast • Binary or n-ary Heterogeneity of execution • Synchronous execution • Asynchronous execution • Combinations of them Heterogeneity of abstraction e.g. granularity of execution 4

  5. Sources of heterogeneity - - Example Example Sources of heterogeneity A: Atomic interaction R: Rendezvous B: Broadcast Java SDL UML UML Asynchronous Computation Lotos CSP A R nonA R A B nonA B Synchronous Computation Matlab/Simulink VHDL/SystemC Synchronous languages 5

  6. Component- -based construction based construction – – The BIP framework The BIP framework Component Layered component model Priorities (Conflict resolution) Interaction Model (Collaboration) B E H A V I O R Composition (incremental description) PR1 ⊕ PR2 ⊕ PR12 PR1 PR2 IM1 ⊗ IM2 ⊗ IM12 IM1 IM1 IM2 || 6

  7. Component- -based construction based construction – – The BIP framework: Behavior The BIP framework: Behavior Component An atomic component has • A set of ports P, for interaction with other components •A set of control states S • A set of variables V p g p f p • A set of transitions of the form s1 � p is a port s2 � g p is a guard, boolean expression on V � f p is a function on V (block of code) full get, 0<x put put get y:=f(x) x y empty 7

  8. Component- -based construction based construction – – The BIP framework: Behavior The BIP framework: Behavior Component p g p f p s1 s2 p: a port through which interaction is sought g p : a pre-condition for interaction through p f p : a computation (local state transformation) Semantics • Enabledness: g p is true and some interaction involving p is possible • Execution: interaction involving p followed by the execution of f p 8

  9. Overview Overview • Interaction modeling • Priority modeling • Implementation • Modeling systems in BIP • Discussion 9

  10. Interaction modeling Interaction modeling • A connector is a set of ports which can be involved in an interaction • Port attributes ( complete , incomplete ) are used to distinguish between rendezvous and broadcast. • An interaction of a connector is a set of ports such that: either it contains some complete port or it is maximal. tick1 tick2 tick3 out1 in2 in3 Interactions: {tick1,tick2,tick3} {out1} {out1,in2} {out1,in3} {out1,in2, in3} 10

  11. Interaction nteraction modeling modeling - - Examples Examples I cl1,cl2 cl1 cl2 CN:{cl1,cl2} cl1 cl2 CP: ∅ out, in CN:{out,in} out in CP: {out} out in in1,out,in2 out in1 CN:{in1,out,in2} out,in1 in1,in2 out,in2 CP: {out} in1 in2 out in2 11

  12. Interaction modeling – – Composition Composition Interaction modeling CN[P,C]: {put,get} CP[P,C]: ∅ CN[P]: {put},{prod} CN[C]: {get}, {cons} CP[P]: {prod} CP[C]: {cons} ⎢⎢ prod put get cons CN: {put,get},{prod},{cons} CP: {prod},{cons} prod put get cons 12

  13. Interaction modeling – – D Data ata transfer transfer Interaction modeling CN: BUS={send,rec1,rec2} {send}: true → skip {send,rec1}: x<y → x:=y-x, y:=y+x {send,rec2}: x<z → x:=z-x, z:=z+x {send,rec1,rec2}: x<z+y → x:=y+z-x, y:=y+x, z:=z+x send x rec1 y rec2 z • Notice the difference between control flow and data flow (input, output) • Maximal progress: execute a maximal enabled interaction 13

  14. Overview Overview • Interaction modeling • Priority modeling • Implementation • Modeling systems in BIP • Discussion 14

  15. Priorities Priorities Priorities are a powerful tool for restricting non-determinism: • they allow straightforward modeling of urgency and scheduling policies for real-time systems • run to completion and synchronous execution can be modeled by assigning priorities to threads • they can advantageously replace (static) restriction of process algebras 15

  16. Priorities - - Definition Definition Priorities Priority rules p1 p2 g1 g2 Priority rule Restricted guard g1’ true → p1 〈 p2 g1’ = g1 ∧ ¬ g2 C → p1 〈 p2 g1’ = g1 ∧ ¬ ( C ∧ g2 ) 16

  17. Priorities – – Example: FIFO policy Example: FIFO policy Priorities t1 ≤ t2 → b1 〈 b2 t2 < t1 → b2 〈 b1 sleep1 sleep2 a1 a2 start t1 start t2 wait2 wait1 b2 b1 e2 e1 # use1 use2 17

  18. Priorities – – Example: EDF policy Example: EDF policy Priorities D1-t1 ≤ D2-t2 → b2 〈 b1 D2-t2 < D1-t1 → b1 〈 b2 sleep1 sleep2 a1 a2 start t1 start t2 wait2 wait1 b2 b1 t1 ≤ D1 t2 ≤ D2 e2 e1 # use1 use2 18

  19. Priorities – – Composition Composition Priorities pr2 ≠ pr1 pr1 pr2 b 〈 2 c a 〈 1 b c c b a c b b 〈 2 c a c a c a 〈 1 b 19

  20. Priorities – – Composition (2) Composition (2) Priorities Take: pr2 pr1 ⊕ pr2 pr1 = pr1 ⊕ pr2 is the least priority containing pr1 ∪ pr2 Results : •The operation ⊕ is partial, associative and commutative • pr1(pr2(B)) ≠ pr1(pr2(B)) • pr1 ⊕ pr2(B) refines pr1 ∪ pr2(B) refines pr1(pr2(B)) • Priorities preserve deadlock-freedom 20

  21. Priorities – – Example: Mutual exclusion + FIFO policy Example: Mutual exclusion + FIFO policy Priorities t1 ≤ t2 → b1 〈 b2 t2 < t1 → b2 〈 b1 true → b1 〈 e2 true → b2 〈 e1 sleep1 sleep2 a1 a2 start t1 start t2 wait2 wait1 b2 b1 e2 e1 use1 use2 21

  22. Priorities – – Checking for deadlock Checking for deadlock- -freedom: Example freedom: Example Priorities Mutex on R’ : b1 〈 f2 b2 〈 { f1, b1’} Mutex on R : b1’ 〈 { f2, b2 } b2’ 〈 f1 w2 w1 a2 a1 b1 b2’ s1 s2 R’ R f2 f1 b1’ b2 RR’ RR’ Risk of deadlock: b1’ 〈 b2 and b2 〈 b1’ 22

  23. Overview Overview • Interaction modeling • Priority modeling • Implementation • Modeling systems in BIP • Discussion 23

  24. Implementation – – the BIP toolset the BIP toolset Implementation Graphic language AADL or UML BIP language THINK C++ IF BIP Platform IF Platform 24

  25. Implementation – – C++ code generation for the BIP platform C++ code generation for the BIP platform Implementation Component Meta-model Interaction Meta-model Priority C → a 〈 b Meta-model BIP model Engine BIP Platform 25

  26. Implementation – – T The BIP platform he BIP platform Implementation Interaction model Priorities E E n n g g i i n n e e • C o d e e x e c u t i o n a n d s t a t e s p a c e e x p l o r a t i o n f e a t u r e s • I m p l e m e n t a t i o n i n C + + o n L i n u x u s i n g P O S I X t h r e a d s 26

  27. Implementation – – The BIP platform The BIP platform : The engine Implementation : The engine init Launch atom’s threads loop Notify Wait involved atoms all atoms execute stable Execute chosen Compute interaction transfer legal interactions choose ready Choose Filter among maximal w.r.t. priorities filter 27

Recommend


More recommend