Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.

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.
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Priority Inheritance and Priority Ceiling Protocols
Washington WASHINGTON UNIVERSITY IN ST LOUIS Resource and Resource Access Control Fred Kuhns Applied Research Laboratory Computer Science and Engineering.
Introduction to Embedded Systems Resource Management - III Lecture 19.
Priority INHERITANCE PROTOCOLS
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
CS 149: Operating Systems February 3 Class Meeting
0 Synchronization Problem Resource sharing –Requires mutual exclusion –Critical section A code section that should be executed mutually exclusively by.
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
CPE555A: Real-Time Embedded Systems
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.
CSE 522 Real-Time Scheduling (3)
An Introduction to Real Time Systems
Real-time Systems Lab, Computer Science and Engineering, ASU Scheduling Algorithm and Analysis (ESP – Fall 2014) Computer Science & Engineering Department.
From HRT-HOOD to ADA95 Real-Time Systems Lecture 5 Copyright, 2001 © Adam Czajka.
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
Courseware Scheduling Uniprocessor Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Scheduling Theory ITV Multiprogramming and Real-Time Programs Anders P. Ravn Aalborg University May 2009.
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
EE 249, Fall Discussion: Scheduling Haibo Zeng Amit Mahajan.
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.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
UCDavis, ecs251 Fall /23/2007ecs251, fall Operating System Models ecs251 Fall 2007 : Operating System Models #3: Priority Inversion Dr. S.
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environments.
Chapter 4 – Periodic Task Scheduling In many real-time systems periodic tasks dominate the demand. Three classic periodic task scheduling algorithms: –
Technische Universität Dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2007/12/14.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Introduction to Embedded Systems Rabie A. Ramadan 6.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
1 Reducing Queue Lock Pessimism in Multiprocessor Schedulability Analysis Yang Chang, Robert Davis and Andy Wellings Real-time Systems Research Group University.
Scheduling policies for real- time embedded systems.
Real Time Operating Systems Schedulability - Part 3 Course originally developed by Maj Ron Smith 10/24/2015Dr Alain Beaulieu1.
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.
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)
RTOS task scheduling models
- 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.
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.
Introduction to Embedded Systems Rabie A. Ramadan 5.
A presentation for Brian Evans’ Embedded Software Class By Nate Forman Liaison Technology Inc. 3/30/2000 For Real-Time Scheduling.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
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.
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
CS333 Intro to Operating Systems Jonathan Walpole.
11 G53SRP: Feasibility analysis Chris Greenhalgh School of Computer Science.
Lecture 6: Real-Time Scheduling
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
Undergraduate course on Real-time Systems Linköping TDDD07 – Real-time Systems Lecture 1: Introduction & Scheduling I Simin Nadjm-Tehrani Real-time Systems.
Scheduling and Resource Access Protocols: Basic Aspects
EEE 6494 Embedded Systems Design
Realtime Scheduling Algorithms
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Processes and operating systems
CHAPTER 8 Resources and Resource Access Control
Real-Time Process Scheduling Concepts, Design and Implementations
The End Of The Line For Static Cyclic Scheduling?
Ch 4. Periodic Task Scheduling
Real-Time Process Scheduling Concepts, Design and Implementations
Presentation transcript:

Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems Laboratory Department of Computer and Information Science Linköping university 36 pages Autumn 2009

Undergraduate course on Real-time Systems Linköping University 2 of 36 Autumn 2009 Practical announcements Registration at webreg for TDDD07 Follow instructions on the web!

Undergraduate course on Real-time Systems Linköping University 3 of 36 Autumn 2009 Cyclic scheduling: What is the deadline for each process? How does one know that processes meet their deadlines? What happens if they don’t? From last lecture

Undergraduate course on Real-time Systems Linköping University 4 of 36 Autumn 2009 Better methods needed For: Processes with long WCET Sporadic events Processes with long period but short deadline Process dependence –sharing resources –overruns

Undergraduate course on Real-time Systems Linköping University 5 of 36 Autumn 2009 Priority-based scheduling A preemptive method where the priority of the process determines whether it continues to run or it is disrupted ”Most important process first!”

Undergraduate course on Real-time Systems Linköping University 6 of 36 Autumn 2009 RMS Rate Monotonic Scheduling: On-line Preemptive Priority-based with fixed (static) priorities

Undergraduate course on Real-time Systems Linköping University 7 of 36 Autumn 2009 Priorities Each process has a period T i that is the shortest interval between its release times Processes are assigned priorities dependent on length of T i – The shorter T i the higher the priority

Undergraduate course on Real-time Systems Linköping University 8 of 36 Autumn 2009 Example (4) P1 P2 P3 Period (Ti) WCET (Ci) Priority high low medium

Undergraduate course on Real-time Systems Linköping University 9 of 36 Autumn 2009 Consider following scenario: arrival timeprocess 0P1, P2, P3 20 P1 30 P3 40P1 50P2 60P1, P preemption time

Undergraduate course on Real-time Systems Linköping University 10 of 36 Autumn 2009 Schedulability test Theorem: (sufficient condition) For n processes, RMS will guarantee their schedulability if the total utilisation U = C 1 /T C n /T n does not exceed the guarantee level G = n (2 1/n -1)

Undergraduate course on Real-time Systems Linköping University 11 of 36 Autumn 2009 U = 10/20+10/50+5/30 = 0,87 n = 3  G = 3(2 1/3 -1) = 0,78 Schedulability is not guaranteed! (but processes may still meet their deadlines...) For this example

Undergraduate course on Real-time Systems Linköping University 12 of 36 Autumn 2009 When the test fails Try with the critical instant: Assume that all processes are released simultaneously at time 0, and then arrive according to their periods Check whether each process meets its deadline for all releases before the first deadline for the process with lowest priority

Undergraduate course on Real-time Systems Linköping University 13 of 36 Autumn 2009 For example 4 scenario: arrival timeprocess 0P1, P2, P3 20 P1 30 P3 40P1 50P2 60P1, P preemption time

Undergraduate course on Real-time Systems Linköping University 14 of 36 Autumn 2009 Exact analysis Mathematical equations for computing worst case response times R i for each process Process set schedulable if R i ≤ T i for all processes Assumptions?

Undergraduate course on Real-time Systems Linköping University 15 of 36 Autumn 2009 Response time analysis Response time: the time between the release and the completion time Tasks suffer interference from higher priority tasks Iterative formula for calculating response time

Undergraduate course on Real-time Systems Linköping University 16 of 36 Autumn 2009 Not schedulabe task set When response time analysis gives a “no” answer: Change U by reducing C i (code optimisation, faster processor,...) or Increase T i for some process (can one do this?)

Undergraduate course on Real-time Systems Linköping University 17 of 36 Autumn 2009 Theorems Optimality: RMS is optimal among methods with fixed priority (in what sense?) Lowest upper bound: For arbitrarily large n, it suffices that processor utilisation is < 0.69 [Nice proofs in Buttazzo book]

Undergraduate course on Real-time Systems Linköping University 18 of 36 Autumn 2009 What does the test mean? Utilisation based test: G = n ( 2 1/n - 1) For a given n, the highest ceiling under which we only find schedulable task sets (irrespective of release times, with all possible C i, T i )

Undergraduate course on Real-time Systems Linköping University 19 of 36 Autumn 2009 P 1 P 2 P 3 Period (T i ) WCET (C i ) U = 7/ /50 + 5/30 = 0,72 >0,69 but... < G = 0,78 The schedulability of this task set is guaranteed! Example (2)

Undergraduate course on Real-time Systems Linköping University 20 of 36 Autumn 2009 Dynamic priorities Allow –processes with long T i and short deadline –Process dependencies: when processes share resources and must be synchronised Next scheduling algorithm: change priorities dynamically

Undergraduate course on Real-time Systems Linköping University 21 of 36 Autumn 2009 Earliest deadline first (EDF) Online Preemptive Dynamic priorities Policy: Always run the process that is closest to its deadline

Undergraduate course on Real-time Systems Linköping University 22 of 36 Autumn 2009 Event that leads to release of process P i appears with minimum inter-arrival interval T i P i has a max computation time C i The process must be finished before its deadline D i  T i Processes are independent (do not share resources) EDF: The process with nearest absolute deadline (d i ) will run first Process sets

Undergraduate course on Real-time Systems Linköping University 23 of 36 Autumn 2009 Consider following processes: P 1 P 2 WCET (C i ) 510 Deadline (D i = T i ) 2012 Arrival times (r i )0, 20,... 0, 12, ? time 2025 Example (3)

Undergraduate course on Real-time Systems Linköping University 24 of 36 Autumn 2009 For same task set:P 1 P 2 WCET (C i )510 Deadline (D i = T i ) 2012 Arrival times (r i ) 0, 20,... 0, 12, time ? Preemption Compare to RMS

Undergraduate course on Real-time Systems Linköping University 25 of 36 Autumn 2009 Theorem A set of periodic tasks P 1,...,P n for which D i = T i is schedulable with EDF iff U= C 1 /T C n /T n  For Example 3: C 1 /T 1 + C 2 /T 2 = 5/ /12 = 1,08!

Undergraduate course on Real-time Systems Linköping University 26 of 36 Autumn 2009 Consider following task set:P 1 P 2 WCET (C i )24 Deadline (D i = T i )57 Is it schedulable? U = 2/5 + 4/7 = 0,97 Yes! Example (4)

Undergraduate course on Real-time Systems Linköping University 27 of 36 Autumn 2009 EDF vs. RMS EDF gives higher processor utilisation (Example 4 not schedulable with RMS!) EDF has simpler exact analysis for the mentioned type of task sets RMS can be implemented to run faster at run-time (if we ignore the time for context switching)

Undergraduate course on Real-time Systems Linköping University 28 of 36 Autumn 2009 Sharing resources Assume that processes synchronise using semaphores We schedule the processes with fixed priorities but relax the independence requirement

Undergraduate course on Real-time Systems Linköping University 29 of 36 Autumn 2009 Priority Inversion A low priority process (P 1 ) locks the resource A high priority process (P 2 ) has to wait on the semaphore (blocked state) A medium priority process (P 3 ) preempts P 1 and runs to completion before P 2 !

Undergraduate course on Real-time Systems Linköping University 30 of 36 Autumn 2009 How to avoid it? When P 2 is blocked by P 1 one raises the priority of P 1 to the same level as P 2 temporarily Afterwards, when the semaphore is released by P 1, it goes back to its prior priority level P 3 can not interrupt P 1 any more!

Undergraduate course on Real-time Systems Linköping University 31 of 36 Autumn 2009 Priority inheritance Is transitive Guarantees upper bound for blocking time, since high priority process P 2 is blocked only under the time that P 1 uses the resource But... Does not avoid deadlock!

Undergraduate course on Real-time Systems Linköping University 32 of 36 Autumn 2009 Example P1 P2 0 time S1 S2S1? Preemption Blocked S2? Blocked Inheritance Si Here denotes the process locks semaphore Si. Let P1 have lower priority than P2.

Undergraduate course on Real-time Systems Linköping University 33 of 36 Autumn 2009 Note that: blocked – when waiting for a resource (other than CPU) not dispatched or preempted - when waiting for CPU Terminology

Undergraduate course on Real-time Systems Linköping University 34 of 36 Autumn 2009 Ceiling Protocols e.g. Immediate priority Ceiling Protocol (ICP): A process that obtains its first resource inherits the resource’s ceiling priority - the highest priority among all processes that can possibly claim that resource Dynamic priority for a process is the max of own (fixed) priority and the ceiling values of all resources it has locked When a resource is released, the process priority returns to the normal level (or to another engaged resource’s ceiling)

Undergraduate course on Real-time Systems Linköping University 35 of 36 Autumn 2009 Properties A process is blocked max once by another process with lower priority The blocking delay is a function of the length of the critical section Do not even need to use semaphores!

Undergraduate course on Real-time Systems Linköping University 36 of 36 Autumn 2009 ICP & Deadlock The ICP prevents deadlocks (How?) Moreover, it prevents starvation (How?)