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.

Slides:



Advertisements
Similar presentations
Simulation of Feedback Scheduling Dan Henriksson, Anton Cervin and Karl-Erik Årzén Department of Automatic Control.
Advertisements

© 2004 Wayne Wolf Topics Task-level partitioning. Hardware/software partitioning.  Bus-based systems.
Courseware Scheduling of Distributed Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens.
CSE 522 Real-Time Scheduling (4)
Mehdi Kargahi School of ECE University of Tehran
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
1 Quasi-Static Scheduling of Embedded Software Using Free-Choice Petri Nets Marco Sgroi, Alberto Sangiovanni-Vincentelli Luciano Lavagno University of.
Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.
Basic Input/Output Operations
Models of Computation for Embedded System Design Alvise Bonivento.
Courseware Basics of Real-Time Scheduling Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Mahapatra-A&M-Sprong'021 Co-design Finite State Machines Many slides of this lecture are borrowed from Margarida Jacome.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
CprE 458/558: Real-Time Systems
Misconceptions About Real-time Computing : A Serious Problem for Next-generation Systems J. A. Stankovic, Misconceptions about Real-Time Computing: A Serious.
VLSI DSP 2008Y.T. Hwang3-1 Chapter 3 Algorithm Representation & Iteration Bound.
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
More Scheduling cs550 Operating Systems David Monismith.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Scheduling policies for real- time embedded systems.
Real-Time Operating Systems for Embedded Computing 李姿宜 R ,06,10.
Real-Time Systems Mark Stanovich. Introduction System with timing constraints (e.g., deadlines) What makes a real-time system different? – Meeting timing.
Mahapatra-A&M-Fall'001 Co-design Finite State Machines Many slides of this lecture are borrowed from Margarida Jacome.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
RTOS task scheduling models
End-To-End Scheduling Angelo Corsaro & Venkita Subramonian Department of Computer Science Washington University Distributed Systems Seminar, Spring 2003.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
Special Class on Real-Time Systems
CSE 522 Real-Time Scheduling (2)
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Lecture 2, CS52701 The Real Time Computing Environment I CS 5270 Lecture 2.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
Introduction to Real-Time Systems
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 32 – Multimedia OS Klara Nahrstedt Spring 2010.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
Real-Time Operating Systems RTOS For Embedded systems.
Embedded System Scheduling
Process Management Deadlocks.
EMERALDS Landon Cox March 22, 2017.
EEE 6494 Embedded Systems Design
CprE 458/558: Real-Time Systems
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
An Embedded Software Primer
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Presentation transcript:

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 to optimize quality

3 EE249 Outline l Overview –shop scheduling –data-flow scheduling –real-time scheduling –OS scheduling l Real-time scheduling l RTOS generation – scheduling –Communication l Data-flow scheduling –pure –Petri nets

4 EE249 Shop scheduling Single job, one time l finite and known amount of work l multiple resources of different kind l often minimize lateness –could add release, precedence, deadlines,... SOLUTION: compute the schedule APPLICATION: manufacturing

5 EE249 Data-flow scheduling Single-job, repeatedly l known amount of work –simple subtasks l multi-processor l max. throughput, min. latency SOLUTION: code generation APPLICATION: signal processing

6 EE249 Data-flow scheduling variants l Work –data dependent (BDF, FCPN) l Resources –many different execution units (HLS) l Goal –min. code, min. buffers, min. resources

7 EE249 Real-time scheduling Fixed number of repeating jobs l each job has fixed work –job is a sub-task l processor(s) l meet individual deadlines SOLUTION: choose policy, let RTOS implement it APPLICATION: real-time control

8 EE249 RT scheduling variants l Work –sporadic or event-driven tasks, –variable (data dependent) work –coordination between tasks: –mutual exclusion, precedence, … l Goal –event loss, input or output correlation, freshness, soft deadlines,...

9 EE249 OS scheduling Variable number of random tasks l know nothing about sub-tasks l processor + other computer resources l progress of all tasks, average service time SOLUTION: OS implements time-slicing APPLICATION: computer systems

10 EE249 Outline l Overview –shop scheduling –data-flow scheduling –real-time scheduling –OS scheduling l Real-time scheduling l RTOS generation –Scheduling –Communication l Data-flow scheduling –pure –Petri nets

11 EE249 RTOS functions l Enable communication between software tasks, hardware and other system resources l Coordinate software tasks –keep track which tasks are ready to execute –decide which one to execute: scheduling

12 EE249 Outline l Implementing communication through events l Coordination: –classic scheduling results –reactive model of real-time systems –conservative scheduling analysis –priority assignment

13 EE249 The scheduling problem l Given: –estimates on execution times of each task –timing constraints l Find: –an execution ordering of tasks that satisfies constraints l A schedule needs to be: –constructed –validated

14 EE249 Off-line vs. on-line scheduling l Plus side: –simpler –lower overhead –highly predictable l Minus side –bad service to urgent tasks –independent of actual requests

15 EE249 Scheduling Algorithms l off-line (pre-run-time, static) –round-robin, e.g. – C1 C2 C3 C4 C1 C2 C3 C4 C1 C2 C3 C4 … –static cyclic, e. g. –C1 C2 C3 C2 C4 C1 C2 C3 C2 C4 C1 C2 … l on-line (run-time, dynamic) –static priority –dynamic priority –preemptive or not

16 EE249 Static priority scheduling l synthesis: –priority assignment –RMS [LL73] l analysis – Audsley 91

17 EE249 Rate Monotonic Scheduling l Liu -Layland [73] consider systems consisting of tasks: –enabled periodically –with fixed run time –that should be executed before enabled again –scheduled preemptively with statically assigned priorities

18 EE249 Rate Monotonic Scheduling l giving higher priority to tasks with shorter period (RMS) is optimal –if any other static priority assignment can schedule it, them RMS can do it too l define utilization as sum of E i /T i l any set of n tasks with utilization of less than n(2 1/n -1) is schedulable l for n=2,3,…. n(2 1/n -1) = 0.83, 0.78, … ln(2)=0.69

19 EE249 Static Priority Schedule Validation Audsley [91]: l for a task in Liu-Layland’s model find its worst case execution time iiii kn run time i WCET i period i time i

20 EE249 Audsley’s algorithm l let E i ’s be run-times, T i ’s periods l how much can i be delayed by a higher priority task k: –each execution delays it by E k –while i is executing k will be executed ciel(WCET i / T k ) l WCET i = E i + SUM k>i ciel(WCET i / T k )* E k

21 EE249 Solving implicit equation l iteration –WCET i,0 = E i –WCET i,n+1 = E i + SUM k>i ciel(WCET i,n / T k )* E k will converge if processor utilization if less than 1

22 EE249 Dynamic priority l Earliest deadline first: –at each moment schedule a task with the least time before next occurrence l LL have shown that for their model, EDF schedules any feasible set of tasks

23 EE249 What’s wrong with LL model? l Liu-Layland model yields strong results but does not model reactivity well l Our model: –models reactivity directly –abstracts functionality –allows efficient conservative schedule validation

24 EE249 Computation Model l System is a network of internal and external tasks l External tasks have minimum times between execution l Internal tasks have priorities and run times ,21,25,25,23,23,2 2,12,14,14,1

25 EE249 Computation Model ,21,25,25,23,23,2 2,12,14,14,1 l External task execute at random, respecting the lower bound between executions l Execution of a task enables all its successors l Correct if no events are lost

26 EE249 Schedule Validation l To check correctness: –check whether internal events can be lost –priority analysis –check whether external events can be lost –bound WCET

27 EE249 Validation for Internal Events Simple: if priority of i is less than k, then (i,k) cannot be lost ik ik More general: if fan-ins of i form a tree such that leaves have lower priority than non-leaves and k, then (i,k) cannot be lost

28 EE249 Validation for External Events Compute a bound on the period of time a processor executes task of priority i or higher ( i -busy period) ii > i time > i < i i-busy period > i ( i -busy period ) > ( WCET i )

29 EE249 Bounding i -busy Period i -busy period is bounded by: –initial workload at priority level i or higher caused by execution of some task < i –workload at priority level i or higher caused by execution of external tasks during the i -busy period can find (by simulation) workload at priority level i or higher caused by execution of a single task l can bound the number of occurrences of external tasks in a given period l need to solve a fix-point equation

30 EE249 System: Network of CFSMs CFSM2 CFSM3 C=>G CFSM1 C=>F B=>C F^(G==1) (A==0)=>B C=>A C=>B F G C C B A

31 EE249 Implementations l CFSMs can be implemented: –in hardware: HW-CFSMs –in software: SW-CFSMs –by built-in peripherals (e.g. timer): MP-CFSMs

32 EE249 Events: SW to SW l for every event, RTOS maintains –global values –local flags CFSM1 CFSM2 CFSM3 emit x( 3 ) x x x 3 detect x

33 EE249 Events: atomicity problems l TASK 1 detects y AND NOT x, which is never true l to avoid, need atomic detects TASK 1 detect x detect y TASK 2 emit x TASK 3 if detect x then emit y

34 EE249 Events: SW to SW l for atomicity: –always read from frozen –others always write to live –at the beginning of execution, switch CFSM frozenlive

35 EE249 Events: HW to SW l event can be polled or driving an interrupt l for polled events: –allocate I/O port bits for value, occurrence and acknowledge flags –generate the polling task that acknowledges and emits all polled events that have occurred l for events driving an interrupt: –allocate I/O port bits for value, –allocate an interrupt vector, –create an interrupt service routine that emits an event

36 EE249 Events: interrupts l interrupt service routine: l optional interrupt service routine: { emit x } X RTOSRTOS X HW-CFSM SW-CFSM IRQ { emit x execute SW-CFSM }

37 EE249 Events: SW to HW l allocate I/O port bits for value and occurrence flag l use existing ports or memory-mapped ports l write value to I/O port l create a pulse on occurrence flag

38 EE249 Events: SW to/from MP l every peripheral must have a library with –init function (to be called at initialization time) –deliver function for each input (to be called by emit) –detect function for each output (to be called by poll-taker) –interrupt service routine (containing emit)

39 EE249 Coordination l consider SW-CFSM ready to run whenever it has some not consumed input events l choose the next ready SW-CFSM to run: – scheduling problem

40 EE249 Experiments l dashboard –6 tasks, 13 events –0.1s (8.6s to estimate run times) l shock absorber controller –48 tasks, 11 events –0.3s (880s to estimate run times) l PATHO RTOS –orders of magnitude faster than timed automata –scales linearly

41 EE249 Open Problems l Propagation of constraints from external I/O behavior to each CFSM –probabilistic: Markov chains –exact: FSM state traversal l Satisfaction of constraints within a single transition (e.g., software-driven bus interface protocol) l Automatic choice of scheduling algorithm, based on performance estimation and constraints l Scheduling for verifiability

42 EE249 Outline l Overview –shop scheduling –data-flow scheduling –real-time scheduling –OS scheduling l Real-time scheduling l RTOS generation – scheduling –Communication l Data-flow scheduling –pure –Petri nets

43 EE249 Data-flow scheduling l Functionality usually represented with a data-flow graph l Kahn’s conditions allow scheduling freedom –if a computation is specified with actors (operators) and data dependency, and –every actor waits for data on all inputs before firing, and –no data is lost –then the firing order doesn’t matter

44 EE249 Data-flow graphs l Schedule: a firing order that respects data-flow constraints and returns the graph to initial state A, 1B, 2 D, 1 C, 3

45 EE249 Schedule implementation Static scheduling (cyclic executive, round robin) l A, B, C, D are processes l RTOS schedules them repeatedly in order A D B C l simple, but context-switching overhead large A, 1B, 2 D, 1 C, 3 A D B C A schedule:

46 EE249 Schedule implementation Code synthesis (OS generation) l A, B, C, D are subroutines generate: forever{ call A; call D; call B; call C; } l less robust, better overhead A, 1B, 2 D, 1 C, 3 A D B C A schedule:

47 EE249 Schedule implementation In-lined code synthesis l A, B, C, D are code fragments generate: forever{A; D; B; C; } l even less robust, even better overhead A, 1B, 2 D, 1 C, 3 A D B C A schedule:

48 EE249 Data-flow scheduling Resources l fixed or arbitrary number of processors Goal: l max. throughput given a fixed number of processors l min. processors to achieve required throughput

49 EE249 Data-flow scheduling goals Max. throughput given a fixed number of processors l it is NP-hard to determine max. achievable throughput Min. processors to achieve required throughput l if there are loops than there is a fundamental upper bound l easy to compute

50 EE249 Throughput bound 1/max loops (Time/Delay) A, 1B, 2 D, 1 C, 3 N+2’nd output of A can be computed at least 7 time units after the Nth

51 EE249 Scheduling heuristics Non-overlapped scheduling l Look at one iteration l Use list scheduling algorithm (developed for shop scheduling) Overlapped scheduling l less developed

52 EE249 Inter-iteration constraints l Remove delayed edges l List scheduling: –maintain list of tasks that could be scheduled –schedule one with longest path A, 1B, 2 D, 1 C, 3

53 EE249 List scheduling l Assume two processors A, 1B, 2 D, 1 C, 3 3 3

54 EE249 List scheduling A, 1B, 2 D, 1 C, 3 C A P1 P2

55 EE249 List scheduling A, 1B, 2 D, 1 C, 3 C A P1 P2 D

56 EE249 List scheduling A, 1B, 2 D, 1 C, 3 C A P1 P2 DB

57 EE249 Inter-iteration constraints l Unfold k iteration (e.g. k=2) l Do list scheduling A1, 1B1, 2 D1, 1 C1, 3 A2, 1B2, 2 D2, 1 C2, 3

58 EE249 List scheduling l Rate optimal (not true in general) A1, 1B1, 2 D1, 1 C1, 3 A2, 1B2, 2 D2, 1 C2, 3 C1 A1 P1 P2 D1B1 A2 D2 C2 B2

59 EE249 Static data flow l Loop scheduling l Code size l Buffer size ABC 20 10

60 EE249 Loop scheduling ABCBCCC A (2 B (2 C)) A (2 B) (4 C) A (2 B C) (2 C) ABC 20 10

61 EE249 Loop scheduling and code size A (2 B (2 C)) A; for i = 1 … 2 { B; for i = 1 … 2 { C; } l single appearance schedules minimize in-lined code size ABC 20 10

62 EE249 Buffer size ABCBCCC A (2 B (2 C)) A (2 B) (4 C) A (2 B C) (2 C) ABC 20 10

63 EE249 Data-flow scheduling Perfect design-time information l Fixed amount of repeating work –data-independent l Input streams from the environment always available l Simple global constraints data dependency => Petri nets timing constraints => real-time scheduling

64 EE249 Other scheduling models l Problem: computation result may depend on dynamic schedule l Synchronous languages: no scheduler needed (but inapplicable to HW/SW heterogeneous systems) l Data Flow networks: deterministic computation (but blocking read is unsuitable for reactive systems) l Can we obtain determinism without losing efficiency ?