3 Priority Inversion ProblemPhenomenon where a higher priority job is blocked by lower priority jobsIndefinite priority inversionOccurs when a task of medium priority preempts a task of lower priority which is blocking a task of higher priority.Uncontrolled priority inversion

10 Description of Basic ProtocolIf job J blocks higher priority jobs:J inherits PH , the highest priority of the jobs blocked by J .Priority inheritance is transitive.If J3 blocks J2 and J2 blocks J1, J3 would inherit the priority of J1 via J2.When J exits a critical section:J resumes the priority it had at the point of entry into the critical section.

15 Blocking in Basic ProtocolThree Types of blockingDirect blockingEnsures the consistency of shared data.Push-through blockingPrevents indefinite blocking due to priority inversionTransitive blockingBy not-directly involved semaphores which are accessed in a nested form by blocking jobs.Transitive blocking is said to occur if a job J is blocked by Ji which, in turn, is blocked by another job Jj .

16 Properties of Basic Protocol (1/3)A high priority job JH can be blocked by a lower priority job JL:[Lemma1: Blocking condition]: Only if JL is executing within a critical section, zj,k  *H.L when JH is initiated.[Lemma2: Blocking duration from one lower priority job]: For at most the duration of one critical section *H.L, regardless of the number of semaphores JH and JL share.[Theorem 3: Blocking duration]: Given a job J0 for which there are n lower priority jobs { J1,..., Jn }:J0 can be blocked for at most the duration of one critical section in each of *0,i, 1  i  n.NOTE: Each of n lower priority jobs can block job J0 for at most the duration of a single critical section in each of the blocking in sets *0,i .

17 Properties of Basic Protocol (2/3)[Lemma 4: Push-through blocking condition]: Semaphore S can cause push-through blocking to job J:Only if S is accessed both (1) by a job which has priority lower than that of J and (2) by a job which has or can inherit priority equal to or higher than that of J .J is a medium-priority job which may have no relation with SNotation*i,j,k: The set of all longest critical sections of job Jj guarded by semaphore Sk and block job Ji either directly or via push-trough blocking *i,j,k  { zj,p  zj,p  *i,j and sj,p  Sk } *i,•,k  Uji *i,j,k

23 Summary of Basic ProtocolBasic IdeaIf a job blocks higher priority jobs, it inherits the highest priority of the jobs blocked by it.Three types of blocking(1) Direct blocking, (2) push-through blocking, and (3) transitive blockingControlled priority inversionUpper bound on the total blocking delay that a job can encounterCan be determined by studying the durations of the critical sections in *i,j and *i,•,k .ProblemsDeadlocksLong blocking delayDue to transitive blocking and blocking chains

25 Overview of PCP Goals: Basic idea: Solve problems of BPI.Prevent deadlocks, transitive blocking and blocking chainsBasic idea:Priority ceiling of a semaphore:The priority of the highest priority task that may use the semaphoreAdditional condition for allowing a job J to start a new critical sectiononly if J’s priority is higher than all priority ceilings of all the semaphores locked by jobs other than J .

32 Properties of PCP (1/2)[Lemma 7: Blocking condition]: A job J can be blocked by a lower priority job JL,Only if the priority of job J is no higher than the highest priority ceiling of all the semaphores that are locked by all lower priority jobs when J enters its critical section.[Lemma 8: Inheritance condition]: If zj,n of Jj is preempted by Ji which enters zi,m ,Jj cannot inherit a priority level which is higher than or equal to that of Ji until Ji completes.[Lemma 9: No transitive blocking]: The priority ceiling protocol prevents transitive blocking.[Theorem 10: No deadlocks]: The priority ceiling protocol prevents deadlocks.

33 Properties of PCP (2/2)[Lemma 11: Blocking duration from one lower priority job]: Ji can be blocked by JLFor at most the duration of one critical section in *i,L .[Theorem 12: Blocking duration]: Ji can be blockedFor at most the duration of at most one element of *i. The maximum blocking delay for a job is bounded byThe duration of the longest critical section among those of lower priority jobs[Corollary 13: Blocking duration]: If a generalized job Ji suspends itself n times during its execution, it can be blockedBy at most n+1 not necessarily distinct elements of *i.

34 Summary of PCP Basic Idea Priority ceiling of a semaphore:The priority of the highest priority task that may use the semaphoreAdditional condition for allowing a job J to start a new critical sectiononly if J’s priority is higher than all priority ceilings of all the semaphores locked by jobs other than J .PCP solves the problems of BPINo Deadlocks, no transitive blocking, and no blocking chainsThree types of blocking(1) Direct blocking, (2) push-through blocking, and (3) ceiling blockingThe maximum blocking delay for a job is bounded byThe duration of the longest critical section among those of lower priority jobs

36 Schedulability AnalysisGoal:Extend the RMS algorithmsConsidering the effect of blocking under PCP[Theorem 14: RMS theory of Liu & Layland]: Utilization bound based approach[Theorem 15: RMS theory of Lehoczky et al]: Time demand based approachNotationBi: The worst case blocking time of a job in task i, where

37 Utilization Bound Based Approach[Theorem 16: Extension of Theorem 14]: A set of n periodic tasks using PCP can be scheduled by RMS ifProofThe inequality holds when there is no blocking.Task i still meets its deadline when its execution is delayed by Bi.[Corollary 17]: A set of n periodic tasks using PCP can be scheduled by RMS ifIf this equation holds, then all the equations in [Theorem 16] holds.max{B1/B1, …, Bn-1/Bn-1}  Bi/Bi식 잘 못 된 것 수정

38 Time Demand Based Approach[Theorem 18: Extension of Theorem 15]: A set of n periodic tasks using PCP can be scheduled by RMS for all task phasings ifProofidentical to that of proof for [Theorem 16], where잘못된 수식 고치기