CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.

Slides:



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

Real Time Scheduling.
Time Demand Analysis.
Priority INHERITANCE PROTOCOLS
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
CPE555A: Real-Time Embedded Systems
Real Time Scheduling Terminologies define Fixed Priority Scheduler
CSE 522 Real-Time Scheduling (4)
An Introduction to Real Time Systems
Task Allocation and Scheduling n Problem: How to assign tasks to processors and to schedule them in such a way that deadlines are met n Our initial focus:
Module 2 Priority Driven Scheduling of Periodic Task
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.
Embedded Systems Exercise 3: Scheduling Real-Time Periodic and Mixed Task Sets 18. May 2005 Alexander Maxiaguine.
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.
Technische Universität Dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2007/12/14.
Module 2 Clock-Driven Scheduling
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
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.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Prepare by : Ihab shahtout.  Overview  To give an overview of fixed priority schedule  Scheduling and Fixed Priority Scheduling.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
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)
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
KUKUM Real Time System 1/21 Module 2 Real Time System Scheduling Lecture 05.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
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.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
Introduction to Embedded Systems Rabie A. Ramadan 5.
Dynamic Priority Driven Scheduling of Periodic Task
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
11 G53SRP: Feasibility analysis Chris Greenhalgh School of Computer Science.
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.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 6: Real-Time Scheduling
Real-time Embedded Systems Rate monotonic theory scheduling.
Real-Time Operating Systems RTOS For Embedded systems.
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.
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.
Embedded System Scheduling
EMERALDS Landon Cox March 22, 2017.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Wayne Wolf Dept. of EE Princeton University
EEE 6494 Embedded Systems Design
Lecture 24: Process Scheduling Examples and for Real-time Systems
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
CSCI1600: Embedded and Real Time Software
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Real-Time Process Scheduling Concepts, Design and Implementations
Ch 4. Periodic Task Scheduling
Real-Time Process Scheduling Concepts, Design and Implementations
CSCI1600: Embedded and Real Time Software
Presentation transcript:

CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015

Scheduling Problem  Arduino Main Loop  Round-robin scheduler (with interrupts)  No preemption  Assuming not that much is time critical  Possibly one interrupt routine  What happens in a more complex system  We first must understand the components

Periodic Tasks  Execution time (e units) : max execution time  Release time (t – when it becomes available to run)  Period p: the time between releases  Deadline (d – relative to release time)  How quickly it needs to be processed  Default = period  P(p,e,d) : representation of a job  P(p,e) = P(p,e,p)  Goal: ensure all deadlines are met

Aperiodic Tasks  Background tasks that run occassionally  Arise at random (possibly with a distribution)  Soft deadlines  Can have priorities  Again have release time, deadline, execution time  GOAL: Execute these jobs as fast as possible  Average or worst case time

Sporadic Tasks  Response to interrupts or unusual events  Arise randomly (possibly with a distribution)  Hard deadlines  Again have release time, deadline, execution time  GOAL: ensure these can be serviced correctly  Accept or reject the job

Simplifying Assumptions  All jobs are preemptible at any time  Relaxations:  Not preemptible until non-runnable  Preempt at “safe” times (calling OS, acquiring synchronization)  Switching overhead is 0  No resource contention between jobs (no blocking)  Jobs don’t suspend voluntarily  Job execution time (max) is known  Simple processor  All of these can be taken into account, but things are more complex

Scheduling Problem  Given a set of periodic tasks, can they be scheduled  Can aperiodic tasks at a given rate be handled  Can all sporadic tasks be handled  Can we accept/reject a sporadic task when it arises  We first need to decide what type of solution we want

Solution Models: Fixed Schedule  Also call clock-based  Single schedule  Schedule is precomputed, stored in a table  Time allocated for aperiodic and sporadic tasks  Can be fully static (all decisions made in advance)  Can be static order  Order precomputed  When to run decided at run time

Solution Models: Fixed Priority  Assign priority to jobs as they arise  Priorities don’t change once they are assigned  Low numbers are higher priority  Highest priority job runs  Schedule reexamined as new jobs come in  Aperiodic and sporadic jobs are accommodated  Either directly by priority  Or by creating a periodic job for them

Solution Models: Dynamic Priority  Jobs are assigned priorities as they arise  But job priorities can be changed over time  Highest priority job runs  Schedule reexamined periodically & as new jobs arise  Accommodate aperiodic and sporadic jobs

Solution Models: Advanced  Multiple threads/cores/processors  Handling aperiodic and sporadic tasks  Relaxing assumptions  Resource scheduling

Example  Consider three jobs  P1(4,2), P2(6,2), P3(12,2)  Can we schedule these  How many time units do we have to consider

Schedule Representations  P1(4,2), P2(6,2), P3(12,2)

Schedule Representations  P1(4,2), P2(6,2), P3(12,2) P1 P2 P3

Scheduling Example  P1(4,1), P2(6,2), P3(12,3)

Schedule Representations  P1(4,1), P2(6,2), P3(12,3)

Scheduling Example  P1(4,2), P2(6,3), P3(12,1)

Clock-Based Scheduling  Set up fixed schedule in advance  Problem is NP-complete but can be solved  Done once off-line  Still need to handle aperiodic and sporadic tasks  Need to leave slack in schedule  We’ll get back to this  Pros and Cons  Simple to implement  Can use an optimal schedule  Assumes release times are fixed (no jitter)  Everything must be known in advance  Changing anything can be messy

Fixed Priority Scheduling  Basic Idea  Assign a priority to a job as it arrives  Not necessarily based on its a priori priority  Based on scheduling requirements  Job with highest priority is run  If a new job gets higher priority, it preempts running job  Implementaiton  Maintain a priority queue of jobs  New jobs are inserted into the queue  And may cause preemption

Fixed Priority Assignment  Problem: how to assign priorities  Rate Monotonic (RM) priority assignment  Priority is the period  Shortest task gets the highest priority  Deadline Monotonic (DM) priority assignment  Priority is the deadline  Jobs with shortest relative deadline gets highest priority  If deadline = period, these are the same

Rate Monotonic Example  P1(4,1), P2(5,2), P3(20,5)

Feasibility Analysis  How good is a RM/DM schedule?  What do you want to measure?  Utilization of the CPU  Does the algorithm produce a feasible schedule  If the jobs are schedulable  Under what circumstances  Necessary and Sufficient Schedule  All cycles are needed to service jobs and there are enough cycles to service jobs  Achieving this is NP-hard. Settle for sufficient (enough cycles)

Critical Instant Theorem  The critical instant for a job is the worst time to start it  The release time for which response is maximized  Theorem: The critical instant occurs (for periodic tasks with fixed priorities) when all higher priority jobs share the release time with the job in question  This is fairly robust : stays true even if we remove simplifying assumptions

Checking a Schedule  Notation  τ i – the ith task or the i th execution of task τ  D i – the relative deadline for the i th task  P i – the period of the i th task  e i – the execution time of the i th task

Checking a Schedule  Simple necessary and sufficient test of feasibility  Assuming synchronous release  Release jobs from all tasks at time t  Simulate until lowest priority job completes or misses  Only on deadline and release points

RM Priority Assigment  If a task set can be scheduled at all by a fixed priority schedule  It can be scheduled with a RM policy  Hence RM (or DM) is optimal in some sense  Define the utility of a task u i = e i /P i  The utility of a set of tasks is their sum  If Sum > 1 then the jobs can’t be scheduled  If Sum = 1 and tasks can be scheduled, algorithm is optimal  What can be done using RM/DM scheduling?

RM Scheduling

RM and DM Can Be Optimal  Simply Periodic  For every pair of tasks A and B with Pa < Pb, Pb is an integral multiple of Pa  Then we can schedule the jobs if Utilization <= 1  Can we do better in the general case?

Rate (Deadline) Monotonic  Jobs come in, are assigned a priority, highest runs  Consider (8,3), (9,3), (15,3)  Is this guaranteed to be schedulable?

Rate Monotonic Scheduling  Consider (10,2), (12,5), (15,4)  Utilization = =  But RM fails: (WHY)

Rate Monotonic Scheduling  Consider (8,4), (10,2), (12,3)  Utilization = = 0.95  RM fails: (WHY)

Dynamic Priority Scheduling  Priorities are changed dynamically for different tasks  Otherwise same simplifying assumptions  Approaches to assigning priorities  Basic idea: give priority to the job that needs it the most  Least laxity (least slack) first  Earliest deadline first

Homework  Read