CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

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.
Real-time Embedded Systems Complex RMS and deadline monotonic scheduling.
Priority INHERITANCE PROTOCOLS
CprE 458/558: Real-Time Systems
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
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
CSE 522 Real-Time Scheduling (3)
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
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.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
UCDavis, ecs150 Spring /21/2006ecs150, spring Operating System ecs150 Spring 2006 : Operating System #3: Priority Inversion (paper) Dr. S.
Resource Access Control (Part I) The Mars Pathfinder Incident Resource Model Priority Inversion.
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.
Introduction to Embedded Systems
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Combined Scheduling of Periodic and Aperiodic Tasks.
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.
Real Time Operating Systems Mutual Exclusion, Synchronization & Intertask Communication Course originally developed by Maj Ron Smith.
CY2003 Computer Systems Lecture 04 Interprocess Communication.
Deadlock Detection and Recovery
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
RTOS task scheduling models
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.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
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.
Chapter 6 Concurrency: Deadlock and Starvation
CS333 Intro to Operating Systems Jonathan Walpole.
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.
Lecture 6 Deadlock 1. Deadlock and Starvation Let S and Q be two semaphores initialized to 1 P 0 P 1 wait (S); wait (Q); wait (Q); wait (S);. signal (S);
Deadlock and Starvation
REAL-TIME OPERATING SYSTEMS
RTOS Scheduling 2.0 Problems - Solutions
Process Synchronization: Semaphores
Scheduling and Resource Access Protocols: Basic Aspects
Background on the need for Synchronization
EEE 6494 Embedded Systems Design
Deadlock and Starvation
CprE 458/558: Real-Time Systems
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
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
Chapter 7: Deadlocks.
CSCI1600: Embedded and Real Time Software
Lecture 2 Part 2 Process Synchronization
Chapter 8: Deadlocks.
CSCI1600: Embedded and Real Time Software
Resource access control -- example
CHAPTER 8 Resources and Resource Access Control
Real-Time Process Scheduling Concepts, Design and Implementations
Real-Time Process Scheduling Concepts, Design and Implementations
EECE.4810/EECE.5730 Operating Systems
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University
Presentation transcript:

CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols

CprE 458/558: Real-Time Systems (G. Manimaran)2 Assumptions Periodic tasks Task can have resource access Semaphore is used for mutual exclusion RMS scheduling

CprE 458/558: Real-Time Systems (G. Manimaran)3 Background – Task State diagram Ready State: waiting in ready queue Running State: CPU executing the task Blocked: waiting in the semaphore queue until the shared resource is free Semaphore types – mutex (binary semaphore), counting semaphore

CprE 458/558: Real-Time Systems (G. Manimaran)4 Task State Diagram READYRUN WAITING Activate scheduling Preemption Termination Wait on busy resource Signal free resource Process/Task state diagram with resource constraints

CprE 458/558: Real-Time Systems (G. Manimaran)5 Priority Inversion Problem Priority inversion is an undesirable situation in which a higher priority task gets blocked (waits for CPU) for more time than that it is supposed to, by lower priority tasks. Example: Let T 1, T 2, and T 3 be the three periodic tasks with decreasing order of priorities. Let T 1 and T 3 share a resource “S”.

CprE 458/558: Real-Time Systems (G. Manimaran)6 Priority Inversion -- Example T3 obtains a lock on the semaphore S and enters its critical section to use a shared resource. T1 becomes ready to run and preempts T3. Then, T1 tries to enter its critical section by first trying to lock S. But, S is already locked by T3 and hence T1 is blocked. T2 becomes ready to run. Since only T2 and T3 are ready to run, T2 preempts T3 while T3 is in its critical section. Ideally, one would prefer that the highest priority task (T1) be blocked no longer than the time for T3 to complete its critical section. However, the duration of blocking is, in fact, unpredictable because task T2 got executed in between.

CprE 458/558: Real-Time Systems (G. Manimaran)7 Priority Inversion example T1 T2 T3T3 T3 0 T3 is the only active task Preempted by higher priority task T1 T1T1 Makes a request for resource S and gets blocked T3T3 Preempted by higher priority task T2 T2T2 T3T3 T3 completes T1T1 Resource S is available and T1 is scheduled here K1 K2 K3 T2 completes L1 Total blocking time for task T1 = (K1+K2+K3) + (L1) Highest priority Least priority Medium priority T1 and T3 share resource S A higher priority task waits for a lower priority task

CprE 458/558: Real-Time Systems (G. Manimaran)8 Priority Inheritance Protocol Priority inheritance protocol solves the problem of priority inversion. Under this protocol, if a higher priority task T H is blocked by a lower priority task T L, because T L is currently executing critical section needed by T H, T L temporarily inherits the priority of T H. When blocking ceases (i.e., T L exits the critical section), T L resumes its original priority. Unfortunately, priority inheritance may lead to deadlock.

CprE 458/558: Real-Time Systems (G. Manimaran)9 Priority Inheritance Protocol – Deadlock Assume T2 > T1 (i.e., T2 has high priority)

CprE 458/558: Real-Time Systems (G. Manimaran)10 Priority Ceiling Protocol Priority ceiling protocol solves the priority inversion problem without getting into deadlock. For each semaphore, a priority ceiling is defined, whose value is the highest priority of all the tasks that may lock it. When a task T i attempts to execute one of its critical sections, it will be suspended unless its priority is higher than the priority ceiling of all semaphores currently locked by tasks other than T i.

CprE 458/558: Real-Time Systems (G. Manimaran)11 Priority Ceiling Protocol (Contd.) If task T i is unable to enter its critical section for this reason, the task that holds the lock on the semaphore with the highest priority ceiling is said to be blocking T i and hence inherits the priority of T i. As long as a task T i is not attempting to enter one of its critical sections, it will preempt every task that has a lower priority.

CprE 458/558: Real-Time Systems (G. Manimaran)12 Priority Ceiling Protocol -- properties This protocol is the same as the priority inheritance protocol, except that a task T i can also be blocked from entering a critical section if any other task is currently holding a semaphore whose priority ceiling is greater than or equal to the priority of task T i. Prevents mutual deadlock among tasks A task can be blocked by lower priority tasks at most once

CprE 458/558: Real-Time Systems (G. Manimaran)13 Priority Celiling Protocol - Example For the previous example, the priority ceiling for both CS 1 and CS 2 is the priority of T 2. From time t 0 to t 2, the operations are the same as before. At time t 3, T 2 attempts to lock CS 1, but is blocked since CS 2 (which has been locked by T 1 ) has a priority ceiling equal to the priority of T 2. Thus T 1 inherits the priority of T 2 and proceeds to completion, thereby preventing deadlock situation.

CprE 458/558: Real-Time Systems (G. Manimaran)14 Priority Inversion - Real-world Example Mars Pathfinder mission (July 4, 1997) VxWorks (real-time OS), preemptive priority scheduling of threads (e.g., RMS) Priority inversion involving three threads: –Information bus task (T1), meteorological data gathering task (T3), communication task (T2). Priority order: T1>T2>T3 –Shared resource: information bus (used mutex) Same situation as described in the previous example had occurred Findings: Priority ceiling protocol was found to be disabled initially, then it was enabled online and the problem was corrected

CprE 458/558: Real-Time Systems (G. Manimaran)15 Priority Ceiling Emulation Once a task locks a semaphore, its priority is immediately raised to the level of the priority ceiling of the semaphore. Deadlock avoidance and block at-most-once result of priority ceiling protocol still holds. Restriction: A task cannot suspend its execution within the critical section.

CprE 458/558: Real-Time Systems (G. Manimaran)16 Modeling Blocking Time and Earlier Deadline Blocking time (Bi) encountered by task Ti by lower priority tasks can be modeled by increasing Ti ’ s utilization by Bi/Pi. Earlier deadline (Di < Pi) can also be modeled as blocking time for Ei = Pi – Di. Net increase in task Ti ’ s utilization is (Bi + Ei) / Pi.

CprE 458/558: Real-Time Systems (G. Manimaran)17 Modeling Blocking and Earlier Deadline (Cont.) Schedulability Check (sorted order T1 > T2 > … > Tn) -- sufficient, but not necessary Completion time Test (Exact analysis) –Earlier deadline (di < pi) case: same as DMS exact analysis –Blocking time (Bi) case: Let Ci ’ = Ci + Bi While calculating Wi(t) for task Ti, use Ci ’ for task Ti and for all other higher priority tasks Tj simply use Cj (Note: Blocking Time calculation will be learned thro homework)