- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.

Slides:



Advertisements
Similar presentations
Fakultät für informatik informatik 12 technische universität dortmund Resource Access Protocols Peter Marwedel Informatik 12 TU Dortmund Germany 2008/12/06.
Advertisements

Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
Washington WASHINGTON UNIVERSITY IN ST LOUIS Real-Time: Periodic Tasks Fred Kuhns Applied Research Laboratory Computer Science Washington University.
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.
Outline Introduction Assumptions and notations
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.
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.
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)
Real-time concepts Lin Zhong ELEC424, Fall Real time Correctness – Logical correctness – Timing Hard vs. Soft – Hard: lateness is intolerable Pass/Fail.
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.
Resource Access Control in Real-Time Systems Resources, Resource Access, and How Things Can Go Wrong: The Mars Pathfinder Incident Resources, Critical.
UCDavis, ecs150 Fall /23/2007ecs150, fall Operating System ecs150 Fall 2007 : Operating System #3: Priority Inversion (a paper on the class.
UCDavis, ecs150 Spring /21/2006ecs150, spring Operating System ecs150 Spring 2006 : Operating System #3: Priority Inversion (paper) Dr. S.
Periodic Task Scheduling
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment Presented by Pete Perlegos C.L. Liu and James W. Layland.
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.
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.
Introduction to Embedded Systems
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.
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.
Deadlocks Silberschatz Ch. 7 and Priority Inversion Problems.
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
Deadlock Detection and Recovery
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
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
Special Class on Real-Time Systems
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.
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Lecture 6: Real-Time Scheduling
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
Real-Time Operating Systems RTOS For Embedded systems.
Embedded System Scheduling
REAL-TIME OPERATING SYSTEMS
RTOS Scheduling 2.0 Problems - Solutions
Scheduling and Resource Access Protocols: Basic Aspects
EEE 6494 Embedded Systems Design
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
Ch 4. Periodic Task Scheduling
Real-Time Process Scheduling Concepts, Design and Implementations
Presentation transcript:

- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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 05/06/27

- 2 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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 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

- 3 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Accumulated utilization Accumulated utilization: Necessary condition for schedulability (with m=number of processors):

- 4 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Independent tasks: Rate monotonic (RM) scheduling Most 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. For a single processor and for n tasks, the following equation holds for the accumulated utilization µ: Most 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. For a single processor and for n tasks, the following equation holds for the accumulated utilization µ:

- 5 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Rate monotonic (RM) scheduling - The policy - RM policy: The priority of a task is a monotonically decreasing function of its period. At any time, a highest priority task among all those that are ready for execution is allocated. RM policy: The priority of a task is a monotonically decreasing function of its period. At any time, a highest priority task among all those that are ready for execution is allocated. Theorem: If all RM assumptions are met, schedulability is guaranteed.

- 6 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Maximum utilization for guaranteed schedulability Maximum utilization as a function of the number of tasks:

- 7 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Example of RM-generated schedule T1 preempts T2 and T3. T2 and T3 do not preempt each other.

- 8 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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

- 9 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Proof of RM optimality Definition: A critical instant of a task is the time at which the release of a task will produce the largest response time. Lemma: For any task, the critical instant occurs if that task is simultaneously released with all higher priority tasks. Proof: Let T={T 1, …,T n }: periodic tasks with  i: p i ≦ p i +1. More in-depth: Source: G. Buttazzo, Hard Real-time Computing Systems, Kluwer, 2002

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Critical instances (1) Response time of T n is delayed by tasks T i of higher priority: c n +2c i TnTn TiTi t Maximum delay achieved if T n and T i start simultaneously. c n +3c i TnTn TiTi t Delay may increase if T i starts earlier

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Critical instances (2) Repeating the argument for all i = 1, … n-1:  The worst case response time of a task occurs when it is released simultaneously with all higher-priority tasks. q.e.d.  Schedulability is checked at the critical instants.  If all tasks of a task set are schedulable at their critical instants, they are schedulable at all release times. Repeating the argument for all i = 1, … n-1:  The worst case response time of a task occurs when it is released simultaneously with all higher-priority tasks. q.e.d.  Schedulability is checked at the critical instants.  If all tasks of a task set are schedulable at their critical instants, they are schedulable at all release times.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Proof of the RM theorem Let T={T 1, T 2 } with p 1 < p 2. Assume RM is not used  prio(T 2 ) is highest: Let T={T 1, T 2 } with p 1 < p 2. Assume RM is not used  prio(T 2 ) is highest: T1T1 T2T2 t Schedule is feasible if c 1 +c 2 ≦ p 1 (1) c1c1 c2c2 p1p1 Define F=  p 2 /p 1  : # of periods of T 1 fully contained in T 2

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Case 1: c 1  p 2 – Fp 1 Assume RM is used  prio(T 1 ) is highest: T1T1 T2T2 t Case 1*: c 1  p 2 – Fp 1 (c 1 small enough to be finished before 2nd instance of T 2 ) p2p2 Fp 1 Schedulable if (F+1) c 1 + c 2  p 2 (2) * Typos in [Buttazzo 2002]: < and  mixed up]

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Proof of the RM theorem (3) Not RM: schedule is feasible if c 1 +c 2  p 1 (1) RM: schedulable if (F+1) c 1 + c 2  p 2 (2) From (1): F c 1 + F c 2  F p 1 Since F  1: F c 1 +c 2  F c 1 + F c 2  F p 1 Adding c 1 : ( F+1) c 1 +c 2  F p 1 +c 1 Since c 1  p 2 – Fp 1 : ( F+1) c 1 +c 2  F p 1 +c 1  p 2 Hence: if (1) holds, (2) holds as well  For case 1: Given tasks T 1 and T 2 with p 1 < p 2, then if the schedule is feasible by an arbitrary (but fixed) priority assignment, it is also feasible by RM. Not RM: schedule is feasible if c 1 +c 2  p 1 (1) RM: schedulable if (F+1) c 1 + c 2  p 2 (2) From (1): F c 1 + F c 2  F p 1 Since F  1: F c 1 +c 2  F c 1 + F c 2  F p 1 Adding c 1 : ( F+1) c 1 +c 2  F p 1 +c 1 Since c 1  p 2 – Fp 1 : ( F+1) c 1 +c 2  F p 1 +c 1  p 2 Hence: if (1) holds, (2) holds as well  For case 1: Given tasks T 1 and T 2 with p 1 < p 2, then if the schedule is feasible by an arbitrary (but fixed) priority assignment, it is also feasible by RM.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Case 2: c 1 > p 2 – Fp 1 Case 2: c 1 > p 2 – Fp 1 (c 1 large enough not to finish before 2 nd instance of T 2 ) T1T1 T2T2 t p2p2 Fp 1 Schedulable if F c 1 + c 2  F p 1 (3) c 1 +c 2  p 1 (1) Multiplying (1) by F yields F c 1 + F c 2  F p 1 Since F  1: F c 1 + c 2  F c 1 + Fc 2  F p 1  Same statement as for case 1. Schedulable if F c 1 + c 2  F p 1 (3) c 1 +c 2  p 1 (1) Multiplying (1) by F yields F c 1 + F c 2  F p 1 Since F  1: F c 1 + c 2  F c 1 + Fc 2  F p 1  Same statement as for case 1.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Calculation of the least upper utilization bound Let T={T 1, T 2 } with p 1 < p 2. Proof procedure: compute least upper bound U lup as follows  Assign priorities according to RM  Compute upper bound U up by setting computation times to fully utilize processor  Minimize upper bound with respect to other task parameters As before: F=  p 2 /p 1  c 2 adjusted to fully utilize processor. Let T={T 1, T 2 } with p 1 < p 2. Proof procedure: compute least upper bound U lup as follows  Assign priorities according to RM  Compute upper bound U up by setting computation times to fully utilize processor  Minimize upper bound with respect to other task parameters As before: F=  p 2 /p 1  c 2 adjusted to fully utilize processor.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Case 1: c 1  p 2 – Fp 1 Largest possible value of c 2 is c 2 = p 2 – c 1 (F+1) Corresponding upper bound is Largest possible value of c 2 is c 2 = p 2 – c 1 (F+1) Corresponding upper bound is T1T1 T2T2 t p2p2 Fp 1 { } is <0  U ub monotonically decreasing in c 1 Minimum occurs for c 1 = p 2 – Fp 1

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Case 2: c 1  p 2 – Fp 1 Largest possible value of c 2 is c 2 = (p 1 -c 1 )F Corresponding upper bound is: Largest possible value of c 2 is c 2 = (p 1 -c 1 )F Corresponding upper bound is: T1T1 T2T2 t p2p2 Fp 1 { } is  0  U ub monotonically increasing in c 1 (independent of c 1 if {}=0) Minimum occurs for c 1 = p 2 – Fp 1, as before.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Utilization as a function of G=p 2 /p 1 -F For minimum value of c 1 : Since 0  G< 1: G(1-G)  0  U ub increasing in F  Minimum of U ub for min(F): F=1 

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Proving the RM theorem for n=2 This proves the RM theorem for the special case of n=2 end

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Properties of RM scheduling  From the proof, it is obvious that no idle capacity is needed if p 2 =F p 1. In general: not required if the period of all tasks is a multiple of the period of the highest priority task, that is, schedulability is then also guaranteed if µ  1.  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.  From the proof, it is obvious that no idle capacity is needed if p 2 =F p 1. In general: not required if the period of all tasks is a multiple of the period of the highest priority task, that is, schedulability is then also guaranteed if µ  1.  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.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund EDF EDF can also be applied to periodic scheduling. EDF optimal for every period  optimal for periodic scheduling  EDF must be able to schedule the example in which RMS failed. EDF can also be applied to periodic scheduling. EDF optimal for every period  optimal for periodic scheduling  EDF must be able to schedule the example in which RMS failed.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Comparison EDF/RMS RMS: EDF: T2 not preempted, due to its earlier deadline.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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 in general [Garey/Johnson]. Strategies: 1.Add resources, so that scheduling becomes easier 2.Split problem into static and dynamic part so that only a minimum of decisions need to be taken at run-time. Strategies: 1.Add resources, so that scheduling becomes easier 2.Split problem into static and dynamic part so that only a minimum of decisions need to be taken at run-time.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund 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. 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.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Resource access protocols Critical sections: sections of code at which exclusive access to some resource must be guaranteed. Can be guaranteed with semaphores S. Critical sections: sections of code at which exclusive access to some resource must be guaranteed. Can be guaranteed with semaphores S. P(S) V(S) P(S) V(S) P(S) checks semaphore to see if resource is available and if yes, sets S to „used“. Uninterruptable operations! If no, calling task has to wait. V(S): sets S to „unused“ and starts sleeping task (if any). P(S) checks semaphore to see if resource is available and if yes, sets S to „used“. Uninterruptable operations! If no, calling task has to wait. V(S): sets S to „unused“ and starts sleeping task (if any). Exclusive access to resource guarded by S Task 1 Task 2

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Priority inversion Priority T 1 assumed to be > than priority of T 2. If T 2 requests exclusive access first (at t 0 ), T 1 has to wait until T 2 releases the resource (time t 3 ), thus inverting the priority: Priority T 1 assumed to be > than priority of T 2. If T 2 requests exclusive access first (at t 0 ), T 1 has to wait until T 2 releases the resource (time t 3 ), thus inverting the priority: In this example: duration of inversion bounded by length of critical section of T 2.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Duration of priority inversion with >2 tasks can exceed the length of any critical section Priority of T1 > priority of T2 > priority of T3. T2 preempts T3: T2 can prevent T3 from releasing the resource. Priority of T1 > priority of T2 > priority of T3. T2 preempts T3: T2 can prevent T3 from releasing the resource.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund The MARS Pathfinder problem (1) “But a few days into the mission, not long after Pathfinder started gathering meteorological data, the spacecraft began experiencing total system resets, each resulting in losses of data. The press reported these failures in terms such as "software glitches" and "the computer was trying to do too many things at once".” …

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund The MARS Pathfinder problem (2) “VxWorks provides preemptive priority scheduling of threads. Tasks on the Pathfinder spacecraft were executed as threads with priorities that were assigned in the usual manner reflecting the relative urgency of these tasks.” “Pathfinder contained an "information bus", which you can think of as a shared memory area used for passing information between different components of the spacecraft.”  A bus management task ran frequently with high priority to move certain kinds of data in and out of the information bus. Access to the bus was synchronized with mutual exclusion locks (mutexes).” “VxWorks provides preemptive priority scheduling of threads. Tasks on the Pathfinder spacecraft were executed as threads with priorities that were assigned in the usual manner reflecting the relative urgency of these tasks.” “Pathfinder contained an "information bus", which you can think of as a shared memory area used for passing information between different components of the spacecraft.”  A bus management task ran frequently with high priority to move certain kinds of data in and out of the information bus. Access to the bus was synchronized with mutual exclusion locks (mutexes).”

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund The MARS Pathfinder problem (3)  The meteorological data gathering task ran as an infrequent, low priority thread, … When publishing its data, it would acquire a mutex, do writes to the bus, and release the mutex...  The spacecraft also contained a communications task that ran with medium priority.”  The meteorological data gathering task ran as an infrequent, low priority thread, … When publishing its data, it would acquire a mutex, do writes to the bus, and release the mutex...  The spacecraft also contained a communications task that ran with medium priority.”  High priority: retrieval of data from shared memory Medium priority: communications task Low priority: thread collecting meteorological data

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund The MARS Pathfinder problem (4) “Most of the time this combination worked fine. However, very infrequently it was possible for an interrupt to occur that caused the (medium priority) communications task to be scheduled during the short interval while the (high priority) information bus thread was blocked waiting for the (low priority) meteorological data thread. In this case, the long-running communications task, having higher priority than the meteorological task, would prevent it from running, consequently preventing the blocked information bus task from running. After some time had passed, a watchdog timer would go off, notice that the data bus task had not been executed for some time, conclude that something had gone drastically wrong, and initiate a total system reset. This scenario is a classic case of priority inversion.”

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Coping with priority inversion: the priority inheritance protocol  Tasks are scheduled according to their active priorities. Tasks with the same priorities are scheduled FCFS.  If task T1 executes P(S) & exclusive access granted to T2: T1 will become blocked. If priority(T2) < priority(T1): T2 inherits the priority of T1.  T2 resumes. Rule: tasks inherit the highest priority of tasks blocked by it.  When T2 executes V(S), its priority is decreased to the highest priority of the tasks blocked by it. If no other task blocked by T2: priority(T2):= original value. Highest priority task so far blocked on S is resumed.  Transitive: if T2 blocks T1 and T1 blocks T0, then T2 inherits the priority of T0.  Tasks are scheduled according to their active priorities. Tasks with the same priorities are scheduled FCFS.  If task T1 executes P(S) & exclusive access granted to T2: T1 will become blocked. If priority(T2) < priority(T1): T2 inherits the priority of T1.  T2 resumes. Rule: tasks inherit the highest priority of tasks blocked by it.  When T2 executes V(S), its priority is decreased to the highest priority of the tasks blocked by it. If no other task blocked by T2: priority(T2):= original value. Highest priority task so far blocked on S is resumed.  Transitive: if T2 blocks T1 and T1 blocks T0, then T2 inherits the priority of T0.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Example T3 inherits the priority of T1 and T3 resumes. How would priority inheritance affect our example with 3 tasks? V(S)

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Priority inversion on Mars Priority inheritance also solved the Mars Pathfinder problem: the VxWorks operating system used in the pathfinder implements a flag for the calls to mutex primitives. This flag allows priority inheritance to be set to “on”. When the software was shipped, it was set to “off”. The problem on Mars was corrected by using the debugging facilities of VxWorks to change the flag to “on”, while the Pathfinder was already on the Mars [Jones, 1997].

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Remarks on priority inheritance protocol Possible large number of tasks with high priority. Possible deadlocks. Ongoing debate about problems with the protocol: Victor Yodaiken: Against Priority Inheritance, Finds application in ADA: During rendez-vous, task priority is set to the maximum. More sophisticated protocol: priority ceiling protocol. Possible large number of tasks with high priority. Possible deadlocks. Ongoing debate about problems with the protocol: Victor Yodaiken: Against Priority Inheritance, Finds application in ADA: During rendez-vous, task priority is set to the maximum. More sophisticated protocol: priority ceiling protocol.

 P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Summary Periodic scheduling  Rate monotonic scheduling Proof of the utilization bound for n=2.  EDF  Dependent and sporadic tasks (briefly) Resource access protocols  Priority inversion The Mars pathfinder example  Priority inheritance The Mars pathfinder example Periodic scheduling  Rate monotonic scheduling Proof of the utilization bound for n=2.  EDF  Dependent and sporadic tasks (briefly) Resource access protocols  Priority inversion The Mars pathfinder example  Priority inheritance The Mars pathfinder example