Real Time Operating Systems Scheduling & Schedulers Course originally developed by Maj Ron Smith 8-Oct-15 Dr. Alain Beaulieu Scheduling & Schedulers- 7.

Slides:



Advertisements
Similar presentations
Washington WASHINGTON UNIVERSITY IN ST LOUIS Real-Time: Periodic Tasks Fred Kuhns Applied Research Laboratory Computer Science Washington University.
Advertisements

EE5900 Advanced Embedded System For Smart Infrastructure
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Real Time Scheduling Terminologies define Fixed Priority Scheduler
CSE 522 Real-Time Scheduling (4)
Mehdi Kargahi School of ECE University of Tehran
CSE 522 Real-Time Scheduling (1) Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
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
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
CprE 458/558: Real-Time Systems
Chapter 6: 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 SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Module 2 Clock-Driven Scheduling
Real-Time Systems Lecture 1: Introduction. Course Outline Design Methodologies Scheduling Theory  Schedulability Analysis  Real-Time Scheduling Algorithms.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Real Time Operating Systems Schedulability - Part 3 Course originally developed by Maj Ron Smith 10/24/2015Dr Alain Beaulieu1.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
6. Application mapping 6.1 Problem definition
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
CSE 522 Real-Time Scheduling (2)
Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1.
Module 2 Overview of Real Time System Scheduling
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Common Approaches to Real-Time Scheduling Clock-driven (time-driven) schedulers Priority-driven schedulers Examples of priority driven schedulers Effective.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Dynamic Priority Driven Scheduling of Periodic Task
Introduction to Real-Time Systems
For a good summary, visit:
KUKUM Real Time System Module 2 Real Time Model. KUKUM Real Time System Lecture Outline Why a reference model? Job and task Processors and resources Time.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Clock Driven Scheduling
Clock Driven Schedulers
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Scheduling.
Clock-Driven Scheduling (in-depth) Task Scheduler: i := 0; k := 0; BEGIN LOOP i := i+1; k:= i mod N; IF J(t k-1 )is empty THEN wakeup(aperiodic) ELSE wakeup(J(t.
Embedded System Scheduling
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Wayne Wolf Dept. of EE Princeton University
Chapter 2 Scheduling.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU SCHEDULING.
Chapter 5: CPU Scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
CHAPTER 3 A Reference Model of Real-Time Systems
Module 5: CPU Scheduling
Presentation transcript:

Real Time Operating Systems Scheduling & Schedulers Course originally developed by Maj Ron Smith 8-Oct-15 Dr. Alain Beaulieu Scheduling & Schedulers- 7

Real Time Operating Systems Subtitled …Specifying Timing Constraints Modeling Timing Constraints and Resources 8-Oct-15 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Outline  Scheduling & Resource Management  Approaches to Scheduling (RTS)  Clock-Driven Scheduling  Round-Robin Scheduling  Priority Scheduling  Static versus Dynamic Systems & Scheduling  Periodic task Model  RTOS Schedulers Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Scheduling and Resource Management  Scheduling algorithms - Policy  the rules under which jobs are assigned to processors are defined by the system scheduling algorithm  Resource management (access-control)  the allocation and coordination of the system (passive) resources to jobs is defined by the resource access-control protocols  The scheduler - Mechanism  the module which implements these algorithms and protocols Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Scheduling and Resource Management  Schedules  a schedule is the assignment by the scheduler of all jobs in the system to the available processors  we assume that the scheduler is correct in that ->  It only produces valid schedules 1.at any time one processor is assigned at most one job 2. at any time each job is assigned at most one processor* 3.no job is scheduled before its release time 4.the total amount of processor time allocated is equal to each job’s maximum execution time (or actual)** 5.all precedence and resource constraints are met * implies no parallel processing at job level ** depends on algorithm Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Scheduling and Resource Management  Feasible schedules  a feasible schedule is one in which all jobs meet their timing constraints (usually deadlines)  to say that a set of jobs is schedulable by an algorithm implies that scheduling under this algorithm always produces a feasible schedule  Optimal algorithms  finding feasible schedules is not always easy  an algorithm which always produces a feasible schedule, if one exists, is said to be optimal What does this say about a set of jobs which cannot be scheduled by an optimal algorithm? Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Scheduling and Resource Management  Hierarchical scheduling  rarely is there ever just one scheduler in a RTS, and frequently these multiple schedulers exist within some type of hierarchical structure  may have schedulers of logical / physical devices which exist separate from the application scheduler  monitors, database servers, disk drives...  may have jobs scheduled by the application scheduler which are themselves schedulers  message handlers  Example - a queued aperiodic poller Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Approaches to Scheduling  There are generally three broad classes, or approaches to processor scheduling:  Clock-driven scheduling  Round-robin scheduling  Priority scheduling  One can also classify scheduling schemes according to:  Off-line versus On-line scheduling  Static versus Dynamic scheduling Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Clock-Driven Scheduling  At pre-specified time instants, a job or sequence of jobs are scheduled onto the processor(s)  job/task scheduling is designed off-line  all system job parameters are known a priori and are fixed  scheduling overhead is minimal  may be implemented using a hardware timer mechanism  illustrate by way of example on the board Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Timer-Driven Scheduling  Observe the schedule below for this system: {T 1 = (4,1), T 2 = (5,1.5), T 3 = (20,1), T 4 = (20,2)} hyperperiod, H = 20 slack time (space for asynchronous jobs) T1T1 T1T1 T1T1 T1T1 T1T1 T2T2 T2T2 T2T2 T2T2 T3T3 T4T4 How do we choose this design? How do we implement this design? T1T1 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Timer-Driven Scheduling  Rather than making scheduling decisions at arbitrary times, limit decision making to specific points in the hyperperiod, at frame boundaries hyperperiod, H = 20 frame size, f = 4 T1T1 T1T1 T1T1 T1T1 T1T1 T2T2 T2T2 T2T2 T2T2 T3T3 T4T4 scheduling decision points major cycle No preemption within frames minor cycle on T 1 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Round-Robin Scheduling  In straight round robin scheduling,  ready jobs are inserted in a FIFO queue and when they reach the front of the queue they are given an equal slice of processor time  jobs are preempted at the end of their slice regardless of completion status  therefore in an n job system, each job gets 1/n th of the processor  typically processor time slices are quite short with respect to execution times Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Weighted Round-Robin Scheduling  In weighted round robin scheduling,  each job gets wt slices of the processor time depending upon the weight of the job  therefore in an n job system, job J i gets wt i /(  wt) of the processing time  Example: JobWte% CPU J 1 23___ J 2 57___ J 3 24___ J 4 13___ What would 1 round of time slice scheduling look like? Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Priority-Driven Scheduling  In a priority-driven system, ready jobs are assigned to processors according to their relative priorities  also called greedy scheduling or list scheduling  priorities may be static or dynamic  jobs may be preemptable or nonpreemptable  in general preemptive scheduling feels intuitively better than nonpreemptive  but there are exceptions  Most commonly supported approach in RTOS Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Dynamic versus Static Systems  A dynamic system has a common job priority queue such that when a processor becomes available the next ready job is executed; a static system configures jobs statically on a predefined processor  Intuition says that a dynamic system will have better performance than a static one  again there are exceptions  Within a dynamic system jobs may be able to migrate or not  jobs which can not migrate start on the first available processor, and must finish there Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Dynamic versus Static Priority Scheduling  A dynamic priority scheduling algorithm allows for task / job priorities to change at run-time  With static priority scheduling the tasks / jobs have a fixed (generally) a priori priority assignment  do not confuse this with dynamic & static systems  We will only study fixed (static) priority scheduling algorithms Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Validating the Timing Constraints of a System  Step 1 – specification correctness  Check for consistency/correctness of constraints  Step 2 – task feasibility  Validate that each task can meet its constraints if it were to execute standalone on the processor  Step 3 – system validation*  Validate that all tasks together under the given scheduling & resource management strategy meet their respective constraints * The difficult part! Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 The Periodic Task Model  The periodic task model is a classical workload model of real-time systems; one which we will study further in this course  the underlying assumption is that each regular or semi-regular function of the system be modeled as a periodic task  each periodic task (T i ) is defined by its period (p i ) and its worst-case execution time (e i )  a task’s period is defined as the minimum length of all time intervals between release times of consecutive jobs Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 The Periodic Task Model  The accuracy of the model is dictated by how closely it resembles the system under study  it is quite accurate when the release time jitter is small (best when all tasks are truly periodic) and when the execution times of tasks are well known and have small deviations  conversely the accuracy of the model degrades if the release time jitters are high and/or the execution times have high variance Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 The Periodic Task Model  k jobs in a task T i -> J i,1, J i,2, … J i,k (k is usually infinite)  release time r i,1 of J i,1 defines the phase  of T i  given J 1,1 of (2,7]; {read this as r 1,1 =2, d 1,1 =7}  the phase of T 1,  1 = 2  the hyperperiod (H) of a set of periodic tasks is defined by their least common multiple  given tasks with periods of 3, 8 & 12  H = 24 and the maximum # of jobs N = = 13  the amount of time a task keeps the processor busy is known as utilization  u i = e i / p i Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 The Periodic Task Model  Often we assume that within each task a job releases at the beginning of the period and that it need only complete by the end of the period  -> default deadline is equal to the period (D i = p i )  More generally, D i can be any value  we can model job precedence in terms of release times and deadlines  example: r 1,1 = 0, d 1,1 = 3, r 1,2 = 3, d 1,2 = 7 -> J 1,1 < J 1,2 How can we use deadline to minimize response jitter? Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Release vs Response Time Jitter  Let’s examine the difference between release time jitter and response time jitter of a real- time system modeled under the periodic task model. See Labrosse handout Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Execution Jitter – case 1 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Execution Jitter - case 2 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Execution Jitter - case 3 Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 The Periodic Task Model  Aperiodic and sporadic tasks model events which arrive (release) unpredictably  the inter-arrival times of these tasks are identically distributed random variables  the execution times of these tasks are also i.d. random variables  Aperiodic tasks have jobs with soft or no deadlines  example: Automobile Collision Avoidance System – update situational awareness display  Sporadic tasks have jobs with hard deadlines  example: ACAS – disengage auto-steering Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 Question  What about system overhead times such as context switching? Dr. Alain Beaulieu Scheduling & Schedulers- 7

8-Oct-15 References [1] Liu, J.W.S., “Real-Time Systems”, Prentice- Hall, [2] Labrosse, J.J., “MicroC/OS-II” 1 st and 2 nd Editions (1999, 2002) Dr. Alain Beaulieu Scheduling & Schedulers- 7