Real Time Operating Systems

Slides:



Advertisements
Similar presentations
CPE555A: Real-Time Embedded Systems
Advertisements

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.
Module 2 Priority Driven Scheduling of Periodic Task
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
1 Multiprocessor and Real-Time Scheduling Chapter 10.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
Multiprocessor and Real-Time Scheduling Chapter 10.
1 Scheduling in Representative Operating Systems.
Chapter 5: CPU Scheduling
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
Operating Systems Part III: Process Management (CPU Scheduling)
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
More Scheduling cs550 Operating Systems David Monismith.
Fair Resource Access & Allocation  OS Scheduling
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
ICS Principles of Operating Systems Lecture 5 - CPU Scheduling Prof. Nalini Venkatasubramanian
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.
Chapter 10 Multiprocessor and Real-Time Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Page 1 2P13 Week 9. Page 2 Table 9.2 Scheduling Criteria User Oriented, Performance Related Turnaround time This is the interval of time between the submission.
Multiprocessor and Real-Time Scheduling Chapter 10.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
ICOM Noack Scheduling For Distributed Systems Classification – degree of coupling Classification – granularity Local vs centralized scheduling Methods.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Operating Systems 1 K. Salah Module 2.2: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
RTOS task scheduling models
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
Page 1 2P13 Week 10. Page 2 Page 3 Static table-driven approaches performs a static analysis of feasible schedules of dispatching result is a schedule.
Module 2 Overview of Real Time System Scheduling
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.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
Real time scheduling G.Anuradha Ref:- Stallings. Real time computing Correctness of the system depends not only on the logical result of computation,
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
Real-Time Scheduling --- An Overview Real-Time Scheduling --- An Overview Xiaoping He.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
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.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Real-Time Operating Systems RTOS For Embedded systems.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Principles of Operating Systems Lecture 16 Abhishek Dubey Daniel Balasubramanian Real Time Scheduling Fall 2014.
Embedded System Scheduling
Chapter 2 Scheduling.
Chapter 8 – Processor Scheduling
Real-time Software Design
Lecture 24: Process Scheduling Examples and for Real-time Systems
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
Multiprocessor and Real-Time Scheduling
Process Scheduling Decide which process should run and for how long
CSCI1600: Embedded and Real Time Software
Chapter 10 Multiprocessor and Real-Time Scheduling
Presentation transcript:

Real Time Operating Systems RT Scheduling Real Time Operating Systems Real Time Operating Systems Scheduling Lecturer: Prof. William Fornaciari Politecnico di Milano fornacia@elet.polimi.it www.elet.polimi.it/~fornacia © 2002 - William Fornaciari © 2002 - William Fornaciari

Outline Introduction to Real Time Systems The role of a RTOS Time constraints The problem of scheduling RT activities Classification of scheduling strategies Review of RT scheduling approaches VxWork real-time features Windows CE real-time features Unix SVR4, Win2000, Linux Real Time Operating Systems © 2002 - William Fornaciari

Short-Term Scheduler enables RT The heart of a RTOS is the short-term scheduler Fairness and min avg response time are not paramount crucial: all hard-RT tasks must complete (or start) by their deadline and as many as possible soft-RT tasks should also complete (or start) meeting their deadlines Most current RTOSs are unable to deal with deadlines they are designed to be as responsive as possible to RT tasks, so that, when deadline approaches, they can be quickly scheduled this approach requires deterministic response time sometimes below milliseconds Real Time Operating Systems © 2002 - William Fornaciari

Towards a RT scheduler (1) Round Robin preemptive scheduler The RT task is appended to the ready queue to await its next timeslice The delay can be unacceptable for RT applications Real Time Operating Systems © 2002 - William Fornaciari

Towards a RT scheduler (2) Priority driven nonpreemptive scheduler RT tasks have higher priority A RT task is scheduled when the current P is blocked or runs to completion (even if with low priority) Possible delay of seconds, unacceptable for RT Real Time Operating Systems © 2002 - William Fornaciari

Towards a RT scheduler (3) Priority driven preemptive scheduler on preemption points preemption takes place at the end of some regular intervals in those points, the highest priority task is scheduled (including kernel tasks) delays in the order of some ms, adequate for some applications not for more demanding ones Real Time Operating Systems © 2002 - William Fornaciari

Towards a RT scheduler (4) Immediate preemptive scheduling Apart from the case OS is executing a critical region, the service to the interrupt is almost immediate Scheduling delays fall down to 100 µs, or less Good for critical systems Real Time Operating Systems © 2002 - William Fornaciari

Factors influencing RT scheduling The system performs (or not) schedulability analysis Static vs dynamic schedulability analysis The result of the analysis can be a clear scheduling a strategy (plan) to be followed at run-time for task dispatching Classes of algorithms static table-driven static priority-driven preemptive dynamic planning-based dynamic best-effort Real Time Operating Systems © 2002 - William Fornaciari

Static table driven Through a static feasibility analysis of schedule, determines, at run-time, when a task must begin execution Applicable to periodic tasks Analysis inputs: periodic arrival time execution time periodic ending deadline relative priority of each task Predictable but inflexible approach: any change in the requirements of tasks imply the computation of a new schedule Example: Earliest-deadline-first Real Time Operating Systems © 2002 - William Fornaciari

Static priority-driven preemptive Uses the traditional priority-driven preemptive scheduler Static analysis is performed but no schedule is drawn-up, it is used to assign priorities to task in no RT time-sharing systems, typ priority can change depending on I/O vs CPU bound process nature in RT systems depends on time constraints associated with tasks Example: Rate Monotonic assigns static priorities to tasks based on the lengths of their periods Real Time Operating Systems © 2002 - William Fornaciari

Dynamic planning-based Feasibility is determined at run-time rather then offline A task is accepted for execution iff it is feasible to meet its time constraints before its execution an attempt is made to create a schedule including previous tasks and the new one the deadline of the extended task set must be met Real Time Operating Systems © 2002 - William Fornaciari

Dynamic best-effort Used in many commercial RT systems, easy to implement No feasibility analysis is performed Typ the tasks are aperiodic so that no static scheduling analysis is possible When a task arrives, the system assigna a priority based on its characteristics (e.g. based on earliest deadlines) The system tries to meet deadlines and aborts any started process whose deadline is missed Unitl the task is completed (or deadline arrives), it is unknow if time constraints will be met Real Time Operating Systems © 2002 - William Fornaciari

Deadline based Rate monotonic RT Scheduling Deadline based Rate monotonic © 2002 - William Fornaciari

Deadline scheduling (1) Real-time applications are not concerned with speed but with completing tasks Priorities provide a crude tool and do not capture the requirement of completion (or initiation) at the most valuable time Other deadline related information should be taken into account Real Time Operating Systems © 2002 - William Fornaciari

Deadline scheduling - infomation used Ready time time at which task is ready for execution. For periodic task it is a sequece of times known in advance Starting deadline Completion deadline typical RT application will have either starting or completion deadlines, but not both Processing time in some cases it is supplied, in others OS measures an exponential average Resource requirements in addition to microprocessor Real Time Operating Systems © 2002 - William Fornaciari

Deadline scheduling - infomation used Priority measures relative importance of tasks. Hard-RT tasks have “absolute” priority Subtask structure task possibly decomposed in mandatory (the only with hard RT deadlines) and optional subtasks Real Time Operating Systems © 2002 - William Fornaciari

Design issues considesing deadlines Which task to schedule next? For a given preemption strategy, using either starting or completion deadlines, scheduling tasks with the earliest deadline minimized the fraction of tasks that miss their deadlines (true for single and multiprocessor configurations) What sort of preemption is allowed? When starting deadlines are specified, nonpreemptive scheduler makes sense RT task has the responsability to block itself sfter executing the critical portion, allowing starting other RT deadlines Real Time Operating Systems © 2002 - William Fornaciari

Example Executing profile of two periodic tasks System collecting and processing data from two sensors, A and B Deadlines: A must be read every 20 ms, B every 50 ms Processing time (including OS overhead): 10 ms for A samples, 25 ms for data from B The computer makes scheduling decision every 10 ms Real Time Operating Systems © 2002 - William Fornaciari

Example Executing profile of two periodic tasks Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of periodic RT tasks with Completion deadlines (1) Priority scheduling A has higher priority -> B fails deadline B has higher priority -> A fails deadline Earliest deadline schema the scheduler gives priority at any preemption point to the task with the nearest deadline All the deadlined can be met Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of PERIODIC RT tasks with COMPLETION deadlines (2) Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of APERIODIC RT tasks with STARTING deadlines (1) Five tasks each having execution time of 20 ms Earliest deadline schedule the ready task with the earliest deadline and let the task run to completion The immediate service required by B is denied. Typ case of aperiodic task with starting deadline FCFS Tasks B and E do not meet their deadlines Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of APERIODIC RT tasks with STARTING deadlines (2) Earliest deadline with unforced idle times Refinement possible if deadlines can be know in advance of the time when the task is ready Always schedule the eligible task with the earliest deadline and let the task run to completion Eligible tasks may not be ready -> processor can remain idle though there are ready tasks All the requirements are met, even with non optimal processor exploitation Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of APERIODIC RT tasks with STARTING deadlines (3) Real Time Operating Systems © 2002 - William Fornaciari

Rate Monotonic Scheduling (RMS) Each Task has a period T and an Execution time C for each occurrence of the task In uniprocessor systems C < T Processor Utilization U= C/T (< 100%) Real Time Operating Systems © 2002 - William Fornaciari

Rate Monotonic Scheduling (RMS) Assigns priorities to tasks on the basis of their periods Highest-priority task is the one with the shortest period Real Time Operating Systems © 2002 - William Fornaciari

Scheduling of periodic tasks: evaluation Effectiveness measure of a periodic scheduling algorithm: capability to meet deadlines n tasks with a fixed period and execution time, to meet all deadlines, the processor utilizations of individual tasks must not exceeds the available computational power For RMS, it can be shown Real Time Operating Systems © 2002 - William Fornaciari

RMS - schedulability analysis The total utilization of the tasks must be less than the upper bound Examples of upper bounds n=2: 0.82 n=4: 0.75 n=6:0.73 ... n->:0.693 (ln 2) The same constraint also holds for Earliest Deadline scheduling It is possible to achieve greater processor utilization with the EDF scheduling, nevertheless RMS is widely used for industrial applications…why? Real Time Operating Systems © 2002 - William Fornaciari

RMS wins over EDF? Performance difference is small in practice upper bound is conservative, usage of 90% frequent Most Hard RT systems also have soft RT components e.g. built-in self test, displays, … can execute with low priority to absorb processor time left by RMS Stability is easier to achieve with RMS in case system problems(e.g. due to transient errors), deadlines of essential tasks must be guaranteed in static priority assignment one only need to ensure that essential tasks have relatively high priorities in RMS is sufficient to organize essential tasks to have short periods or to modify RMS priority in EDF a periodic task’s priority can change from one period to another, difficult to meet deadlines Real Time Operating Systems © 2002 - William Fornaciari

RT Scheduling - Addendum Cyclic Scheduling Deterministic Scheduling Capacity-Based Scheduling Dynamic Priority Scheduling Scheduling Tasks with Imprecise Results © 2002 - William Fornaciari

Scheduling Cyclic Scheduling Deterministic Scheduling Capacity-Based Scheduling Dynamic Priority Scheduling Scheduling Tasks with Imprecise Results Real Time Operating Systems © 2002 - William Fornaciari

Cyclic Executive A cyclic executive is a supervisory control program It schedules tasks according to schedule constructed during the system design phase The schedule consists of a sequence of action to be taken Long-term external conditions are used to choose a schedule for execution Real Time Operating Systems © 2002 - William Fornaciari

Cyclic Scheduling(1) The cyclic executive provides a practical means for executing a cyclic schedule The cyclic schedule is a timed sequence of computations which is to be repeated indefinitely, in a cyclic manner Real Time Operating Systems © 2002 - William Fornaciari

Cyclic Scheduling(2) Event-based processing can be handled with the cyclic schedule in different ways Higher priority to the processes that are reacting to events Allocate slots in scheduling where aperiodic, event-based processes can be serviced Service aperiodic events in the background Real Time Operating Systems © 2002 - William Fornaciari

Cyclic Scheduling (3) Deterministic scheduling theory may be used to help find schedules Optimal deterministic scheduling algorithms require a priori knowledge Optimal non-preemptive scheduling of computations with timing constraints is NP-Hard Real Time Operating Systems © 2002 - William Fornaciari

Cyclic Scheduling(4) Advantages Critical issues Simple to implement, efficient, predictable Critical issues Design Runtime: the system cannot adapt to a dynamically changing environment Maintenance: the code may reflect job splitting and sequencing details of the schedule Real Time Operating Systems © 2002 - William Fornaciari

Deterministic Scheduling(1) It provides methods for constructing schedules in which the assignment of tasks to processors is known exactly for each point in time Information needed apriori: Vector processing time Arrival time Deadline Priority Task splitting (preemtion vs non-preemption) Real Time Operating Systems © 2002 - William Fornaciari

Deterministic Scheduling(2) A schedule is an assignment of processors to tasks Each task in a schedule has: Completion time Flow time Lateness Tardiness Unit penalty Schedules are evaluated using: Schedule length Mean flow time Mean weigthed flow time Maximum lateness Mean tardiness Mean weigthed tardiness Number of tardy tasks Real Time Operating Systems © 2002 - William Fornaciari

Deterministic Scheduling(3) Properties of scheduling: Not only measures for evaluating but also criteria for optimization Many of optimization problems are NP-hard Approximate solutions are found by relaxing some assumption Real Time Operating Systems © 2002 - William Fornaciari

Deterministic Scheduling(4) Limits of deterministic schedule: The computation times are not known in advance Time to produce a schedule is larger than the time it takes to service the tasks Tasks arrive dynamically, updated schedule is needed Real Time Operating Systems © 2002 - William Fornaciari

Capacity-Based Scheduling(1) Requirements: Information about the amount of computation The amount of computation available For a restricted class of real-time activities it’s possible to determine if a task is schedulable Real Time Operating Systems © 2002 - William Fornaciari

Capacity-Based Scheduling(2) Assumptions: Each task in the task set must be periodic The deadline is the end of the period The computation time must me constant Neither communication nor synchronization between tasks No critical regions in any of the computation Real Time Operating Systems © 2002 - William Fornaciari

Capacity-Based Scheduling(3) Schedule by using fixed priority preemptive scheduling Order the tasks according to their frequency Assign integer priorities to the tasks The haigher priority assigned to highest frequency task This is called: Rate Monotonic Priority Assignment Real Time Operating Systems © 2002 - William Fornaciari

Scheduling: Dynamic Priority Scheduling(1) Task priorities may change The approach: Define a selection discipline Make on-line scheduling decisions Consider the instantaneous state of the system Real Time Operating Systems © 2002 - William Fornaciari

Scheduling: Dynamic Priority Scheduling(2) Earliest-deadline-first: All tasks are ready at time t=0 The computations are non-preemptive If the algorithm can schedule without missing any deadlines it minimizes the maximum lateness in the task set. Real Time Operating Systems © 2002 - William Fornaciari

Scheduling: Dynamic Priority Scheduling(3) Least-slack-time: The slack-timeis the amount of time that the task can be delayed without missing its deadline Order tasks according to nondecreasing slack-time It maximizes minimum task lateness and minimum task tardiness Real Time Operating Systems © 2002 - William Fornaciari

Scheduling: Scheduling Tasks with Imprecise Results(1) Considerations: A certain amount of processor time will produce a reasonably accurate result. Any additional processing time will increase the accuracy Each task is considered to be diveded into: A mandatory subtask An optional subtask Real Time Operating Systems © 2002 - William Fornaciari

Scheduling: Scheduling Tasks with Imprecise Results(2) The schedule guarantees: All mandatory subtasks will be completed by their deadlines. The optinal subtasks are scheduled in the remaining processor time. Scheduling algorithms: Mandatory subtasks: traditional deterministic scheduling theory Optional subtasks: various scheduling criteria Real Time Operating Systems © 2002 - William Fornaciari