CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.

Slides:



Advertisements
Similar presentations
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
Advertisements

Washington WASHINGTON UNIVERSITY IN ST LOUIS Real-Time: Periodic Tasks Fred Kuhns Applied Research Laboratory Computer Science Washington University.
Real Time Scheduling.
EE5900 Advanced Embedded System For Smart Infrastructure
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
CPE555A: Real-Time Embedded 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
Mapping of Applications to Platforms Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These slides.
Is It Time Yet? Wing On Chan. Distributed Systems – Chapter 18 - Scheduling Hermann Kopetz.
1 Swiss Federal Institute of Technology Computer Engineering and Networks Laboratory Embedded Systems Exercise 2: Scheduling Real-Time Aperiodic Tasks.
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.
Module 2 Priority Driven Scheduling of Periodic Task
Mapping of Applications to Platforms Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These slides.
Preemptive Behavior Analysis and Improvement of Priority Scheduling Algorithms Xiaoying Wang Northeastern University China.
Deterministic Scheduling
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
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.
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
Technische Universität Dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2007/12/14.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Module 2 Clock-Driven Scheduling
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
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.
Multiprocessor Real-time Scheduling Jing Ma 马靖. Classification Partitioned Scheduling In the partitioned approach, the tasks are statically partitioned.
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 31 – Multimedia OS (Part 1) Klara Nahrstedt Spring 2011.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Real-Time Scheduling CS 3204 – Operating Systems Lecture 20 3/3/2006 Shahrooz Feizabadi.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
5 May CmpE 516 Fault Tolerant Scheduling in Multiprocessor Systems Betül Demiröz.
6. Application mapping 6.1 Problem definition
Undergraduate course on Real-time Systems Linköping 1 of 45 Autumn 2009 TDDC47: Real-time and Concurrent Programming Lecture 5: Real-time Scheduling (I)
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
Mapping: Applications  Processors
Special Class on Real-Time Systems
12/19/2015COSC , Lecture 31 Real-Time Systems, COSC , Lecture 3 Stefan Andrei.
CSE 522 Real-Time Scheduling (2)
Module 2 Overview of Real Time System Scheduling
Real-Time systems By Dr. Amin Danial Asham.
Real-Time Scheduling CS 3204 – Operating Systems Lecture 13 10/3/2006 Shahrooz Feizabadi.
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.
Introduction to Embedded Systems Rabie A. Ramadan 5.
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.
Dynamic Priority Driven Scheduling of Periodic Task
Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2012 年 12 月 19 日 These slides use Microsoft clip.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
Introduction to Real-Time Systems
2/23/2016COSC , Lecture 21 Real-Time Systems, COSC , Lecture 2 Stefan Andrei.
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.
Lecture 6: Real-Time Scheduling
Real-Time Operating Systems RTOS For Embedded systems.
Embedded System Scheduling
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Wayne Wolf Dept. of EE Princeton University
EEE 6494 Embedded Systems Design
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Real-Time Process Scheduling Concepts, Design and Implementations
Real-Time Process Scheduling Concepts, Design and Implementations
Presentation transcript:

CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010

Winter CS CS244 – Lecture 4 Real Time Scheduling

Winter CS Embedded Systems Design Flow Concept Concept Specification HW/SWPartitioning Hardware Components Software Components Estimation - Exploration Hardware Software Design (Synthesis, Layout, …) Design (Compilation, …) Validation and Evaluation (area, power, performance, …)

Winter CS Reuse of standard software components Knowledge from previous designs to be made available in the form of intellectual property (IP, for SW & HW).  Operating systems  Middleware  Real-time data bases  Standard software (MPEG-x, GSM-kernel, …) Includes standard approaches for scheduling (requires knowledge about execution times).

Winter CS Software Components Prediction of execution time Scheduling in real-time systems  Classification of scheduling algorithms  Aperiodic scheduling  Periodic scheduling Embedded operating systems  Real-time OS Middleware

Winter CS Worst Case Execution Time Def.: The worst case execution time (WCET) is an upper bound on the execution times of tasks.  Computing such a bound is undecidable Possible for programs without recursion and finite loops  Pipeline hazards, interrupts, caches  serious overestimates Approaches:  for hardware: typically requires hardware synthesis  for software: requires availability of machine programs; complex analysis

Winter CS Average Execution Time Estimated cost and performance values  Difficult to generate sufficiently precise estimates; Balance between run-time and precision Accurate cost and performance values  Can be done with normal tools (such as compilers). As precise as the input data is.

Winter CS Real-Time Scheduling Assume that we have a task graph G=(V,E). A schedule of G is a mapping, V  T, of a set of tasks V to start times from domain T. Schedules have to respect a set of constraints, such as resource, dependency, and deadlines.  Scheduling is the process of finding such a mapping. During the design of embedded systems, scheduling has to be performed several times  early rough scheduling as well as late precise scheduling

Winter CS Classification of Scheduling Algorithms

Winter CS Hard and soft deadlines Def.: A time-constraint (deadline) is called hard if not meeting that constraint could result in a catastrophe [Kopetz, 1997]. All other time constraints are called soft. We will focus on hard deadlines.

Winter CS Periodic and aperiodic tasks Def.: Tasks which must be executed once every p units of time are called periodic tasks. p is called their period. Each execution of a periodic task is called a job.  All other tasks are called aperiodic. Def.: Aperiodic tasks requesting the processor at unpredictable times are called sporadic, if there is a minimum separation between the times at which they request the processor.

Winter CS Preemptive and Non-preemptive Scheduling Preemptive and non-preemptive scheduling: Non-preemptive schedulers are based on the assumption that tasks are executed until they are done. As a result the response time for external events may be quite long if some tasks have a large execution time.  Preemptive schedulers have to be used if some tasks have long execution times or if the response time for external events is required to be short.

Winter CS Static and dynamic scheduling Dynamic scheduling: Processor allocation decisions (scheduling) done at run-time. Static scheduling: Processor allocation decisions (scheduling) done at design-time.  Dispatcher allocates processor when interrupted by a timer. The timer is controlled by a table generated at design time.

Winter CS Time-Triggered Systems Entirely time-triggered system  the temporal control structure of all tasks is established a priori by off-line support-tools.  Temporal control structure is encoded in a Task-Descriptor List (TDL) that contains the cyclic schedule for all activities of the node.  This schedule considers the required precedence and mutual exclusion relationships among the tasks such that an explicit coordination of the tasks by the operating system at run time is not necessary... The dispatcher is activated by the synchronized clock tick.  It looks at the TDL, and then performs the action that has been planned for this instant. [Kopetz]  The only practical means of providing predictability. It can be easily checked if timing constraints are met.  Response to sporadic events may be poor.

Winter CS Centralized and Distributed Scheduling Centralized and distributed scheduling  Multiprocessor scheduling either locally on one or distributed on several processors Mono- and multi-processor scheduling  Simple scheduling algorithms handle single processors, more complex algorithms handle multiple processors. Online- and offline scheduling:  Online scheduling is done at run-time based on the information about the tasks arrived so far.  Offline scheduling assumes prior knowledge about arrival times, execution times, and deadlines.

Winter CS Schedulability A set of tasks is said to be schedulable under a given set of constraints, if a schedule exists for that set of tasks and constraints.  Exact tests are NP-hard in many situations.  Sufficient tests: sufficient conditions for guaranteeing a schedule are checked. Small probability of false negative.  Necessary tests: checking necessary conditions. Can be used to show that no schedule exists. Always not possible to prove even if no schedule exists.

Winter CS Cost Functions Cost function: Different algorithms aim at minimizing different functions. Def.: Maximum lateness is defined as the difference between the completion time and the deadline, maximized over all tasks.  Maximum lateness is negative if all tasks complete before their deadline.

Winter CS Simple Tasks Tasks without any interprocess communication are called simple tasks (S-tasks).  S-tasks can be either ready or running. API of an S-task in a TT system: Two OS Calls  TERMINATE TASK and ERROR  The TERMINATE TASK system call is executed whenever the task has reached its termination point.  In case of an error that cannot be handled within the application task, the task terminates its operation with the ERROR system call. [Kopetz, 1997].

Winter CS Scheduling with no Precedence Constraints Let {T i } be a set of tasks. Let:  c i be the execution time of T i,  d i be the deadline interval, that is, the time between T i becoming available  and the time until which T i has to finish execution.  l i be the laxity or slack, defined as l i = d i - c i

Winter CS Uniprocessor with Equal Arrival Times Earliest Due Date (EDD):  Given a set of n independent tasks, any algorithm that executes the tasks in order of non-decreasing deadlines is optimal with respect to minimizing the maximum lateness. Proof: See [Buttazzo, 2002]  EDD requires all tasks to be sorted by their deadlines. Complexity is O(n log(n)).

Winter CS Earliest Deadline First (EDF) Different arrival times  Preemption potentially reduces lateness. Theorem [Horn74]: Given a set of n independent tasks with arbitrary arrival times, any algorithm that at any instant executes the task with the earliest absolute deadline among all the ready tasks is optimal with respect to minimizing the maximum lateness. Earliest deadline first (EDF): each time a new ready task arrives, it is inserted into a queue of ready tasks, sorted by their deadlines. If a newly arrived task is inserted at the head of the queue, the currently executing task is preempted.  If sorted lists are used, the complexity is O(n 2 )

Winter CS Earliest Deadline First (EDF) Later deadline  no preemption Earlier deadline  preemption

Winter CS Least laxity, Least Slack Time First priorities = decreasing function of the laxity (the less laxity, the higher the priority); dynamically changing priority; preemptive. Requires calling the scheduler periodically, and to recompute the laxity. Overhead for many calls of the scheduler and many context switches.Detects missed deadlines early.

Winter CS LL/LSF Properties LL/LSF is also an optimal scheduling for uni-processor systems.  BUT… uses Dynamic priorities, therefore cannot be used with a fixed priority OS. LL/LSF scheduling requires the knowledge of the execution time  May not know this in advance!

Winter CS Scheduling without Preemption Optimal schedules may leave processor idle to finish tasks with early deadlines arriving late.  Knowledge about the future is needed for optimal scheduling algorithms No online algorithm can decide whether or not to keep idle. EDF is optimal among all sched. algorithms not keeping the processor idle at certain times. If arrival times are known a priori, the sched. problem becomes NP-hard in general.  Branch and bound techniques are typically used.

Winter CS Scheduling with Precedence Constraints Task graph and possible schedule: Schedule can be stored in a table. (can be used by dispatcher/OS) Schedule can be stored in a table. (can be used by dispatcher/OS)

Winter CS Synchronous Arrival Times Optimal algorithm for minimum latency  Latest Deadline First (LDF) LDF [Lawler, 1973]: Generation of total order compatible with the partial order described by the task graph (LDF performs a topological sort). LDF reads the task graph and inserts tasks with no successors into a queue. It then repeats this process, putting tasks whose successor have all been selected into the queue.  At run-time, the tasks are executed in the generated total order.  LDF is non-preemptive and is optimal for uni-processors. Latest Deadline First (LDF)

Winter CS Asynchronous Arrival Times This case can be handled with a modified EDF algorithm.  The key idea is to transform the problem from a given set of dependent tasks into a set of independent tasks with different timing parameters [Chetto90] This algorithm is optimal for uni-processor systems. If preemption is not allowed, the heuristic algorithm developed by [Stankovic and Ramamritham 1991] can be used.

Winter CS Periodic Scheduling For periodic scheduling, the best that we can do is to design an algorithm which will always find a schedule if one exists.  A scheduler is defined to be optimal iff it will find a schedule if one exists. T1 T2

Winter CS Periodic scheduling Let  p i be the period of task T i,  c i be the execution time of T i,  d i be the deadline interval, that is, the time between a job of T i becoming available and the time after which the same job T i has to finish execution.  l i be the laxity or slack, defined as l i = d i - c i

Winter CS Accumulated Utilization Accumulated utilization: Necessary condition for schedulability (with m=number of processors): Accumulated execution time divided by period

Winter CS Rate Monotonic (RM) Scheduling Well-known technique for scheduling independent periodic tasks [Liu, 1973]. Assumptions:  All tasks that have hard deadlines are periodic.  All tasks are independent.  d i =p i, for all tasks.  c i is constant and is known for all tasks.  The time required for context switching is negligible Establish condition for schedulability!

Winter CS Rate Monotonic (RM) Scheduling RM Schedulability Condition  For a single processor with n tasks, the following equation must hold for the accumulated utilization µ: 

Winter CS Rate Monotonic (RM) Scheduling RM policy: The priority of a task is a monotonically decreasing function of its period. low period: high priority At any time, a highest priority task among all those that are ready for execution is allocated. If all assumptions are met, schedulability is guaranteed. RM policy: The priority of a task is a monotonically decreasing function of its period. low period: high priority At any time, a highest priority task among all those that are ready for execution is allocated. If all assumptions are met, schedulability is guaranteed. Maximum utilization as a function of the number of tasks:

Winter CS Example: RM-generated schedule T1 preempts T2 and T3. T2 and T3 do not preempt each other. Period Execution Time T1: T2: 6 2 T3:

Winter CS Case of failing RM scheduling Task 1: period 5, execution time 2 Task 2: period 7, execution time 4 µ=2/5+4/7=34/35  (2 1/2 -1)  Missed deadline Missing computations scheduled in the next period Not enough idle time

Winter CS Properties of RM Scheduling RM scheduling is based on static priorities.  This allows RM scheduling to be used in standard OS, such as Windows NT.  A huge number of variations of RM scheduling exists. In the context of RM scheduling, many formal proofs exist. The idle capacity is not required if the period of all tasks is a multiple of the period of the highest priority task  Necessary condition for schedulability: µ  1

Winter CS EDF EDF can also be applied to periodic scheduling. EDF optimal for every period  optimal for periodic scheduling trivially!  EDF must be able to schedule the example in which RMS failed.

Winter CS Comparison EDF/RMS EDF: T2 not preempted, due to its earlier deadline. RMS:

Winter CS EDF: Properties EDF requires dynamic priorities  EDF cannot be used with a standard operating system just providing static priorities. EDF requires dynamic priorities  EDF cannot be used with a standard operating system just providing static priorities.

Winter CS Dependent Tasks The problem of deciding whether or not a schedule exists for a set of dependent tasks and a given deadline is NP-complete [Garey/Johnson]. Strategies:  Add resources, so that scheduling becomes easier  Split problem into static and dynamic part so that decisions during run-time is minimized.

Winter CS Sporadic Tasks If sporadic tasks were connected to interrupts, the execution time of other tasks would become very unpredictable.  Introduction of a sporadic task server, periodically checking for ready sporadic tasks;  Sporadic tasks are essentially turned into periodic tasks.

Winter CS Summary Prediction of execution time Scheduling in real-time systems  Classification of scheduling algorithms  Aperiodic scheduling  Periodic scheduling