1 © 2009 Universität Karlsruhe (TH), System Architecture Group Priority Inversion.

Slides:



Advertisements
Similar presentations
1 Radio Maria World. 2 Postazioni Transmitter locations.
Advertisements

The Fall Messier Marathon Guide
Números.
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.
AGVISE Laboratories %Zone or Grid Samples – Northwood laboratory
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.

PDAs Accept Context-Free Languages
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
/ /17 32/ / /
Reflection nurulquran.com.
EDA Lab. Dept. of Computer Engineering C. N. U. 1 FSM Structures Mealy, Moore and Combined Mealy/Moore outputs Figure 8.3.
EuroCondens SGB E.
Worksheets.
Peter Grimm, DO Prostate Cancer Center of Seattle
Sequential Logic Design
RM WD-97 WD-101 WD-102 WD-124 a IIIh-H : RM110 (2.1) Hainan c agGY Ia-1 (2) Anhui agGY Ia-2 (3) agGY Ia WD-2 WD-8 WD-36 agGY Ia
Addition and Subtraction Equations
Multiplication X 1 1 x 1 = 1 2 x 1 = 2 3 x 1 = 3 4 x 1 = 4 5 x 1 = 5 6 x 1 = 6 7 x 1 = 7 8 x 1 = 8 9 x 1 = 9 10 x 1 = x 1 = x 1 = 12 X 2 1.
Division ÷ 1 1 ÷ 1 = 1 2 ÷ 1 = 2 3 ÷ 1 = 3 4 ÷ 1 = 4 5 ÷ 1 = 5 6 ÷ 1 = 6 7 ÷ 1 = 7 8 ÷ 1 = 8 9 ÷ 1 = 9 10 ÷ 1 = ÷ 1 = ÷ 1 = 12 ÷ 2 2 ÷ 2 =
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
1 When you see… Find the zeros You think…. 2 To find the zeros...
Western Public Lands Grazing: The Real Costs Explore, enjoy and protect the planet Forest Guardians Jonathan Proctor.
EQUS Conference - Brussels, June 16, 2011 Ambros Uchtenhagen, Michael Schaub Minimum Quality Standards in the field of Drug Demand Reduction Parallel Session.
Add Governors Discretionary (1G) Grants Chapter 6.
CALENDAR.
CHAPTER 18 The Ankle and Lower Leg
Summative Math Test Algebra (28%) Geometry (29%)
ASCII stands for American Standard Code for Information Interchange
The 5S numbers game..
突破信息检索壁垒 -SciFinder Scholar 介绍
A Fractional Order (Proportional and Derivative) Motion Controller Design for A Class of Second-order Systems Center for Self-Organizing Intelligent.
The basics for simulations
1 Searching in a Graph Jeff Edmonds York University COSC 3101 Lecture 5 Generic Search Breadth First Search Dijkstra's Shortest Paths Algorithm Depth First.
PP Test Review Sections 6-1 to 6-6
Chapter 12 – Data Structures
MM4A6c: Apply the law of sines and the law of cosines.
2002 Prentice Hall, Inc. All rights reserved. Outline 25.1Introduction 25.2Basic HTML Tables 25.3Intermediate HTML Tables and Formatting 25.4Basic HTML.
Figure 3–1 Standard logic symbols for the inverter (ANSI/IEEE Std
The Camo Bots Hiding Since Team Members Mr. Brian Landry - Advisor Mr. Patrick Farley - Advisor Mr. Marty OHora - Advisor Doug Yatsonsky.
TCCI Barometer March “Establishing a reliable tool for monitoring the financial, business and social activity in the Prefecture of Thessaloniki”
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Progressive Aerobic Cardiovascular Endurance Run
Visual Highway Data Select a highway below... NORTH SOUTH Salisbury Southern Maryland Eastern Shore.
Making Landmark or Friendly Numbers. Category 1 Designed to be one away from a landmark or friendly number.
Slide P- 1. Chapter P Prerequisites P.1 Real Numbers.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
When you see… Find the zeros You think….
2011 WINNISQUAM COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=1021.
Before Between After.
2011 FRANKLIN COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=332.
ST/PRM3-EU | | © Robert Bosch GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as copying.
Subtraction: Adding UP
Numeracy Resources for KS2
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Static Equilibrium; Elasticity and Fracture
ANALYTICAL GEOMETRY ONE MARK QUESTIONS PREPARED BY:
Resistência dos Materiais, 5ª ed.
Lial/Hungerford/Holcomb/Mullins: Mathematics with Applications 11e Finite Mathematics with Applications 11e Copyright ©2015 Pearson Education, Inc. All.
Doc.: IEEE /0333r2 Submission July 2014 TGaj Editor Report for CC12 Jiamin Chen, HuaweiSlide 1 Date: Author:
1 Some Pitfalls in Testing … Japan Imports of Wheat US Pacific and Gulf Export Ports.
UNDERSTANDING THE ISSUES. 22 HILLSBOROUGH IS A REALLY BIG COUNTY.
1 Dr. Scott Schaefer Least Squares Curves, Rational Representations, Splines and Continuity.
Chart Deception Main Source: How to Lie with Charts, by Gerald E. Jones Dr. Michael R. Hyman, NMSU.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Introduction Embedded Universal Tools and Online Features 2.
Schutzvermerk nach DIN 34 beachten 05/04/15 Seite 1 Training EPAM and CANopen Basic Solution: Password * * Level 1 Level 2 * Level 3 Password2 IP-Adr.
Presentation transcript:

1 © 2009 Universität Karlsruhe (TH), System Architecture Group Priority Inversion

© 2009 Universität Karlsruhe (TH), System Architecture Group 2 Roadmap for Today Priority Inversion Resource protocols Synchronization Mechanisms Signaling Semaphores Monitors Synchronization Problems Producer / Consumer and Reader / Writer

© 2009 Universität Karlsruhe (TH), System Architecture Group 3 Example 5 processes process number equals priority Priority of P5 > priority of P1 Release and execution times as shown No deadlines (only an example for later comparison) Priority-driven preemptively scheduled P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 4 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 5 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 6 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 7 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 8 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 9 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 10 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 11 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 12 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 13 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 14 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 15 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 16 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 17 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 18 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 19 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 20 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 21 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 22 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 23 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 24 Example P1 P2 P3 P4 P5

© 2009 Universität Karlsruhe (TH), System Architecture Group 25 Reality is more complex Processes are not usually independent

© 2009 Universität Karlsruhe (TH), System Architecture Group 26 Real-Time Traffic Scheduling Two process streams A high priority & a low priority

© 2009 Universität Karlsruhe (TH), System Architecture Group 27 Problem Intersection is a mutually exclusive resource

© 2009 Universität Karlsruhe (TH), System Architecture Group 28 Mutual Exclusion Can be solved by resource access protocols

29 © 2009 Universität Karlsruhe (TH), System Architecture Group Priorities and Resource Contention Main Reference Pane W. S. Liu Real-time Systems, Chapter 8

© 2009 Universität Karlsruhe (TH), System Architecture Group 30 Resources Processes require resources in order to execute. (e.g. locks, ports, memory, …) Resource characteristics Serially reusable, Mutually exclusive We ignore resources that are infinitely available or exceed demand, or can be pre-allocated.

© 2009 Universität Karlsruhe (TH), System Architecture Group 31 Resource Contention Problem Priority inversion. We need to, at least, bound the length of priority inversion. Preferably minimize the length of priority inversion. P3P3 P2P2 P1P1 R Famous example of priority inversion: Mars Pathfinder 1997

© 2009 Universität Karlsruhe (TH), System Architecture Group 32 Marth Pathfinder Mars Path Finder and the famous Mars Rock YOGI

© 2009 Universität Karlsruhe (TH), System Architecture Group 33 Resource Contention Problems Timing anomaly Deadlock P2P2 P1P1 R2R2 2 1 R1R1

© 2009 Universität Karlsruhe (TH), System Architecture Group 34 Major Assumption Single processor system Resource Contention

© 2009 Universität Karlsruhe (TH), System Architecture Group 35 Our Example + 2 Resources Resource 1 Resource 2 Nested Critical Section * * P2 first needs R1 and then later additionally R2 Example with Resources P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 36 Simple Priority Driven Scheduling SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 37 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 38 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 39 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 40 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 41 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 42 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 43 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 44 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 45 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 46 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 47 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 48 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 49 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 50 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 51 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 52 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 53 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 54 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 55 Example SPD Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 56 Result The most important processes P5 and P4 are heavily delayed P3 is almost not delayed due to its characteristic, it does not need any resource Find a better solution SPD Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 57 4 Resource Allocation Protocols Non Preemptive Critical Sections (NPCS) Priority Inheritance (PI) Priority-Ceiling Protocol (PCP) Stacked Priority-Ceiling Protocol (SPCP) … and some others See text book (Liu) Resource Allocation Protocols

© 2009 Universität Karlsruhe (TH), System Architecture Group 58 Nonpreemptive Critical Sections As soon as a process holds a resource it is no longer preemptable * Prevents deadlock Bounds priority inversion Max blocking time is the maximum execution time of the critical sections of all lower priority processes P3 P2 P1 R * This process gets highest priority in system 3 NPCS Scheduling max prio cannot happen at t1 Allocate at t0

© 2009 Universität Karlsruhe (TH), System Architecture Group 59 Non-Preemptive Critical Sections NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 60 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 61 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 62 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 63 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 64 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 65 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 66 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 67 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 68 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 69 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 70 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 71 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 72 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 73 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 74 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 75 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 76 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 77 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 78 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 79 Example NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 80 Comparison with SPD-Scheduling NPCS Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 81 Analysis: Nonpreemptive Critical Sections Pros Simple No prior knowledge of resource requirements needed Prevents deadlock Cons Low priority process blocks high priority process even when there are no resource conflicts Protocol only suitable for trusted software Usually implemented by interrupt disabling In CS there is no system calls otherwise CPU wasting in case of a blocking system call NPCS Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 82 Worst-Case Blocking Time Longest lower-priority critical section: bt = blocking time cst = critical section time bt i (rc) = max {cst k } i+1 k n NPCS Scheduling Not that realistic

© 2009 Universität Karlsruhe (TH), System Architecture Group 83 Priority Inheritance (PI) When a high-priority process (P3) blocks, the low-priority process (P1) inherits the current priority of the blocking process PI bounds priority inversion 1 P3 P2 P1 R PI Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 84 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 85 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 86 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 87 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 88 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 89 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 90 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 91 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 92 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 93 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 94 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 95 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 96 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 97 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 98 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 99 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 100 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 101 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 102 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 103 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 104 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 105 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 106 Example with Priority Inheritance PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 107 Comparison with SPD Rule PI Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 108 Analysis: Priority Inheritance Pros Prevents uncontrolled priority inversion. Needs no knowledge of resource requirements. Cons Does not prevent deadlock. Does not minimise blocking times. With chained blocking, worst-case blocking time is min(n,m) critical sections n = number of lower priority processes that can block P m = number of resources that can be used to block P Some overhead in a release or acquire operation PI Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 109 Chained Blocking 4 lower priority processes 4 potentially conflicting resources Worst-case blocking time = 16 units 1 Time Priority PI Scheduling 1 Assume lower priority process allocates its first resource just before higher priority process runs

© 2009 Universität Karlsruhe (TH), System Architecture Group 110 Priority Ceiling Protocol Avoids deadlock by defining an order of resource acquisition Prevents transitive (chained) blocking Worst-case blocking time = single critical section PCP Scheduling Description how to implement PCP, see:

© 2009 Universität Karlsruhe (TH), System Architecture Group 111 Priority Ceilings Resources required by all processes are known a priori Similar approach as with deadlock avoidance Priority ceiling of resource R i is equal to the highest priority of all processes that use R i Priority ceiling of system is highest priority ceiling of all resources currently in use PCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 112 Priority Ceilings of Our Example =5 =4 Priority Ceilings of Ri PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 113 Priority Ceiling Protocol Rules Priority inheritance applies as before. When a process (P) requests a resource (R) either: If R is allocated P blocks (+ priority inheritance) If R is free, If Ps current priority > systems priority ceiling R is allocated to process P If Ps current priority systems priority ceiling P blocks – except if: P already holds a resource whose priority ceiling is equal to the systems priority ceiling PCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 114 Example curr max PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 115 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 116 Example curr PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 117 Example Prio(P2) < CurrSPC no allocation PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 118 Example … but P1 inherits prio(P2) = 2 PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 119 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 120 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 121 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 122 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 123 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 124 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 125 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 126 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 127 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 128 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 129 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 130 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 131 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 132 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 133 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 134 Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 135 Comparison to Previous Example PCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 136 Analysis: Priority Ceiling Protocol Pros Avoids deadlocks If a process doesnt self suspend, a process is blocked at most once during execution Processes cannot be transitively blocked minimizes blocking time to the longest lower-priority conflicting critical section (+ context switches) Processes only receive their first resource when all required resources are not held by lower priority processes Cons A priori knowledge of resource needs is required PCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 137 Stack-Based Priority Ceiling Protocol The motivation is to share a single stack for all processes Saves stack space. Restriction: processes cannot self- suspend. SPCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 138 Rules Scheduling: After a process is released, it is blocked from starting until its assigned priority is higher than the current system priority ceiling. Unblocked processes are preemptively priority scheduled according to their assigned priority. Resource allocation: Whenever a process requests a resource it receives the resource. SPCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 139 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 140 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 141 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 142 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 143 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 144 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 145 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 146 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 147 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 148 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 149 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 150 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 151 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 152 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 153 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 154 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 155 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 156 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 157 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 158 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 159 Example SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 160 Comparison with Priority Ceiling Protocol SPCP Scheduling P5 P4 P3 P2 P1

© 2009 Universität Karlsruhe (TH), System Architecture Group 161 Analysis: Stack-Based Priority Ceiling Pros Simple to implement. Slightly better worst-case when compared to normal PCP – two less context switches. No priority inheritance needed. Cons Threads cannot self suspend. SPCP Scheduling

© 2009 Universität Karlsruhe (TH), System Architecture Group 162 Summary 4 protocols controlling resource access in priority driven preemptive systems NPCS PI PCP SPCP Summary

© 2009 Universität Karlsruhe (TH), System Architecture Group 163 Summary NPCS and PI do not require a priori knowledge of resource requirements PI neither prevents deadlocks nor avoids deadlocks All protocols -except PI- ensure that processes are blocked at most once * Summary