Priority Inheritance and Priority Ceiling Protocols

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

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.
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 Inversion BAE5030 Advanced Embedded Systems 9/13/04.
Real-time Embedded Systems Complex RMS and deadline monotonic scheduling.
Scheduling Algorithms for Multiprogramming in a Hard Real-Time Environment (then and now) EECS 750 – Spring 2006 Presented by: Shane Santner, TJ Staley,
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.
Resource Access Protocols
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)
CSE 522 Real-Time Scheduling (4)
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Mutual Exclusion.
Chapter 5 – Fixed-Priority Servers Typical Real-Time systems are hybrids characterized by: periodic tasks that execute critical control activities aperiodic.
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:
Chapter 6 Dynamic Priority Servers
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.
Fixed-Priority Servers
Resource Access Control (Part I) The Mars Pathfinder Incident Resource Model Priority Inversion.
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: –
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Combined Scheduling of Periodic and Aperiodic Tasks.
Introduction to Embedded Systems Rabie A. Ramadan 6.
1 Reducing Queue Lock Pessimism in Multiprocessor Schedulability Analysis Yang Chang, Robert Davis and Andy Wellings Real-time Systems Research Group University.
Real-Time Systems Mark Stanovich. Introduction System with timing constraints (e.g., deadlines) What makes a real-time system different? – Meeting timing.
Real Time Operating Systems Schedulability - Part 3 Course originally developed by Maj Ron Smith 10/24/2015Dr Alain Beaulieu1.
Real Time Scheduling Telvis Calhoun CSc Outline Introduction Real-Time Scheduling Overview Tasks, Jobs and Schedules Rate/Deadline Monotonic Deferrable.
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.
Deadlock Detection and Recovery
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.
Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1.
B. RAMAMURTHY 12/25/2015 Realtime System Fundamentals : Scheduling and Priority-based scheduling Pag e 1.
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.
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.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
REAL-TIME OPERATING SYSTEMS
RTOS Scheduling 2.0 Problems - Solutions
Scheduling and Resource Access Protocols: Basic Aspects
EEE 6494 Embedded Systems Design
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Rate Monotonic Analysis For Real-Time Scheduling A presentation for
Chapter 6 Dynamic Priority Servers
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
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy Amrita-UB-MSES /11/2013.
CSCI1600: Embedded and Real Time Software
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
CHAPTER 8 Resources and Resource Access Control
Real-Time Process Scheduling Concepts, Design and Implementations
Real-Time Process Scheduling Concepts, Design and Implementations
Presentation transcript:

Priority Inheritance and Priority Ceiling Protocols L. Sha, R. Rajkumar, and J. P. Lehoczky, "Priority Inheritance Protocols: An Approach to Real-Time Synchronization", IEEE Transactions on Computers, Vol. 39, No. 9, Sept. 1990.

Priority Inversion A high priority task is blocked due to a low priority task How can it happen? Mutex for shared resource access Non-preemptive subsystem access Network System bus Secondary storage

Mutual Exclusion via Semaphores Ensure only one task/process is in the critical section wait(S) to get access to semaphore S signal(S) to release S Example: producer consumer Producer() { . wait(S) critical section /* create data & increment pointer */ signal(S) }

Priority Inversion Source of the figure: Chenyang Lu, Washington University Saint Louis

Unbounded Priority Inversion

What really happened on Mars? Repeated resets in the Mars Pathfinder The Mars Pathfinder mission was widely proclaimed as "flawless" in the early days after its July 4th, 1997 landing on the Martian surface.... 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".... For a full story, visit http://research.microsoft.com/%7Embj/Mars_Pathfinder/Mars_Pathfinder.html

Pathfinder Incident Classical priority inversion problem due to shared system bus! Source of the figure: Damir Isovic, Malardaren University, Sweden

Priority Inheritance Inherit the priority of the blocked high priority task

Priority Inheritance Protocol (PIP) If TL blocks a higher proirity task TH, priority(TL) ← priority(TH) When TL releases a semaphore: Return to its normal priority if it doesn’t block any task Otherwise, set priority(PL) ← highest priority of the tasks blocking on a semaphore held by TL Transitive T1 blocked by T2: priority(T2) ← priority(T1) T2 blocked by T3: priority(T3) ← priority(T1)

Chained Blocking: Problem of PIP In the worst case, the highest priority task T1 can be blocked by N lower priority tasks in the system when T1 has to access N semaphores to finish the execution! Source of the figure: Damir Isovic, Malardaren University, Sweden

Response Time Analysis of RMS with PIP For RMS schedulability test, ensure that: ∑ i=1, N (Ci/Ti + Bi/Ti) ≤ n(21/n - 1) , 1 ≤ i ≤ n Bi is the the longest priority inversion time that could be experienced by Ti Bi= CSi + CSi+1+ ...+ CSk where CSi, CSi+1, ..., CSk are the critical sections by which lower priority tasks could block Ti Sufficient but not necessary because the priority due to contention for CS may not happen in reality

Priority Ceiling Protocol (PCP) Avoid chained blocking Guarantee a task is blocked by at most one lower priority task No deadlock Assumptions Each task is associated with a fixed priority

PCP Each semaphore has the fixed priority ceiling How it works: ceiling(S) = highest priority among all the tasks that will request S How it works: Ti can access a semaphore S if S is not already allocated to any other task; and Priority of Ti is higher than the current processor ceiling = max(priority ceilings of all the semaphores allocated to tasks other than Ti)

PCP No chained blocking! Ceiling(S1) = 1 (high) Ceiling(S2) = 2 (medium) Ceiling(S3) = 2 (medium) No chained blocking! Source of the figure: Damir Isovic, Malardaren University, Sweden

Schedulability of RMS with PCP Consider blocking time: ∑ i=1, N (Ci/Ti + Bi/Ti) ≤ n(21/n - 1) , 1 ≤ i ≤ n Bi = max(CSi, CSi+1, ..., CSk) where CSi, CSi+1, ..., CSk are the critical sections that can block Ti

Scheduling Aperiodic + Periodic Tasks

Task Arrival Patterns Periodic Sporadic Aperiodic Aperiodic but minimum interarrival time is known Worst case Every sporadic job always arrives at its minimum interarrival time Treat as periodic tasks Utilization bound or response time analysis If schedulable for the worst case, schedulable for all the other cases Aperiodic No limitations on interarrival times Scheduling algorithms we have seen so far do not apply

Aperiodic Deadlines Soft: Not much to do in terms of scheduling Firm Deadline & WCET are given Start a firm deadline task only if it will finish by the deadline Let’s discuss several hybrid scheduling algorithms that use RMS for periodic task scheduling Several approaches to scheduling aperiodic tasks

Background Scheduling Schedule periodic tasks first Schedule aperiodic tasks only if there’s no periodic task Periodic tasks RMS CPU High priority queue Aperiodic tasks FCFS, EDF, etc. Low priority queue

Background Scheduling with RMS Task set: T1(2, 6), T2(4,10) where Ti=(Ci, Pi) Schedulable since 2/6 + 4/10 = 0.73 < 2(21/2-1) = 0.82 T1 T1,1 T1,2 Idle Schedule aperiodic tasks here 2 4 6 T2,1 T2 2 4 6 8 10

Polling Server Use a periodic task to serve aperiodic tasks Algorithm Period: Ps Capacity: Cs Algorithm Release the server at every period Ps Serve any pending aperiodic task Suspend itself, i.e., capacity = 0, if It consumed Cs; or There no pending aperiodic request Replenish capacity, i.e., capacity = Cs, at the next period

Schedulability of Polling Server Aperiodic tasks have no impact on periodic ones There can be multiple servers n periodic tasks & m polling servers are schedulable if Up + Us ≤ U(m+n) Problem: If an aperiodic request arrives right after the server period, it has to wait until the next period → Long response time Response time of an aperiodic request with execution time Ca is Ps + Ca/Cs Ps

Deferrable Server (DS) Preserve the unused capacity until the end of the current period Reduce response time to aperiodic requests DS affects the schedulability of periodic tasks DS schedulability ≠ RM

Priority Exchange Server Server has the highest priority at the beginning If there’s no aperiodic request to serve right now, preserve capacity for lower priority task’s execution time Replenish the capacity at the next period

Optimal? No optimal algorithm exists to minimize the response time! Other servers with RMS Sporadic server: Replinish capacity only after aperiodic request execution Slack stealing: No periodic server, but slack stealer tries to steal time from periodic tasks