1 Quasi-Static Scheduling of Embedded Software Using Free-Choice Petri Nets Marco Sgroi, Alberto Sangiovanni-Vincentelli Luciano Lavagno University of.

Slides:



Advertisements
Similar presentations
Modelos de Computação Básicos Prof. Dr. César Augusto Missio Marcon Parcialmente extraído de trabalhos de Axel Jantch, Edward Lee e Alberto Sangiovanni-Vincentelli.
Advertisements

© 2004 Wayne Wolf Topics Task-level partitioning. Hardware/software partitioning.  Bus-based systems.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Parallelism & Locality Optimization.
Knowledge Based Synthesis of Control for Distributed Systems Doron Peled.
Introduction to Petri Nets Hugo Andrés López
Based on: Petri Nets and Industrial Applications: A Tutorial
Formal Methods for Real- Time Embedded Software Engineering 正規方法應用於即時嵌入式 軟體工程 熊博安 國立中正大學資訊工程學系 民國九十一年五月二十二日.
Chapter 1 An Overview of Computers and Programming Languages.
Algorithms + L. Grewe.
IE 469 Manufacturing Systems
Synthesis of Embedded Software for Reactive Systems Jordi Cortadella Universitat Politècnica de Catalunya, Barcelona Joint work with: Robert Clarisó, Alex.
1 EE249 Scheduling. 2 EE249 What’s the problem? l Have some work to do –know subtasks l Have limited resources l Have some constraints to meet l Want.
DATAFLOW PROCESS NETWORKS Edward A. Lee Thomas M. Parks.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
Overview of PTIDES Project
Synthesis of Embedded Software Using Free-Choice Petri Nets.
I MPLEMENTING S YNCHRONOUS M ODELS ON L OOSELY T IME T RIGGERED A RCHITECTURES Discussed by Alberto Puggelli.
PTIDES: Programming Temporally Integrated Distributed Embedded Systems Yang Zhao, EECS, UC Berkeley Edward A. Lee, EECS, UC Berkeley Jie Liu, Microsoft.
Hardware and Petri nets: application to asynchronous circuit design Jordi CortadellaUniversitat Politècnica de Catalunya, Spain Michael KishinevskyIntel.
Type System, March 12, Data Types and Behavioral Types Yuhong Xiong Edward A. Lee Department of Electrical Engineering and Computer Sciences University.
SCORE - Stream Computations Organized for Reconfigurable Execution Eylon Caspi, Michael Chu, Randy Huang, Joseph Yeh, Yury Markovskiy Andre DeHon, John.
VERTAF: An Application Framework for Design and Verification of Embedded Real-Time Software Pao-Ann Hsiung, Shang-Wei Lin, Chih-Hao Tseng, Trong-Yen Lee,
Timing-Based Communication Refinement for CFSMs Presenters:Heloise Hse, Irene Po Mentors:Jonathan Martin, Marco Sgroi Professor:Alberto Sangiovanni-Vincentelli.
Using Interfaces to Analyze Compositionality Haiyang Zheng and Rachel Zhou EE290N Class Project Presentation Dec. 10, 2004.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
A Schedulability-Preserving Transformation of BDF to Petri Nets Cong Liu EECS 290n Class Project December 10, 2004.
FunState – An Internal Design Representation for Codesign A model that enables representations of different types of system components. Mixture of functional.
Parallel Merging Advanced Algorithms & Data Structures Lecture Theme 15 Prof. Dr. Th. Ottmann Summer Semester 2006.
Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.
Design of Fault Tolerant Data Flow in Ptolemy II Mark McKelvin EE290 N, Fall 2004 Final Project.
Models of Computation for Embedded System Design Alvise Bonivento.
1 Petri Nets Marco Sgroi EE249 - Fall 2002.
1 Petri Nets Marco Sgroi EE249 - Fall 2001 Most slides borrowed from Luciano Lavagno’s lecture ee249 (1998)
Expressing Giotto in xGiotto and related schedulability problems Class Project Presentation Concurrent Models of Computation for Embedded Software University.
CS294-6 Reconfigurable Computing Day 23 November 10, 1998 Stream Processing.
01/27/2005 Combinationality of cyclic definitions EECS 290A – Spring 2005 UC Berkeley.
Merged processes – a new condensed representation of Petri net behaviour V.Khomenko 1, A.Kondratyev 2, M.Koutny 1 and W.Vogler 3 1 University of Newcastle.
Router modeling using Ptolemy Xuanming Dong and Amit Mahajan May 15, 2002 EE290N.
Environment Modeling in Quasi- Static Scheduling EE249 Project Donald Chai Mentors: Alex Kondratyev, Yoshi Watanabe.
BRASS Analysis of QuasiStatic Scheduling Techniques in a Virtualized Reconfigurable Machine Yury Markovskiy, Eylon Caspi, Randy Huang, Joseph Yeh, Michael.
1 Correct and efficient implementations of synchronous models on asynchronous execution platforms Stavros Tripakis UC Berkeley and Verimag EC^2 Workshop,
Course Outline DayContents Day 1 Introduction Motivation, definitions, properties of embedded systems, outline of the current course How to specify embedded.
Voicu Groza, 2008 SITE, HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS Hardware/Software Codesign of Embedded Systems Voicu Groza SITE Hall, Room.
Software Pipelining for Stream Programs on Resource Constrained Multi-core Architectures IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEM 2012 Authors:
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Real-Time Embedded Software Synthesis 即時嵌入式軟體合成 熊博安國立中正大學資訊工程學系民國九十年十一月廿九日.
Time-Memory Scheduling and Code Generation of Real-Time Embedded Software Chuen-Hau Gau and Pao-Ann Hsiung National Chung Cheng University Chiayi, Taiwan,
Real-Time Operating Systems for Embedded Computing 李姿宜 R ,06,10.
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
1 Formal Synthesis and Control of Soft Embedded Real-Time Systems Pao-Ann Hsiung National Chung Cheng University Dept. of Computer Science and Information.
C. André, J. Boucaron, A. Coadou, J. DeAntoni,
Formal Synthesis and Code Generation of Embedded Real-Time Software Pao-Ann Hsiung National Chung Cheng University Chiayi-621, Taiwan, ROC. 9th ACM/IEEE.
The 14 th IEEE Real-Time and Embedded Technology and Applications Symposium, April 2008 Real-Time Distributed Discrete-Event Execution with Fault Tolerance.
Petri Nets Lecturer: Roohollah Abdipour. Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2.
System-level power analysis and estimation September 20, 2006 Chong-Min Kyung.
1 VERTAF: An Object-Oriented Application Framework for Embedded Real-Time Systems Pao-Ann Hsiung*, Trong-Yen Lee, Win-Bin See, Jih-Ming Fu, and Sao-Jie.
1 Copyright  2001 Pao-Ann Hsiung SW HW Module Outline l Introduction l Unified HW/SW Representations l HW/SW Partitioning Techniques l Integrated HW/SW.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
Actor Oriented Programming with CAL -designing embedded system components Johan Eker Department of Automatic Control, Lund University Chris Chang, Jörn.
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
CHaRy Software Synthesis for Hard Real-Time Systems
Advantages of FSM Their simplicity make it easy for inexperienced developers to implement with little to no extra knowledge (low entry level)
Parallel Programming By J. H. Wang May 2, 2017.
Clockless Computing COMP
Parallel Algorithm Design
CSCI1600: Embedded and Real Time Software
A Fusion-based Approach for Tolerating Faults in Finite State Machines
Introduction to Petri Nets (PNs)
CSCI1600: Embedded and Real Time Software
Presentation transcript:

1 Quasi-Static Scheduling of Embedded Software Using Free-Choice Petri Nets Marco Sgroi, Alberto Sangiovanni-Vincentelli Luciano Lavagno University of California at Berkeley Cadence Berkeley Labs Yosinori Watanabe Cadence European Labs EE249 - Fall2001

2 Outline Motivation Scheduling Free-Choice Petri Nets Algorithm

3 Embedded Software Synthesis System specification: set of concurrent functional blocks (DF actors, CFSMs, PNs, …) Software implementation: set of concurrent software tasks Two sub-problems: –Generate code for each task (software synthesis) –Schedule tasks dynamically (dynamic scheduling) Goal: minimize real-time scheduling overhead

4 Petri Nets Model

5 Schedule: t 12, t 13, t a = 5 c = a + b t12 t13 t16

6 Petri Nets Model Shared Processor + RTOS Task 1 Task 2 Task 3

7 Classes of Scheduling Static: schedule completely determined at compile time Dynamic: schedule determined at run-time Quasi-Static: most of the schedule computed at compile time, some scheduling decisions made at run-time (but only when necessary)

8 Embedded Systems Specifications Static Quasi-Static Dynamic Specification Scheduling Data-dependent Control (if..then..else, while..do) Real-time Control (preemption, suspension) Data Processing (+, -, *...)

9 Data Processing i *k2 + o *k1 Schedule: i, *k2, *k1, +, o IIR 2nd order filter o(n)=k 1 o(n-1) + k 2 i(n) Schedule: i, *k1, *k2, +, o

10 Data computation (Multirate) o Fast Fourier Transform i FFT o 256 Schedule: ii…i FFT oo…. o 256 i Sample rate conversion Multirate Data Flow networkPetri Net AB C DE F 5 Schedule: (147A) (147B) (98C) (28D) (32E) (160F)

11 Data-dependent Control io >0 *2 /2 Schedule: i, if (i>0) then{ /2} else{ *2}, o Petri Nets provide a unified model for mixed control and data processing specifications Free-Choice (Equal Conflict) Nets: the outcome of a choice depends on the value of a token (abstracted non-deterministically) rather than on its arrival time

12 Existing approaches Lee - Messerschmitt ‘86 –Static Data Flow: cannot specify data-dependent control Buck - Lee ‘94 –Boolean Data Flow: scheduling problem is undecidable Thoen - Goossens - De Man ‘96 –Event graph: no schedulability check, no minimization of number of tasks Lin ‘97 –Safe Petri Net: no schedulability check, no multi-rate Thiele - Teich ‘99 –Bounded Petri Net: partial schedulability check, complex (reachability-based) algorithm

13 PNs and BDF BDF network F T F T >0 Petri Net t1 t2 t3 t4 t5 <=0 >0 Switch/Select vs. choice/merge PNs: No correlation between different choices TFF

14 PNs and BDF BDF network F T F T >0 Petri Net PNs are not- determinate F t1 t2t4t6 t8 t7t5t3

15 PNs and BDF BDF network F T F T >0 Petri Net PNs are not- determinate TF t1 t2t4t6 t8 t7t5t3

16 PNs and BDF BDF network F T F T >0 Petri Net PNs are not- determinate TTF t1 t2t4t6 t8 t7t5t3

17 Existing approaches Lee - Messerschmitt ‘86 –Static Data Flow: cannot specify data-dependent control Buck - Lee ‘94 –Boolean Data Flow: scheduling problem is undecidable Thoen - Goossens - De Man ‘96 –Event graph: no schedulability check, no minimization of number of tasks Lin ‘97 –Safe Petri Net: no schedulability check, no multi-rate Thiele - Teich ‘99 –Bounded Petri Net: partial schedulability check, complex (reachability-based) algorithm

18 Scheduling Petri Nets Petri Nets provide a unified model for mixed control and dataflow specification Most properties are decidable A lot of theory available Abstract Dataflow networks by representing if-then-else structures as non-deterministic choices Non-deterministic actors (choice and merge) make the network non-determinate according to Kahn’s definition Free-Choice: the outcome of a choice depends on the value of a token (abstracted non-deterministically) rather than on its arrival time

19 Bounded scheduling (Marked Graphs) A finite complete cycle is a finite sequence of transition firings that returns the net to its initial state Bounded memory Infinite execution To find a finite complete cycle solve f(  ) D = 0 t1t1 t2t2 t3t3 T-invariant f(  ) = (4,2,1) 22 2 t1t1 t2t2 t3t3 No schedule D = f(  ) D = 0 has no solution

20 Bounded scheduling (Marked Graphs) Existence of a T-invariant is only a necessary condition Verify that the net does not deadlock by simulating the minimal T-invariant [Lee87] t1t1 t2t2 t3t3 T-invariant f(  ) = (4,2,1) 22 t1t1 t2t t3t3 T-invariant f(  ) = (3,2,1) Deadlock (0,0) t1t1t1t1t2t2t4 t1t1t1t1t2t2t4  = t 1 t 1 t 1 t 1 t 2 t 2 t 4 Not enough initial tokens

21 Free-Choice Petri Nets (FCPN) Marked Graph (MG) Free-Choice Confusion (not-Free-Choice) Free-Choice: choice depends on token value rather than arrival time easy to analyze (using structural methods)

22 t1t1 t2t2 t3t3 t5t5 t6t6 Bounded scheduling (Free-Choice Petri Nets) t1t1 t2t2 t3t3 t4t4 t5t5 t6t6 t7t7 t1t1 t2t2 t3t3 t5t5 t6t6 Can the “adversary” ever force token overflow?

23 t1t1 t2t2 t4t4 t7t7 Bounded scheduling (Free-Choice Petri Nets) t1t1 t2t2 t3t3 t4t4 t5t5 t6t6 t7t7 t1t1 t2t2 t4t4 t7t7 Can the “adversary” ever force token overflow?

24 Bounded scheduling (Free-Choice Petri Nets) t1t1 t2t2 t3t3 t4t4 t5t5 t7t7 t6t6 Can the “adversary” ever force token overflow?

25 Bounded scheduling (Free-Choice Petri Nets) t1t1 t2t2 t3t3 t4t4 t5t5 t7t7 t6t6 Can the “adversary” ever force token overflow?

26 Bounded scheduling (Free-Choice Petri Nets) t1t1 t2t2 t3t3 t4t4 t5t5 t7t7 t6t6 Can the “adversary” ever force token overflow?

27 Schedulability (FCPN) Quasi-Static Scheduling at compile time find one schedule for every conditional branch at run-time choose one of these schedules according to the actual value of the data.  ={(t1 t2 t4),(t1 t3 t5)}

28 Bounded scheduling (Free-Choice Petri Nets) Valid schedule  is a set of finite firing sequences that return the net to its initial state contains one firing sequence for every combination of outcomes of the free choices t3t3 t2t2 t1t1 t5t5 t4t4 Schedulable  ={( t 1 t 2 t 4 ),( t 1 t 3 t 5 )} t3t3 t2t2 t1t1 t5t5 t4t4 (t1 t2 t4)(t1 t2 t4) t3t3 t2t2 t1t1 t5t5 t4t4 (t1 t3 t5)(t1 t3 t5)

29 How to check schedulability Basic intuition: every resolution of data- dependent choices must be schedulable Algorithm: –Decompose (by applying the Reduction Algorithm) the given Equal Conflict Net into as many Conflict-Free components as the number of possible resolutions of the non-deterministic choices. –Check if every component is statically schedulable –Derive a valid schedule, i.e. a set of finite complete cycles one for each conflict-free component

30 Allocatability (Hack, Teruel) An Allocation is a control function that chooses which transition fires among several conflicting ones ( A: P T). A Reduction is the Conflict Free Net generated from one Allocation by applying the Reduction Algorithm. A ECN is allocatable if every Reduction generated from an allocation is consistent. Theorem: A ECN is schedulable iff –it is allocatable and –every Reduction is schedulable (following Lee)

31 Reduction Algorithm t6 t1 t5 t4t2 t7 t6 t7 t1 t4t2 t4t2 t6 t1 t5 t4 t7 t2 t6 t7 t1 t4t2 t1 t3 t5 t4 t6 t2 t7 T-allocation A1={t1,t2,t4,t5,t6,t7}

32 How to find a valid schedule t1t1 t2t2 t4t4 t5t5 t6t6 t7t7 t9t9 t8t8 t 10 t3t3 Conflict Relation Sets:{t2,t3},{t7,t8} T-allocations: A 1 ={t 1,t 2,t 4,t 5,t 6,t 7,t 9,t 10 } A 2 ={t 1,t 3,t 4,t 5,t 6,t 7,t 9,t 10 } A 3 ={t 1,t 2,t 4,t 5,t 6,t 8,t 9,t 10 } A 4 ={t 1,t 3,t 4,t 5,t 6,t 8,t 9,t 10 }

33 Valid schedule t1t1 t2t2 t4t4 t5t5 t6t6 t7t7 t9t9 t1t1 t3t3 t5t5 t6t6 t7t7 t9t9 t1t1 t2t2 t4t4 t6t6 t8t8 t 10 t1t1 t3t3 t5t5 t6t6 t8t8 (t 1 t 2 t 4 t 6 t 7 t 9 t 5 )(t 1 t 3 t 5 t 6 t 7 t 9 t 5 )(t 1 t 2 t 4 t 6 t 8 t 10 )(t 1 t 3 t 5 t 6 t 8 t 10 )

34 C code implementation  ={(t1 t2 t1 t2 t4 t6 t7 t5) (t1 t3 t5 t6 t7 t5)} t1 t3 t5 t4 t2 2 t6t7 Task 1: { t1; if (p1) then{ t2; count(p2)++; if (count(p2) = 2) then{ t4; count(p2) = count(p2) - 2;} else{ t3; t5;} } Task 2: { t6; t7; t5; } p1 p3 p4 p2

35 Application example: ATM Switch Input cells: accept? Output cells: emit? Internal buffer Clock (periodic) Incoming cells (non-periodic) Outgoing cells No static schedule due to: –Inputs with independent rates (need Real-Time dynamic scheduling) –Data-dependent control (can use Quasi-Static Scheduling)

36 Petri Nets Model

37 Decomposition with min # of tasks 2 Tasks Input cell processing Output cell processing

38 Real-time scheduling of independent tasks + RTOS Shared Processor Task 1 Task 2

39 Functional decomposition 4 Tasks Accept/discard cell Output time selector Output cell enablerClock divider

40 ATM: experimental results Sw Implementation QSS Functional partitioning Number of tasks 2 5 Lines of C code Clock cycles Functional partitioning (4+1 tasks)QSS (2 tasks)

41 Conclusion Advantages of Quasi-Static Scheduling: QSS minimizes run-time overhead with respect to Dynamic Scheduling by Automatic partitioning of the system functions into a minimum number of concurrent tasks The underlying model is FCPN: can check schedulability before code generation Future work –Larger PN classes –Code optimizations