Resource_Access_Protocol - PIP, PCP, SRP

常见的protocol有Non Preemption Protocol (NPP),Highest Locker’s Priority Protocol (HLP),Priority Inheritance Protocol (PIP,优先级继承),Priority Ceiling Protocol (PCP,优先级天花板),Stack-based Resource Policy (SRP)。后3者应用比较多,且他们呈现递进关系,PCP是PIP的改进,SRP是PCP的改进。本文主要针对PIP,PCP和SRP。

问题

Unbounded Priority Inversion

简单的优先级反转。

引入任务抢占后,优先级反转会导致不可预测的等待时间。这称为Unbounded Priority Inversion。

Dead lock

当有多个任务要请求多个资源的时候,则很有可能出现死锁的情况。

Transitive blocking

阻塞的传递,看下图

当有嵌套临界区的时候,就很容易产生阻塞传递。J1J2阻塞因为S2,J2J3阻塞因为S1,导致J1必须等待J3释放S1,然后J2释放S2之后,才可以顺利获得S2进入临界区。

Schedulability

PIP

定义

  • direct blocking:普通的资源竞争。当一个任务申请的资源被另一个任务锁住时,即是direct blocking。
  • push-through blocking: 因为priority inversion导致的阻塞。

算法

  • A gets semaphore S
  • B with higher priority tries to lock S, and blocked by S
  • B transfers its priority to A (so A is resumed and run with B’s priority)
  • A finishes its critical section and back to original priority before it enters the critical section

优点

因为当前占住资源的任务,始终以最高优先级在运行,中等优先级的任务就不可能抢占低优先级任务,所以解决了Unbounded Priority Inversion。

缺点

  • PIP并不能解决死锁问题。
  • PIP也不能解决阻塞传递的问题。
  • PIP还有不够完善的地方是在处理多次资源请求时,每一次资源请求都可能被block,导致过多的context switch。如下的Task1。

PCP

PCP算法只能适用于binary semaphore场景。

定义

  • 一个semaphore的ceiling是所有可能lock它的线程的最高优先级
  • 某一时刻,针对某一任务J的ceiling是,除J以外的其他线程已lock的semaphore的ceiling最大值
  • ceiling blocking: 因为优先级不大于系统优先级天花板导致的阻塞
  • S: 导致ceiling blocking的信号量
  • π(J): 任务J的优先级
  • C(S): 信号量S的优先级天花板
  • π(J): 系统针对J的优先级天花板

算法

  • 当某一任务J需要lock一个semaphore时
    • 若该资源已被J lock
      • π(J)π(J),则J被block
      • π(J)>π(J),则J获得J的优先级,直到J释放该资源
    • 若该资源free
      • π(J)π(J),则JS阻塞,因为π(J)C(S),所以不会发生优先级继承
      • π(J)>π(J),则J可以锁住该资源
  • 如果一个任务不涉及申请资源,则它可以正常抢占(preempt)其他低优先级任务。

OCPP vs. ICPP

OCPP = Original Ceiling Priority Protocol, ICPP = Immediate Ceiling Priority Protocol

Wiki词条Priority ceiling protocol中提到这两种算法,OCPP就是Lui Sha et.在[3]中提到的算法。ICPP是OCPP的一个变种。在[5]中称之为Highest Locker’s Priority Protocol (HLP) 。Wiki上称:

The worst-case behaviour of the two ceiling schemes is identical from a scheduling view point. Both variants work by temporarily raising the priorities of tasks.

ICPP的基本算法是:

In ICPP, a task's priority is immediately raised when it locks a resource. The task's priority is set to the priority ceiling of the resource, thus no task that may lock the resource is able to get scheduled.

不明白后半句是啥意思,相同优先级的线程应该是可以得到轮转运行的,除非,禁止round robin

ICPP与OCPP的不同之处在于:

  • ICPP is easier to implement than OCPP, as blocking relationships need not be monitored
  • ICPP leads to fewer context switches as blocking is prior to first execution
  • ICPP requires more priority movements as this happens with all resource usage
  • OCPP changes priority only if an actual block has occurred

看起来ICPP唯一的问题是会带来频繁的调整优先级,OCPP只在发生blocking的时候调整

优点

  1. 因为PCP包含PIP,所以PCP包含PIP所有的优点
  2. PCP可以解决死锁问题。

证明

再看这张图

此时有:

C(S1)=H,C(S2)=H

当Task1试图执行P(S1)时,π(Task1)=C(S2)=H,显然π(Task1)π(Task1),不能获取S1,被阻塞,也就不会有后来的P(S2)了。

当Task2试图执行P(S2)时,π(Task2)=0,因为除了Task2,没有其他的资源被锁住。所以Task2可以顺利获得资源S1。

综上,死锁不可能发生。

  1. 没有阻塞传递。

证明

假设J3阻塞J2, J2阻塞J1

t3时,C(S1)π(J2)C(S1)π(J3)J2 lock成功,说明π(J2)>C(S1),矛盾。正确的图如下:

成功避免transitive blocking。

  1. 被低优先级任务阻塞(priority inversion)只会发生一次

证明

假设有π(J1)>π(J2)

  • 如果J1J2阻塞两次,分别在J1申请资源A,B时,则有

这种情况不可能发生,因为当A被释放时(V(A)),因为J1是高优先级任务,A一旦释放,J1则会立即得到运行

  • 如果J1被不同的任务J2,J3阻塞

  • J1对A,B有诉求,说明π(J1)C(A)π(J1)C(B)
  • J2能得到运行,说明π(J2)>π(J2)C(B)
  • 综上,两者矛盾,因为π(J2)<π(J1)。所以如果J1对B有诉求,则J2在申请A的时候会被阻塞(ceiling blocking),因为π(J2)C(B)π(J1)>π(J2),即π(J2)<π(J2)
  1. PCP不用考虑PIP中的链式调整的问题

PIP中的链式调整如下图:

假如Task0对Lock0的申请,提升了Task1的优先级,则如果Task1已经因为申请Lock1,提升了Task2的优先级,则此时需要同步调整。但是在PCP中这一链条不存在。

考虑Task0来申请Lock0的时候,需要提升Task1的优先级,如果链条要成立则:

  • π(Task0)>π(Task1)>π(Task2)>
  • owner(Lock1) = Task2, owner(Lock0) = Task1
  • Task1 is in Lock1 waiter list

考虑下面两种情况:

  • 当Task1要占住Lock0时,若Task2已经占住Lock1,则π(Task2)>C(Lock1),因为Task1对Lock1有诉求,则C(Lock1)pi(Task1),所以Task1无法锁住Lock0,该情况不成立,无法形成链
  • 当Task1要占住Lock0时,若Task2尚未占住Lock1,
    • 因为Task0对Lock0有诉求,说明C(Lock0)π(Task0)
    • 因为Task1对Lock1有诉求,说明C(Lock1)π(Task1)
    • 当Task2在申请Lock1,Task1已经占住Task0,此时Task2能获得Lock1,说明π(Task2)>C(Lock0)π(Task0)π(Task2)>π(Task0)说明链式调整不需要。

综上,PCP不用考虑链式调整。

缺点

PCP在绝大多数情况下都可以运行的很好了,缺点是:

  1. 只支持binary semaphore。缺少对多资源信号量的支持。
  2. 对动态优先级调度算法的实现过于复杂,要实时调整系统针对每个任务的priority ceiling。
  3. 虽然context switch已经叫PIP较为减少,但仍然有提升空间

SRP

SRP的产生可以克服这些PCP的缺点。

之所以叫stack based,因为它的诞生和嵌入式领域的stack sharing[1]有关。

stack sharing用于节省内存。如果左边每个栈空间为10K,则总共需要30K。在栈空间不是很紧张的时候,采用stack sharing后,只需要总共10K的栈空间

stack sharing有一个特性,就是任务只能在栈顶的时候才能得到运行。当一个任务被另一个任务抢占后,意味着被抢占的任务要等到抢占者运行结束才有机会运行。

当采用stack sharing之后,stack也就变成了一种共享资源。

虽然SRP是因为stack sharing而产生,但即便在不是stack sharing的场合,也有很好的性能。

定义

preemption level

在[2][4]中都有提及如何定义preemption level,大意都是相同的。

[2]中提到

The reason for introducing preemption levels as distinct from priorities (p(J)) is to enable us to do static analysis of potential resource conflicts, even for some dynamic priority schemes such as EDF scheduling.

The only property of preemption levels on which these results do depend is the following condition (P1):

p(J)p(J)Arrival(J)Arrival(J)π(J)<π(J)

[4]中提到

The general definition of preemption level used to prove all properties of the SRP requires that

if τa arrives after τb and τa has higher priority than τb, then τa must have a higher preemption level than τb

Under EDF scheduling, the previous condition is satisfied if preemption levels are ordered inversely with respect to the order of relative deadlines .

D(i)>D(j)π(i)<π(j)

综上,总结如下:

  • preemption level是一个抽象的数据,用来对资源竞争做静态分析。解决EDF框架中没有优先级数据的问题。
  • preemption level在不同的调度框架下,实现方法可以不同,例如
    • EDF,采用relative deadline的反比,即π(J)DJ1
    • 其他调度框架,可以直接使用优先级数值

问题: 为什么在EDF下D(i)<D(j)能保证π(i)>π(j)

证明:考虑下面两种情况:

  1. 若任务i先到,记作ti<tj,则ti+Di<tj+Dj,所以i的absolute deadline较小,i的优先级较高,且i先执行,j没有机会抢占i,所以π(i)>π(j)
  2. 若任务j先到,则考虑在SRP中,preemption只发生在任务开始时,所以j先到,j没有必要preempt,所以π(i)>π(j)

其他定义

  • priority:优先级,可能会动态调整,例如在一些动态优先级调度算法中,例如EDF

  • preemption level:相对优先级,preemption level是静态的,方便在动态优先级算法中,预测资源竞争。通常取任务的初始优先级。

  • ceiling:SRP的ceiling定义与PCP不一样。

RνR=max({0}{π(J)νR<μR(J)})

其中:

  • μR: maximum number of units of R that job J may need to hold at any one time.
  • νR: the number of units of R that are currently available
  • current ceiling: π=max{RiνRi=1,,m}

算法

因为preemption level是静态的,所以对ceiling的计算也是静态的,所以可以预先计算并写入一张表格。

引用原论文[2]中的例子

假如J1, J2, J3在生命周期中申请资源如下:

直观一点的资源申请图:

可以计算出RνR表格如下:

R20为例:

  • νR=0
  • R20=max({0}{π(J)0<μR(J)})
  • π(Ii)=p(Ji)=i , 则满足上式的最大的π(J)=2,如表所示。
  • 当任务J ready时,计算此时的preemption level是否满足:π(J)>π,不满足则阻塞。

优点

  1. No job can be blocked after it starts. 没有block,所以没有额外的context switch。context switch只会发生在start execution和preemption。
  2. There can be n o transitive blocking or deadlock.
  3. If the oldest highest-priority job is blocked, it will become unblocked no later than the first instant that the currently executing job is not holding any non-preemptable resources

与PCP的异同

  • SRP与PCP相同的是,为了做统筹来得到全局最优解,二者都需要在系统初始化时决定每个资源的ceiling。

  • 不同的是,两者评估线程重要程度的指标不同。PCP采用的是优先级,SRP采用的是抽象的preemption level。这导致两者的ceiling指标计算方法也不太一样。而且SRP因为采用的是抽象的preemption level,这在不同的调度策略下的含义也不一样,所以只能在同一种调度策略下参与统筹计算。

  • SRP对资源ceiling的计算方法,考虑了多资源,而PCP只能使用在二义锁的情况下。

  • 因为SRP采用的是抽象的preemption level,所以可以很好的工作在类EDF调度策略下。而PCP如果要工作在EDF下,则比较困难。因为EDF的优先级由任务的绝对Deadline来决定,这与任务达到的时刻点有关系,如果要做PCP,就要知道线程的优先级,则要维护任务到达点信息,并计算优先级。

  • SRP因为他算法的优势,还带来了一些其他的优点,例如:

    • 线程一旦开始,就不会因为资源而被block,这使得上下文切换次数可以减少到最少。
    • 相比PCP,SRP更易于实现。

参考文献

[1] Bhuvan Middha, Matthew Simpson and Rajeev Barua, "MTSS: Multi Task Stack Sharing for Embedded Systems ", Department of Electrical & Computer Engineering University of Maryland College Park

[2] T.P. Baker, "A Stack-Based Resource Allocation Policy for Realtime Processes ", In Proceedings of the Real-Time Systems Symposium, pages 191–200, 1990

[3] Lui Sha; Ragunathan Rajkumar & John P. Lehoczky (September 1990). "Priority Inheritance Protocols: An Approach to Real-Time Synchronization". IEEE Transactions on Computers.

[4] The 2011 book Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications by Giorgio C. Buttazzo featured a dedicated section to reviewing SRP from Baker 1991 work.

[5] "Resource Access Protocols" slides from UPPSALA UNIVERSITET

[6] Priority ceiling protocol on wiki

%E5%B8%B8%E8%A7%81%E7%9A%84protocol%E6%9C%89Non%20Preemption%20Protocol%20(NPP)%EF%BC%8CHighest%20Locker%E2%80%99s%20Priority%20Protocol%20%20(HLP)%EF%BC%8CPriority%20Inheritance%20Protocol%20(PIP%EF%BC%8C%E4%BC%98%E5%85%88%E7%BA%A7%E7%BB%A7%E6%89%BF)%EF%BC%8CPriority%20Ceiling%20Protocol%20(PCP%EF%BC%8C%E4%BC%98%E5%85%88%E7%BA%A7%E5%A4%A9%E8%8A%B1%E6%9D%BF)%EF%BC%8CStack-based%20Resource%20Policy%20(SRP)%E3%80%82%E5%90%8E3%E8%80%85%E5%BA%94%E7%94%A8%E6%AF%94%E8%BE%83%E5%A4%9A%EF%BC%8C%E4%B8%94%E4%BB%96%E4%BB%AC%E5%91%88%E7%8E%B0%E9%80%92%E8%BF%9B%E5%85%B3%E7%B3%BB%EF%BC%8CPCP%E6%98%AFPIP%E7%9A%84%E6%94%B9%E8%BF%9B%EF%BC%8CSRP%E6%98%AFPCP%E7%9A%84%E6%94%B9%E8%BF%9B%E3%80%82%E6%9C%AC%E6%96%87%E4%B8%BB%E8%A6%81%E9%92%88%E5%AF%B9PIP%EF%BC%8CPCP%E5%92%8CSRP%E3%80%82%0A%0A%23%23%20%E9%97%AE%E9%A2%98%0A%0A%23%23%23%20Unbounded%20Priority%20Inversion%0A%0A%E7%AE%80%E5%8D%95%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E5%8F%8D%E8%BD%AC%E3%80%82%0A%0A!%5B5649cf806ca1f3713eedd57cb7e5d9fa.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5851)%0A%0A%0A%E5%BC%95%E5%85%A5%E4%BB%BB%E5%8A%A1%E6%8A%A2%E5%8D%A0%E5%90%8E%EF%BC%8C%E4%BC%98%E5%85%88%E7%BA%A7%E5%8F%8D%E8%BD%AC%E4%BC%9A%E5%AF%BC%E8%87%B4%E4%B8%8D%E5%8F%AF%E9%A2%84%E6%B5%8B%E7%9A%84%E7%AD%89%E5%BE%85%E6%97%B6%E9%97%B4%E3%80%82%E8%BF%99%E7%A7%B0%E4%B8%BAUnbounded%20Priority%20Inversion%E3%80%82%0A%0A!%5B8df099f053cbeaee4881a9d6ffc8963f.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5852)%0A%0A%0A%0A%0A%23%23%23%20Dead%20lock%0A%0A!%5B3bfb6dd811b3c01343eae69264f5637f.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5853)%0A%0A%0A%E5%BD%93%E6%9C%89%E5%A4%9A%E4%B8%AA%E4%BB%BB%E5%8A%A1%E8%A6%81%E8%AF%B7%E6%B1%82%E5%A4%9A%E4%B8%AA%E8%B5%84%E6%BA%90%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E5%88%99%E5%BE%88%E6%9C%89%E5%8F%AF%E8%83%BD%E5%87%BA%E7%8E%B0%E6%AD%BB%E9%94%81%E7%9A%84%E6%83%85%E5%86%B5%E3%80%82%0A%0A%23%23%23%20Transitive%20blocking%0A%0A%E9%98%BB%E5%A1%9E%E7%9A%84%E4%BC%A0%E9%80%92%EF%BC%8C%E7%9C%8B%E4%B8%8B%E5%9B%BE%0A%0A!%5B2513fdc689793678a116c5627fd2391b.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5854)%0A%0A%0A%E5%BD%93%E6%9C%89%E5%B5%8C%E5%A5%97%E4%B8%B4%E7%95%8C%E5%8C%BA%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E5%B0%B1%E5%BE%88%E5%AE%B9%E6%98%93%E4%BA%A7%E7%94%9F%E9%98%BB%E5%A1%9E%E4%BC%A0%E9%80%92%E3%80%82%24J_1%24%E8%A2%AB%24J_2%24%E9%98%BB%E5%A1%9E%E5%9B%A0%E4%B8%BAS2%EF%BC%8C%24J_2%24%E8%A2%AB%24J_3%24%E9%98%BB%E5%A1%9E%E5%9B%A0%E4%B8%BAS1%EF%BC%8C%E5%AF%BC%E8%87%B4%24J1%24%E5%BF%85%E9%A1%BB%E7%AD%89%E5%BE%85%24J_3%24%E9%87%8A%E6%94%BES1%EF%BC%8C%E7%84%B6%E5%90%8E%24J_2%24%E9%87%8A%E6%94%BES2%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%89%8D%E5%8F%AF%E4%BB%A5%E9%A1%BA%E5%88%A9%E8%8E%B7%E5%BE%97S2%E8%BF%9B%E5%85%A5%E4%B8%B4%E7%95%8C%E5%8C%BA%E3%80%82%0A%0A%23%23%23%20Schedulability%0A%0A%0A%0A%23%23%20PIP%0A%0A%23%23%23%20%E5%AE%9A%E4%B9%89%0A%0A-%20direct%20blocking%EF%BC%9A%E6%99%AE%E9%80%9A%E7%9A%84%E8%B5%84%E6%BA%90%E7%AB%9E%E4%BA%89%E3%80%82%E5%BD%93%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1%E7%94%B3%E8%AF%B7%E7%9A%84%E8%B5%84%E6%BA%90%E8%A2%AB%E5%8F%A6%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1%E9%94%81%E4%BD%8F%E6%97%B6%EF%BC%8C%E5%8D%B3%E6%98%AFdirect%20blocking%E3%80%82%0A-%20push-through%20blocking%3A%20%E5%9B%A0%E4%B8%BApriority%20inversion%E5%AF%BC%E8%87%B4%E7%9A%84%E9%98%BB%E5%A1%9E%E3%80%82%0A%0A%23%23%23%20%E7%AE%97%E6%B3%95%0A%0A-%20A%20gets%20semaphore%20S%0A-%20B%20with%20higher%20priority%20tries%20to%20lock%20S%2C%20and%20blocked%20by%20S%0A-%20B%20transfers%20its%20priority%20to%20A%20(so%20A%20is%20resumed%20and%20run%20with%20B%E2%80%99s%20priority)%20%0A-%20A%20finishes%20its%20critical%20section%20and%20back%20to%20original%20priority%20before%20it%20enters%20the%20critical%20section%0A%0A%23%23%23%20%E4%BC%98%E7%82%B9%0A%0A%E5%9B%A0%E4%B8%BA%E5%BD%93%E5%89%8D%E5%8D%A0%E4%BD%8F%E8%B5%84%E6%BA%90%E7%9A%84%E4%BB%BB%E5%8A%A1%EF%BC%8C%E5%A7%8B%E7%BB%88%E4%BB%A5%E6%9C%80%E9%AB%98%E4%BC%98%E5%85%88%E7%BA%A7%E5%9C%A8%E8%BF%90%E8%A1%8C%EF%BC%8C%E4%B8%AD%E7%AD%89%E4%BC%98%E5%85%88%E7%BA%A7%E7%9A%84%E4%BB%BB%E5%8A%A1%E5%B0%B1%E4%B8%8D%E5%8F%AF%E8%83%BD%E6%8A%A2%E5%8D%A0%E4%BD%8E%E4%BC%98%E5%85%88%E7%BA%A7%E4%BB%BB%E5%8A%A1%EF%BC%8C%E6%89%80%E4%BB%A5%E8%A7%A3%E5%86%B3%E4%BA%86Unbounded%20Priority%20Inversion%E3%80%82%0A%0A%23%23%23%20%E7%BC%BA%E7%82%B9%0A%0A-%20PIP%E5%B9%B6%E4%B8%8D%E8%83%BD%E8%A7%A3%E5%86%B3%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98%E3%80%82%0A-%20PIP%E4%B9%9F%E4%B8%8D%E8%83%BD%E8%A7%A3%E5%86%B3%E9%98%BB%E5%A1%9E%E4%BC%A0%E9%80%92%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%0A-%20PIP%E8%BF%98%E6%9C%89%E4%B8%8D%E5%A4%9F%E5%AE%8C%E5%96%84%E7%9A%84%E5%9C%B0%E6%96%B9%E6%98%AF%E5%9C%A8%E5%A4%84%E7%90%86%E5%A4%9A%E6%AC%A1%E8%B5%84%E6%BA%90%E8%AF%B7%E6%B1%82%E6%97%B6%EF%BC%8C%E6%AF%8F%E4%B8%80%E6%AC%A1%E8%B5%84%E6%BA%90%E8%AF%B7%E6%B1%82%E9%83%BD%E5%8F%AF%E8%83%BD%E8%A2%ABblock%EF%BC%8C%E5%AF%BC%E8%87%B4%E8%BF%87%E5%A4%9A%E7%9A%84context%20switch%E3%80%82%E5%A6%82%E4%B8%8B%E7%9A%84Task1%E3%80%82%0A%20%20!%5Bb2be2df4d66a9c75b11aee7f22a3121c.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5855)%0A%20%20%0A%0A%23%23%20PCP%0A%0APCP%E7%AE%97%E6%B3%95%E5%8F%AA%E8%83%BD%E9%80%82%E7%94%A8%E4%BA%8Ebinary%20semaphore%E5%9C%BA%E6%99%AF%E3%80%82%0A%0A%23%23%23%20%E5%AE%9A%E4%B9%89%0A%0A-%20%E4%B8%80%E4%B8%AAsemaphore%E7%9A%84ceiling%E6%98%AF%E6%89%80%E6%9C%89**%E5%8F%AF%E8%83%BD**lock%E5%AE%83%E7%9A%84%E7%BA%BF%E7%A8%8B%E7%9A%84%E6%9C%80%E9%AB%98%E4%BC%98%E5%85%88%E7%BA%A7%0A-%20%E6%9F%90%E4%B8%80%E6%97%B6%E5%88%BB%EF%BC%8C%E9%92%88%E5%AF%B9%E6%9F%90%E4%B8%80%E4%BB%BB%E5%8A%A1%24J%24%E7%9A%84ceiling%E6%98%AF%EF%BC%8C%E9%99%A4%24J%24%E4%BB%A5%E5%A4%96%E7%9A%84%E5%85%B6%E4%BB%96%E7%BA%BF%E7%A8%8B%E5%B7%B2lock%E7%9A%84semaphore%E7%9A%84ceiling%E6%9C%80%E5%A4%A7%E5%80%BC%0A-%20ceiling%20blocking%3A%20%E5%9B%A0%E4%B8%BA%E4%BC%98%E5%85%88%E7%BA%A7%E4%B8%8D%E5%A4%A7%E4%BA%8E%E7%B3%BB%E7%BB%9F%E4%BC%98%E5%85%88%E7%BA%A7%E5%A4%A9%E8%8A%B1%E6%9D%BF%E5%AF%BC%E8%87%B4%E7%9A%84%E9%98%BB%E5%A1%9E%0A-%20%24S%5E*%24%3A%20%E5%AF%BC%E8%87%B4ceiling%20blocking%E7%9A%84%E4%BF%A1%E5%8F%B7%E9%87%8F%0A-%20%24%5Cpi(J)%24%3A%20%E4%BB%BB%E5%8A%A1%24J%24%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%0A-%20%24C(S)%24%3A%20%E4%BF%A1%E5%8F%B7%E9%87%8F%24S%24%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E5%A4%A9%E8%8A%B1%E6%9D%BF%0A-%20%24%5Coverline%7B%5Cpi%7D(J)%24%3A%20%E7%B3%BB%E7%BB%9F%E9%92%88%E5%AF%B9%24J%24%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E5%A4%A9%E8%8A%B1%E6%9D%BF%0A%0A%23%23%23%20%E7%AE%97%E6%B3%95%0A%0A-%20%E5%BD%93%E6%9F%90%E4%B8%80%E4%BB%BB%E5%8A%A1%24J%24%E9%9C%80%E8%A6%81lock%E4%B8%80%E4%B8%AAsemaphore%E6%97%B6%0A%20%20-%20%E8%8B%A5%E8%AF%A5%E8%B5%84%E6%BA%90%E5%B7%B2%E8%A2%AB%24J'%24%20lock%0A%20%20%20%20-%20%24%5Cpi(J)%20%5Cle%20%5Cpi(J')%24%EF%BC%8C%E5%88%99%24J%24%E8%A2%ABblock%0A%20%20%20%20-%20%24%5Cpi(J)%20%5Cgt%20%5Cpi(J')%24%EF%BC%8C%E5%88%99%24J'%24%E8%8E%B7%E5%BE%97%24J%24%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E7%9B%B4%E5%88%B0%24J'%24%E9%87%8A%E6%94%BE%E8%AF%A5%E8%B5%84%E6%BA%90%0A%20%20-%20%E8%8B%A5%E8%AF%A5%E8%B5%84%E6%BA%90free%0A%20%20%20%20-%20%24%5Cpi(J)%20%5Cle%20%5Coverline%7B%5Cpi%7D(J)%24%EF%BC%8C%E5%88%99%24J%24%E8%A2%AB%24S%5E*%24%E9%98%BB%E5%A1%9E%EF%BC%8C%E5%9B%A0%E4%B8%BA%24%5Cpi(J)%20%5Cle%20C(S%5E*)%24%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B8%8D%E4%BC%9A%E5%8F%91%E7%94%9F%E4%BC%98%E5%85%88%E7%BA%A7%E7%BB%A7%E6%89%BF%0A%20%20%20%20-%20%24%5Cpi(J)%20%5Cgt%20%5Coverline%7B%5Cpi%7D(J)%24%EF%BC%8C%E5%88%99%24J%24%E5%8F%AF%E4%BB%A5%E9%94%81%E4%BD%8F%E8%AF%A5%E8%B5%84%E6%BA%90%0A-%20%E5%A6%82%E6%9E%9C%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1%E4%B8%8D%E6%B6%89%E5%8F%8A%E7%94%B3%E8%AF%B7%E8%B5%84%E6%BA%90%EF%BC%8C%E5%88%99%E5%AE%83%E5%8F%AF%E4%BB%A5%E6%AD%A3%E5%B8%B8%E6%8A%A2%E5%8D%A0(preempt)%E5%85%B6%E4%BB%96%E4%BD%8E%E4%BC%98%E5%85%88%E7%BA%A7%E4%BB%BB%E5%8A%A1%E3%80%82%0A%0A%23%23%23%23%20OCPP%20vs.%20ICPP%0A%0AOCPP%20%3D%20Original%20Ceiling%20Priority%20Protocol%2C%20ICPP%20%3D%20Immediate%20Ceiling%20Priority%20Protocol%0A%0AWiki%E8%AF%8D%E6%9D%A1%5BPriority%20ceiling%20protocol%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPriority_ceiling_protocol)%E4%B8%AD%E6%8F%90%E5%88%B0%E8%BF%99%E4%B8%A4%E7%A7%8D%E7%AE%97%E6%B3%95%EF%BC%8COCPP%E5%B0%B1%E6%98%AFLui%20Sha%20et.%E5%9C%A8%5C%5B3%5D%E4%B8%AD%E6%8F%90%E5%88%B0%E7%9A%84%E7%AE%97%E6%B3%95%E3%80%82ICPP%E6%98%AFOCPP%E7%9A%84%E4%B8%80%E4%B8%AA%E5%8F%98%E7%A7%8D%E3%80%82%E5%9C%A8%5B5%5D%E4%B8%AD%E7%A7%B0%E4%B9%8B%E4%B8%BAHighest%20Locker%E2%80%99s%20Priority%20Protocol%20(HLP)%20%E3%80%82Wiki%E4%B8%8A%E7%A7%B0%EF%BC%9A%0A%0AThe%20worst-case%20behaviour%20of%20the%20two%20ceiling%20schemes%20is%20identical%20from%20a%20scheduling%20view%20point.%20Both%20variants%20work%20by%20temporarily%20raising%20the%20priorities%20of%20tasks.%0A%0AICPP%E7%9A%84%E5%9F%BA%E6%9C%AC%E7%AE%97%E6%B3%95%E6%98%AF%EF%BC%9A%0A%0AIn%20ICPP%2C%20**a%20task's%20priority%20is%20immediately%20raised%20when%20it%20locks%20a%20resource.%20The%20task's%20priority%20is%20set%20to%20the%20priority%20ceiling%20of%20the%20resource**%2C%20thus%20no%20task%20that%20may%20lock%20the%20resource%20is%20able%20to%20get%20scheduled.%0A%0A*%E4%B8%8D%E6%98%8E%E7%99%BD%E5%90%8E%E5%8D%8A%E5%8F%A5%E6%98%AF%E5%95%A5%E6%84%8F%E6%80%9D%EF%BC%8C%E7%9B%B8%E5%90%8C%E4%BC%98%E5%85%88%E7%BA%A7%E7%9A%84%E7%BA%BF%E7%A8%8B%E5%BA%94%E8%AF%A5%E6%98%AF%E5%8F%AF%E4%BB%A5%E5%BE%97%E5%88%B0%E8%BD%AE%E8%BD%AC%E8%BF%90%E8%A1%8C%E7%9A%84%EF%BC%8C%E9%99%A4%E9%9D%9E%EF%BC%8C%E7%A6%81%E6%AD%A2round%20robin*%0A%0AICPP%E4%B8%8EOCPP%E7%9A%84%E4%B8%8D%E5%90%8C%E4%B9%8B%E5%A4%84%E5%9C%A8%E4%BA%8E%EF%BC%9A%0A%0A-%20ICPP%20is%20easier%20to%20implement%20than%20OCPP%2C%20as%20blocking%20relationships%20need%20not%20be%20monitored%0A-%20ICPP%20leads%20to%20fewer%20context%20switches%20as%20blocking%20is%20prior%20to%20first%20execution%0A-%20ICPP%20requires%20more%20priority%20movements%20as%20this%20happens%20with%20all%20resource%20usage%0A-%20OCPP%20changes%20priority%20only%20if%20an%20actual%20block%20has%20occurred%0A%0A%E7%9C%8B%E8%B5%B7%E6%9D%A5ICPP%E5%94%AF%E4%B8%80%E7%9A%84%E9%97%AE%E9%A2%98%E6%98%AF%E4%BC%9A%E5%B8%A6%E6%9D%A5%E9%A2%91%E7%B9%81%E7%9A%84%E8%B0%83%E6%95%B4%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8COCPP%E5%8F%AA%E5%9C%A8%E5%8F%91%E7%94%9Fblocking%E7%9A%84%E6%97%B6%E5%80%99%E8%B0%83%E6%95%B4%0A%0A%0A%23%23%23%20%E4%BC%98%E7%82%B9%0A%0A1.%20%E5%9B%A0%E4%B8%BAPCP%E5%8C%85%E5%90%ABPIP%EF%BC%8C%E6%89%80%E4%BB%A5PCP%E5%8C%85%E5%90%ABPIP%E6%89%80%E6%9C%89%E7%9A%84%E4%BC%98%E7%82%B9%0A2.%20PCP%E5%8F%AF%E4%BB%A5%E8%A7%A3%E5%86%B3%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98%E3%80%82%0A%0A%3E%20**%E8%AF%81%E6%98%8E**%0A%3E%0A%3E%20%E5%86%8D%E7%9C%8B%E8%BF%99%E5%BC%A0%E5%9B%BE%0A%3E%0A%3E%20!%5B3bfb6dd811b3c01343eae69264f5637f.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5853)%0A%3E%0A%3E%20%E6%AD%A4%E6%97%B6%E6%9C%89%EF%BC%9A%0A%3E%0A%3E%20%24%24C(S1)%20%3D%20H%2C%20C(S2)%20%3D%20H%24%24%0A%3E%0A%3E%20%E5%BD%93Task1%E8%AF%95%E5%9B%BE%E6%89%A7%E8%A1%8CP(S1)%E6%97%B6%EF%BC%8C%24%5Coverline%7B%5Cpi%7D(Task1)%20%3D%20C(S2)%20%3D%20H%24%EF%BC%8C%E6%98%BE%E7%84%B6%24%5Cpi(Task1)%20%5Cle%20%5Coverline%7B%5Cpi%7D(Task1)%24%EF%BC%8C%E4%B8%8D%E8%83%BD%E8%8E%B7%E5%8F%96S1%EF%BC%8C%E8%A2%AB%E9%98%BB%E5%A1%9E%EF%BC%8C%E4%B9%9F%E5%B0%B1%E4%B8%8D%E4%BC%9A%E6%9C%89%E5%90%8E%E6%9D%A5%E7%9A%84P(S2)%E4%BA%86%E3%80%82%0A%3E%0A%3E%20%E5%BD%93Task2%E8%AF%95%E5%9B%BE%E6%89%A7%E8%A1%8CP(S2)%E6%97%B6%EF%BC%8C%24%5Coverline%7B%5Cpi%7D(Task2)%20%3D0%24%EF%BC%8C%E5%9B%A0%E4%B8%BA%E9%99%A4%E4%BA%86Task2%EF%BC%8C%E6%B2%A1%E6%9C%89%E5%85%B6%E4%BB%96%E7%9A%84%E8%B5%84%E6%BA%90%E8%A2%AB%E9%94%81%E4%BD%8F%E3%80%82%E6%89%80%E4%BB%A5Task2%E5%8F%AF%E4%BB%A5%E9%A1%BA%E5%88%A9%E8%8E%B7%E5%BE%97%E8%B5%84%E6%BA%90S1%E3%80%82%0A%3E%0A%3E%20%E7%BB%BC%E4%B8%8A%EF%BC%8C%E6%AD%BB%E9%94%81%E4%B8%8D%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F%E3%80%82%0A%0A3.%20%E6%B2%A1%E6%9C%89%E9%98%BB%E5%A1%9E%E4%BC%A0%E9%80%92%E3%80%82%0A%0A%3E%20**%E8%AF%81%E6%98%8E**%0A%3E%0A%3E%20%E5%81%87%E8%AE%BE%24J_3%24%E9%98%BB%E5%A1%9E%24J_2%24%2C%20%24J_2%24%E9%98%BB%E5%A1%9E%24J_1%24%0A%3E%0A%3E%20!%5B2513fdc689793678a116c5627fd2391b.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5854)%0A%3E%0A%3E%20%24t_3%24%E6%97%B6%EF%BC%8C%24C(S_1)%20%5Cge%20%5Cpi(J_2)%20%5Cbigcap%20C(S_1)%20%5Cge%20%5Cpi(J_3)%24%EF%BC%8C%24J_2%24%20lock%E6%88%90%E5%8A%9F%EF%BC%8C%E8%AF%B4%E6%98%8E%24%5Cpi(J_2)%20%5Cgt%20C(S_1)%24%EF%BC%8C%E7%9F%9B%E7%9B%BE%E3%80%82%E6%AD%A3%E7%A1%AE%E7%9A%84%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%3E%0A%3E%20!%5B905612682c4d116a70d76d0852ea863b.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5857)%0A%3E%0A%3E%20%E6%88%90%E5%8A%9F%E9%81%BF%E5%85%8Dtransitive%20blocking%E3%80%82%0A%0A4.%20%E8%A2%AB%E4%BD%8E%E4%BC%98%E5%85%88%E7%BA%A7%E4%BB%BB%E5%8A%A1%E9%98%BB%E5%A1%9E(priority%20inversion)%E5%8F%AA%E4%BC%9A%E5%8F%91%E7%94%9F%E4%B8%80%E6%AC%A1%0A%0A%3E%20**%E8%AF%81%E6%98%8E**%0A%3E%0A%3E%20%E5%81%87%E8%AE%BE%E6%9C%89%24%5Cpi(J_1)%20%3E%20%5Cpi(J_2)%24%0A%3E%0A%3E%20-%20%E5%A6%82%E6%9E%9C%24J_1%24%E8%A2%AB%24J_2%24%E9%98%BB%E5%A1%9E%E4%B8%A4%E6%AC%A1%EF%BC%8C%E5%88%86%E5%88%AB%E5%9C%A8%24J_1%24%E7%94%B3%E8%AF%B7%E8%B5%84%E6%BA%90%24A%2C%20B%24%E6%97%B6%EF%BC%8C%E5%88%99%E6%9C%89%0A%3E%0A%3E%20!%5B499d02f4b995e801df99538302d05d02.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5856)%0A%3E%0A%3E%20%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E4%B8%8D%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%BD%93A%E8%A2%AB%E9%87%8A%E6%94%BE%E6%97%B6(V(A))%EF%BC%8C%E5%9B%A0%E4%B8%BA%24J_1%24%E6%98%AF%E9%AB%98%E4%BC%98%E5%85%88%E7%BA%A7%E4%BB%BB%E5%8A%A1%EF%BC%8CA%E4%B8%80%E6%97%A6%E9%87%8A%E6%94%BE%EF%BC%8C%24J_1%24%E5%88%99%E4%BC%9A%E7%AB%8B%E5%8D%B3%E5%BE%97%E5%88%B0%E8%BF%90%E8%A1%8C%0A%3E%0A%3E%20-%20%E5%A6%82%E6%9E%9C%24J_1%24%E8%A2%AB%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BB%BB%E5%8A%A1%24J_2%24%2C%24J_3%24%E9%98%BB%E5%A1%9E%0A%3E%0A%3E%20!%5B719fb123a87fd610c3fd5e86c4d5a5e1.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5858)%0A%3E%0A%3E%20-%20%24J_1%24%E5%AF%B9A%EF%BC%8CB%E6%9C%89%E8%AF%89%E6%B1%82%EF%BC%8C%E8%AF%B4%E6%98%8E%24%5Cpi(J_1)%20%5Cle%20C(A)%20%5Cbigcap%20%5Cpi(J_1)%20%5Cle%20C(B)%24%0A%3E%20-%20%24J_2%24%E8%83%BD%E5%BE%97%E5%88%B0%E8%BF%90%E8%A1%8C%EF%BC%8C%E8%AF%B4%E6%98%8E%24%5Cpi(J_2)%20%5Cgt%20%5Coverline%20%5Cpi(J_2)%20%5Cge%20C(B)%24%0A%3E%20-%20%E7%BB%BC%E4%B8%8A%EF%BC%8C%E4%B8%A4%E8%80%85%E7%9F%9B%E7%9B%BE%EF%BC%8C%E5%9B%A0%E4%B8%BA%24%5Cpi(J_2)%20%5Clt%20%5Cpi(J_1)%24%E3%80%82%E6%89%80%E4%BB%A5%E5%A6%82%E6%9E%9C%24J_1%24%E5%AF%B9B%E6%9C%89%E8%AF%89%E6%B1%82%EF%BC%8C%E5%88%99%24J_2%24%E5%9C%A8%E7%94%B3%E8%AF%B7A%E7%9A%84%E6%97%B6%E5%80%99%E4%BC%9A%E8%A2%AB%E9%98%BB%E5%A1%9E(ceiling%20blocking)%EF%BC%8C%E5%9B%A0%E4%B8%BA%24%5Coverline%7B%5Cpi%7D(J_2)%20%5Cge%20C(B)%20%5Cge%20%5Cpi(J_1)%20%5Cgt%20%5Cpi(J_2)%24%EF%BC%8C%E5%8D%B3%24%5Cpi(J_2)%20%5Clt%20%5Coverline%7B%5Cpi%7D(J_2)%24%0A%0A5.%20PCP%E4%B8%8D%E7%94%A8%E8%80%83%E8%99%91PIP%E4%B8%AD%E7%9A%84%E9%93%BE%E5%BC%8F%E8%B0%83%E6%95%B4%E7%9A%84%E9%97%AE%E9%A2%98%0A%0A%3E%20PIP%E4%B8%AD%E7%9A%84%E9%93%BE%E5%BC%8F%E8%B0%83%E6%95%B4%E5%A6%82%E4%B8%8B%E5%9B%BE%EF%BC%9A%0A%3E%0A%3E%20!%5B5d215d5515841e7614210ce226b6801c.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5887)%0A%0A%3E%0A%3E%20%E5%81%87%E5%A6%82Task0%E5%AF%B9Lock0%E7%9A%84%E7%94%B3%E8%AF%B7%EF%BC%8C%E6%8F%90%E5%8D%87%E4%BA%86Task1%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E5%88%99%E5%A6%82%E6%9E%9CTask1%E5%B7%B2%E7%BB%8F%E5%9B%A0%E4%B8%BA%E7%94%B3%E8%AF%B7Lock1%EF%BC%8C%E6%8F%90%E5%8D%87%E4%BA%86Task2%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E5%88%99%E6%AD%A4%E6%97%B6%E9%9C%80%E8%A6%81%E5%90%8C%E6%AD%A5%E8%B0%83%E6%95%B4%E3%80%82%E4%BD%86%E6%98%AF%E5%9C%A8PCP%E4%B8%AD%E8%BF%99%E4%B8%80%E9%93%BE%E6%9D%A1%E4%B8%8D%E5%AD%98%E5%9C%A8%E3%80%82%0A%3E%0A%3E%20%E8%80%83%E8%99%91Task0%E6%9D%A5%E7%94%B3%E8%AF%B7Lock0%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E9%9C%80%E8%A6%81%E6%8F%90%E5%8D%87Task1%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%93%BE%E6%9D%A1%E8%A6%81%E6%88%90%E7%AB%8B%E5%88%99%EF%BC%9A%0A%3E%0A%3E%20-%20%24%5Cpi(Task0)%20%5Cgt%20%5Cpi(Task1)%20%5Cgt%20%5Cpi(Task2)%20%5Cgt%20%5Cdots%24%0A%3E%20-%20owner(Lock1)%20%3D%20Task2%2C%20owner(Lock0)%20%3D%20Task1%0A%3E%20-%20Task1%20is%20in%20Lock1%20waiter%20list%0A%3E%0A%3E%20%E8%80%83%E8%99%91%E4%B8%8B%E9%9D%A2%E4%B8%A4%E7%A7%8D%E6%83%85%E5%86%B5%EF%BC%9A%0A%3E%0A%3E%20-%20%E5%BD%93Task1%E8%A6%81%E5%8D%A0%E4%BD%8FLock0%E6%97%B6%EF%BC%8C%E8%8B%A5Task2%E5%B7%B2%E7%BB%8F%E5%8D%A0%E4%BD%8FLock1%EF%BC%8C%E5%88%99%24%5Cpi(Task2)%20%5Cgt%20C(Lock1)%24%EF%BC%8C%E5%9B%A0%E4%B8%BATask1%E5%AF%B9Lock1%E6%9C%89%E8%AF%89%E6%B1%82%EF%BC%8C%E5%88%99%24C(Lock1)%20%5Cge%20pi(Task1)%24%EF%BC%8C%E6%89%80%E4%BB%A5Task1%E6%97%A0%E6%B3%95%E9%94%81%E4%BD%8FLock0%EF%BC%8C%E8%AF%A5%E6%83%85%E5%86%B5%E4%B8%8D%E6%88%90%E7%AB%8B%EF%BC%8C%E6%97%A0%E6%B3%95%E5%BD%A2%E6%88%90%E9%93%BE%0A%3E%20-%20%E5%BD%93Task1%E8%A6%81%E5%8D%A0%E4%BD%8FLock0%E6%97%B6%EF%BC%8C%E8%8B%A5Task2%E5%B0%9A%E6%9C%AA%E5%8D%A0%E4%BD%8FLock1%EF%BC%8C%0A%3E%20%20%20-%20%E5%9B%A0%E4%B8%BATask0%E5%AF%B9Lock0%E6%9C%89%E8%AF%89%E6%B1%82%EF%BC%8C%E8%AF%B4%E6%98%8E%24C(Lock0)%20%5Cge%20%5Cpi(Task0)%24%EF%BC%8C%0A%3E%20%20%20-%20%E5%9B%A0%E4%B8%BATask1%E5%AF%B9Lock1%E6%9C%89%E8%AF%89%E6%B1%82%EF%BC%8C%E8%AF%B4%E6%98%8E%24C(Lock1)%20%5Cge%20%5Cpi(Task1)%24%EF%BC%8C%0A%3E%20%20%20-%20%E5%BD%93Task2%E5%9C%A8%E7%94%B3%E8%AF%B7Lock1%EF%BC%8CTask1%E5%B7%B2%E7%BB%8F%E5%8D%A0%E4%BD%8FTask0%EF%BC%8C%E6%AD%A4%E6%97%B6Task2%E8%83%BD%E8%8E%B7%E5%BE%97Lock1%EF%BC%8C%E8%AF%B4%E6%98%8E%24%5Cpi(Task2)%20%5Cgt%20C(Lock0)%20%20%5Cge%20%5Cpi(Task0)%24%EF%BC%8C%24%5Cpi(Task2)%20%5Cgt%20%5Cpi(Task0)%24%E8%AF%B4%E6%98%8E%E9%93%BE%E5%BC%8F%E8%B0%83%E6%95%B4%E4%B8%8D%E9%9C%80%E8%A6%81%E3%80%82%0A%3E%0A%3E%20%E7%BB%BC%E4%B8%8A%EF%BC%8CPCP%E4%B8%8D%E7%94%A8%E8%80%83%E8%99%91%E9%93%BE%E5%BC%8F%E8%B0%83%E6%95%B4%E3%80%82%0A%0A%23%23%23%20%E7%BC%BA%E7%82%B9%0A%0APCP%E5%9C%A8%E7%BB%9D%E5%A4%A7%E5%A4%9A%E6%95%B0%E6%83%85%E5%86%B5%E4%B8%8B%E9%83%BD%E5%8F%AF%E4%BB%A5%E8%BF%90%E8%A1%8C%E7%9A%84%E5%BE%88%E5%A5%BD%E4%BA%86%EF%BC%8C%E7%BC%BA%E7%82%B9%E6%98%AF%EF%BC%9A%0A%0A1.%20%E5%8F%AA%E6%94%AF%E6%8C%81binary%20semaphore%E3%80%82%E7%BC%BA%E5%B0%91%E5%AF%B9%E5%A4%9A%E8%B5%84%E6%BA%90%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9A%84%E6%94%AF%E6%8C%81%E3%80%82%0A2.%20%E5%AF%B9%E5%8A%A8%E6%80%81%E4%BC%98%E5%85%88%E7%BA%A7%E8%B0%83%E5%BA%A6%E7%AE%97%E6%B3%95%E7%9A%84%E5%AE%9E%E7%8E%B0%E8%BF%87%E4%BA%8E%E5%A4%8D%E6%9D%82%EF%BC%8C%E8%A6%81%E5%AE%9E%E6%97%B6%E8%B0%83%E6%95%B4%E7%B3%BB%E7%BB%9F%E9%92%88%E5%AF%B9%E6%AF%8F%E4%B8%AA%E4%BB%BB%E5%8A%A1%E7%9A%84priority%20ceiling%E3%80%82%0A3.%20%E8%99%BD%E7%84%B6context%20switch%E5%B7%B2%E7%BB%8F%E5%8F%ABPIP%E8%BE%83%E4%B8%BA%E5%87%8F%E5%B0%91%EF%BC%8C%E4%BD%86%E4%BB%8D%E7%84%B6%E6%9C%89%E6%8F%90%E5%8D%87%E7%A9%BA%E9%97%B4%0A%0A%23%23%20SRP%0A%0ASRP%E7%9A%84%E4%BA%A7%E7%94%9F%E5%8F%AF%E4%BB%A5%E5%85%8B%E6%9C%8D%E8%BF%99%E4%BA%9BPCP%E7%9A%84%E7%BC%BA%E7%82%B9%E3%80%82%0A%0A%3E%20%E4%B9%8B%E6%89%80%E4%BB%A5%E5%8F%ABstack%20based%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%AE%83%E7%9A%84%E8%AF%9E%E7%94%9F%E5%92%8C%E5%B5%8C%E5%85%A5%E5%BC%8F%E9%A2%86%E5%9F%9F%E7%9A%84stack%20sharing%5B1%5D%E6%9C%89%E5%85%B3%E3%80%82%0A%3E%0A%3E%20!%5B6635599516cf187e0c50d27771a3b326.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5859)%0A%3E%0A%3E%20stack%20sharing%E7%94%A8%E4%BA%8E%E8%8A%82%E7%9C%81%E5%86%85%E5%AD%98%E3%80%82%E5%A6%82%E6%9E%9C%E5%B7%A6%E8%BE%B9%E6%AF%8F%E4%B8%AA%E6%A0%88%E7%A9%BA%E9%97%B4%E4%B8%BA10K%EF%BC%8C%E5%88%99%E6%80%BB%E5%85%B1%E9%9C%80%E8%A6%8130K%E3%80%82%E5%9C%A8%E6%A0%88%E7%A9%BA%E9%97%B4%E4%B8%8D%E6%98%AF%E5%BE%88%E7%B4%A7%E5%BC%A0%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E9%87%87%E7%94%A8stack%20sharing%E5%90%8E%EF%BC%8C%E5%8F%AA%E9%9C%80%E8%A6%81%E6%80%BB%E5%85%B110K%E7%9A%84%E6%A0%88%E7%A9%BA%E9%97%B4%0A%3E%0A%3E%20stack%20sharing%E6%9C%89%E4%B8%80%E4%B8%AA%E7%89%B9%E6%80%A7%EF%BC%8C%E5%B0%B1%E6%98%AF%E4%BB%BB%E5%8A%A1%E5%8F%AA%E8%83%BD%E5%9C%A8%E6%A0%88%E9%A1%B6%E7%9A%84%E6%97%B6%E5%80%99%E6%89%8D%E8%83%BD%E5%BE%97%E5%88%B0%E8%BF%90%E8%A1%8C%E3%80%82%E5%BD%93%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1%E8%A2%AB%E5%8F%A6%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1%E6%8A%A2%E5%8D%A0%E5%90%8E%EF%BC%8C%E6%84%8F%E5%91%B3%E7%9D%80%E8%A2%AB%E6%8A%A2%E5%8D%A0%E7%9A%84%E4%BB%BB%E5%8A%A1%E8%A6%81%E7%AD%89%E5%88%B0%E6%8A%A2%E5%8D%A0%E8%80%85%E8%BF%90%E8%A1%8C%E7%BB%93%E6%9D%9F%E6%89%8D%E6%9C%89%E6%9C%BA%E4%BC%9A%E8%BF%90%E8%A1%8C%E3%80%82%0A%3E%0A%3E%20%E5%BD%93%E9%87%87%E7%94%A8stack%20sharing%E4%B9%8B%E5%90%8E%EF%BC%8Cstack%E4%B9%9F%E5%B0%B1%E5%8F%98%E6%88%90%E4%BA%86%E4%B8%80%E7%A7%8D%E5%85%B1%E4%BA%AB%E8%B5%84%E6%BA%90%E3%80%82%0A%0A%E8%99%BD%E7%84%B6SRP%E6%98%AF%E5%9B%A0%E4%B8%BAstack%20sharing%E8%80%8C%E4%BA%A7%E7%94%9F%EF%BC%8C%E4%BD%86%E5%8D%B3%E4%BE%BF%E5%9C%A8%E4%B8%8D%E6%98%AFstack%20sharing%E7%9A%84%E5%9C%BA%E5%90%88%EF%BC%8C%E4%B9%9F%E6%9C%89%E5%BE%88%E5%A5%BD%E7%9A%84%E6%80%A7%E8%83%BD%E3%80%82%0A%0A%23%23%23%20%E5%AE%9A%E4%B9%89%0A%0A%23%23%23%23%20preemption%20level%0A%0A%E5%9C%A8%5C%5B2%5D%5C%5B4%5D%E4%B8%AD%E9%83%BD%E6%9C%89%E6%8F%90%E5%8F%8A%E5%A6%82%E4%BD%95%E5%AE%9A%E4%B9%89preemption%20level%EF%BC%8C%E5%A4%A7%E6%84%8F%E9%83%BD%E6%98%AF%E7%9B%B8%E5%90%8C%E7%9A%84%E3%80%82%0A%0A%5C%5B2%5D%E4%B8%AD%E6%8F%90%E5%88%B0%0A%0A%3EThe%20reason%20for%20introducing%20preemption%20levels%20as%20distinct%20from%20priorities%20(%24p(J)%24)%20is%20to%20enable%20us%20to%20do%20static%20analysis%20of%20potential%20resource%20conflicts%2C%20even%20for%20some%20dynamic%20priority%20schemes%20such%20as%20EDF%20scheduling.%0A%3E%0A%3EThe%20only%20property%20of%20preemption%20levels%20on%20which%20these%20results%20do%20depend%20is%20the%20following%20condition%20(P1)%3A%0A%3E%0A%3E%20%24p(J)%20%5Cle%20p(J')%20%5Cbigcup%20Arrival(J)%20%5Cle%20Arrival(J')%20%5Cbigcup%20%5Cpi(J)%20%5Clt%20%5Cpi(J')%24%0A%0A%5C%5B4%5D%E4%B8%AD%E6%8F%90%E5%88%B0%0A%0A%3EThe%20general%20definition%20of%20preemption%20level%20used%20to%20prove%20all%20properties%20of%20the%20SRP%20requires%20that%20%0A%3E%0A%3E**if%20%24%5Ctau_a%24%20arrives%20after%20%24%5Ctau_b%24%20and%20%24%5Ctau_a%24%20has%20higher%20priority%20than%20%24%5Ctau_b%24%2C%20then%20%24%5Ctau_a%24%20must%20have%20a%20higher%20preemption%20level%20than%20%24%5Ctau_b%24**%0A%3E%0A%3EUnder%20EDF%20scheduling%2C%20the%20previous%20condition%20is%20satisfied%20if%20preemption%20levels%20are%20ordered%20inversely%20with%20respect%20to%20the%20order%20of%20relative%20deadlines%20.%0A%3E%0A%3E%24%24D(i)%20%3E%20D(j)%20%5CRightarrow%20%5Cpi(i)%20%5Clt%20%5Cpi(j)%24%24%0A%0A%E7%BB%BC%E4%B8%8A%EF%BC%8C%E6%80%BB%E7%BB%93%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A-%20preemption%20level%E6%98%AF%E4%B8%80%E4%B8%AA%E6%8A%BD%E8%B1%A1%E7%9A%84%E6%95%B0%E6%8D%AE%EF%BC%8C%E7%94%A8%E6%9D%A5%E5%AF%B9%E8%B5%84%E6%BA%90%E7%AB%9E%E4%BA%89%E5%81%9A%E9%9D%99%E6%80%81%E5%88%86%E6%9E%90%E3%80%82%E8%A7%A3%E5%86%B3EDF%E6%A1%86%E6%9E%B6%E4%B8%AD%E6%B2%A1%E6%9C%89%E4%BC%98%E5%85%88%E7%BA%A7%E6%95%B0%E6%8D%AE%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%0A-%20preemption%20level%E5%9C%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E8%B0%83%E5%BA%A6%E6%A1%86%E6%9E%B6%E4%B8%8B%EF%BC%8C%E5%AE%9E%E7%8E%B0%E6%96%B9%E6%B3%95%E5%8F%AF%E4%BB%A5%E4%B8%8D%E5%90%8C%EF%BC%8C%E4%BE%8B%E5%A6%82%0A%20%20-%20EDF%EF%BC%8C%E9%87%87%E7%94%A8relative%20deadline%E7%9A%84%E5%8F%8D%E6%AF%94%EF%BC%8C%E5%8D%B3%24%5Cpi(J)%20%5Cpropto%20%5Cfrac%7B1%7D%7BD_J%7D%24%0A%20%20-%20%E5%85%B6%E4%BB%96%E8%B0%83%E5%BA%A6%E6%A1%86%E6%9E%B6%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8%E4%BC%98%E5%85%88%E7%BA%A7%E6%95%B0%E5%80%BC%0A%0A%3E%20**%E9%97%AE%E9%A2%98**%3A%20%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9C%A8EDF%E4%B8%8B%24D(i)%20%5Clt%20D(j)%24%E8%83%BD%E4%BF%9D%E8%AF%81%24%5Cpi(i)%20%5Cgt%20%5Cpi(j)%24%EF%BC%9F%0A%3E%0A%3E%20**%E8%AF%81%E6%98%8E**%EF%BC%9A%E8%80%83%E8%99%91%E4%B8%8B%E9%9D%A2%E4%B8%A4%E7%A7%8D%E6%83%85%E5%86%B5%EF%BC%9A%0A%3E%0A%3E%201.%20%E8%8B%A5%E4%BB%BB%E5%8A%A1%24i%24%E5%85%88%E5%88%B0%EF%BC%8C%E8%AE%B0%E4%BD%9C%24t_i%20%5Clt%20t_j%24%EF%BC%8C%E5%88%99%24t_i%20%2B%20D_i%20%5Clt%20t_j%20%2B%20D_j%24%EF%BC%8C%E6%89%80%E4%BB%A5%24i%24%E7%9A%84absolute%20deadline%E8%BE%83%E5%B0%8F%EF%BC%8C%24i%24%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E8%BE%83%E9%AB%98%EF%BC%8C%E4%B8%94%24i%24%E5%85%88%E6%89%A7%E8%A1%8C%EF%BC%8C%24j%24%E6%B2%A1%E6%9C%89%E6%9C%BA%E4%BC%9A%E6%8A%A2%E5%8D%A0%24i%24%EF%BC%8C%E6%89%80%E4%BB%A5%24%5Cpi(i)%20%5Cgt%20%5Cpi(j)%24%0A%3E%202.%20%E8%8B%A5%E4%BB%BB%E5%8A%A1%24j%24%E5%85%88%E5%88%B0%EF%BC%8C%E5%88%99%E8%80%83%E8%99%91%E5%9C%A8SRP%E4%B8%AD%EF%BC%8Cpreemption%E5%8F%AA%E5%8F%91%E7%94%9F%E5%9C%A8%E4%BB%BB%E5%8A%A1%E5%BC%80%E5%A7%8B%E6%97%B6%EF%BC%8C%E6%89%80%E4%BB%A5%24j%24%E5%85%88%E5%88%B0%EF%BC%8C%24j%24%E6%B2%A1%E6%9C%89%E5%BF%85%E8%A6%81preempt%EF%BC%8C%E6%89%80%E4%BB%A5%24%5Cpi(i)%20%5Cgt%20%5Cpi(j)%24%0A%0A%23%23%23%23%20%E5%85%B6%E4%BB%96%E5%AE%9A%E4%B9%89%0A%0A-%20priority%EF%BC%9A%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E5%8F%AF%E8%83%BD%E4%BC%9A%E5%8A%A8%E6%80%81%E8%B0%83%E6%95%B4%EF%BC%8C%E4%BE%8B%E5%A6%82%E5%9C%A8%E4%B8%80%E4%BA%9B%E5%8A%A8%E6%80%81%E4%BC%98%E5%85%88%E7%BA%A7%E8%B0%83%E5%BA%A6%E7%AE%97%E6%B3%95%E4%B8%AD%EF%BC%8C%E4%BE%8B%E5%A6%82EDF%0A-%20preemption%20level%EF%BC%9A%E7%9B%B8%E5%AF%B9%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8Cpreemption%20level%E6%98%AF%E9%9D%99%E6%80%81%E7%9A%84%EF%BC%8C%E6%96%B9%E4%BE%BF%E5%9C%A8%E5%8A%A8%E6%80%81%E4%BC%98%E5%85%88%E7%BA%A7%E7%AE%97%E6%B3%95%E4%B8%AD%EF%BC%8C%E9%A2%84%E6%B5%8B%E8%B5%84%E6%BA%90%E7%AB%9E%E4%BA%89%E3%80%82%E9%80%9A%E5%B8%B8%E5%8F%96%E4%BB%BB%E5%8A%A1%E7%9A%84%E5%88%9D%E5%A7%8B%E4%BC%98%E5%85%88%E7%BA%A7%E3%80%82%0A%0A-%20ceiling%EF%BC%9ASRP%E7%9A%84ceiling%E5%AE%9A%E4%B9%89%E4%B8%8EPCP%E4%B8%8D%E4%B8%80%E6%A0%B7%E3%80%82%0A%0A%3E%20%24%24%5Clceil%20R%20%5Crceil%20_%7B%5Cnu_R%7D%20%3D%20max(%5C%7B0%5C%7D%20%5Cbigcup%20%5C%7B%5Cpi(J)%20%5Cmid%20%5Cnu_R%20%5Clt%20%5Cmu_R(J)%5C%7D%20)%24%24%0A%3E%0A%3E%20%E5%85%B6%E4%B8%AD%EF%BC%9A%0A%3E%0A%3E%20-%20%24%5Cmu_R%24%3A%20maximum%20number%20of%20units%20of%20R%20that%20job%20%24J%24%20may%20need%20to%20hold%20at%20any%20one%20time.%20%20%0A%3E%20-%20%24%5Cnu_R%24%3A%20the%20number%20of%20units%20of%20R%20that%20are%20currently%20available%20%20%0A%0A-%20current%20ceiling%3A%20%24%5Coverline%20%5Cpi%20%3D%20max%5C%7B%20%5Clceil%20R_i%20%5Crceil%20_%7B%5Cnu_R%7D%20%5Cmid%20i%20%3D1%2C%20%5Cdots%2C%20m%5C%7D%24%0A%0A%0A%23%23%23%20%E7%AE%97%E6%B3%95%0A%0A%E5%9B%A0%E4%B8%BApreemption%20level%E6%98%AF%E9%9D%99%E6%80%81%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E5%AF%B9ceiling%E7%9A%84%E8%AE%A1%E7%AE%97%E4%B9%9F%E6%98%AF%E9%9D%99%E6%80%81%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AF%E4%BB%A5%E9%A2%84%E5%85%88%E8%AE%A1%E7%AE%97%E5%B9%B6%E5%86%99%E5%85%A5%E4%B8%80%E5%BC%A0%E8%A1%A8%E6%A0%BC%E3%80%82%0A%0A%3E%20%E5%BC%95%E7%94%A8%E5%8E%9F%E8%AE%BA%E6%96%87%5B2%5D%E4%B8%AD%E7%9A%84%E4%BE%8B%E5%AD%90%0A%3E%0A%3E%20%E5%81%87%E5%A6%82%24J_1%24%2C%20%24J_2%24%2C%20%24J_3%24%E5%9C%A8%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E4%B8%AD%E7%94%B3%E8%AF%B7%E8%B5%84%E6%BA%90%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%3E%0A%3E%20!%5Bcb4dcb668edd5aa63274fdc3e43d866b.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5860)%0A%3E%0A%3E%20%E7%9B%B4%E8%A7%82%E4%B8%80%E7%82%B9%E7%9A%84%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E5%9B%BE%EF%BC%9A%0A%3E%0A%3E%20!%5Bbdf4e3f81cf26a5446b44c5bd8f879b6.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5861)%0A%3E%0A%3E%20%E5%8F%AF%E4%BB%A5%E8%AE%A1%E7%AE%97%E5%87%BA%24%5Clceil%20R%20%5Crceil_%7B%5Cnu_R%7D%24%E8%A1%A8%E6%A0%BC%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%3E%0A%3E%20!%5B544e35157b7538159438725e5ec1e4ec.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp5862)%0A%3E%0A%3E%20%E4%BB%A5%24%5Clceil%20R_2%20%5Crceil%20_0%24%E4%B8%BA%E4%BE%8B%EF%BC%9A%0A%3E%0A%3E%20-%20%24%5Cnu_R%20%3D%200%24%0A%3E%20-%20%24%5Clceil%20R_2%20%5Crceil%20_0%20%3D%20max(%5C%7B0%5C%7D%20%5Cbigcup%20%5C%7B%5Cpi(J)%20%5Cmid%200%20%5Clt%20%5Cmu_R(J)%5C%7D%20)%24%0A%3E%20-%20%E8%8B%A5%24%5Cpi(I_i)%20%3D%20p(J_i)%20%3D%20i%24%20%2C%20%E5%88%99%E6%BB%A1%E8%B6%B3%E4%B8%8A%E5%BC%8F%E7%9A%84%E6%9C%80%E5%A4%A7%E7%9A%84%24%5Cpi(J)%20%3D%202%24%EF%BC%8C%E5%A6%82%E8%A1%A8%E6%89%80%E7%A4%BA%E3%80%82%0A%0A-%20%E5%BD%93%E4%BB%BB%E5%8A%A1%24J%24%20ready%E6%97%B6%EF%BC%8C%E8%AE%A1%E7%AE%97%E6%AD%A4%E6%97%B6%E7%9A%84preemption%20level%E6%98%AF%E5%90%A6%E6%BB%A1%E8%B6%B3%EF%BC%9A%24%5Cpi(J)%20%5Cgt%20%5Coverline%20%5Cpi%24%EF%BC%8C%E4%B8%8D%E6%BB%A1%E8%B6%B3%E5%88%99%E9%98%BB%E5%A1%9E%E3%80%82%0A%0A%23%23%23%20%E4%BC%98%E7%82%B9%0A%0A1.%20No%20job%20can%20be%20blocked%20after%20it%20starts.%20%E6%B2%A1%E6%9C%89block%EF%BC%8C%E6%89%80%E4%BB%A5%E6%B2%A1%E6%9C%89%E9%A2%9D%E5%A4%96%E7%9A%84context%20switch%E3%80%82context%20switch%E5%8F%AA%E4%BC%9A%E5%8F%91%E7%94%9F%E5%9C%A8start%20execution%E5%92%8Cpreemption%E3%80%82%0A2.%20There%20can%20be%20n%20o%20transitive%20blocking%20or%20deadlock.%0A3.%20If%20the%20oldest%20highest-priority%20job%20is%20blocked%2C%20it%20will%20become%20unblocked%20no%20later%20than%20the%20first%20instant%20that%20the%20currently%20executing%20job%20is%20not%20holding%20any%20non-preemptable%20resources%20%0A%0A%23%23%23%20%E4%B8%8EPCP%E7%9A%84%E5%BC%82%E5%90%8C%0A%0A-%20SRP%E4%B8%8EPCP%E7%9B%B8%E5%90%8C%E7%9A%84%E6%98%AF%EF%BC%8C%E4%B8%BA%E4%BA%86%E5%81%9A%E7%BB%9F%E7%AD%B9%E6%9D%A5%E5%BE%97%E5%88%B0%E5%85%A8%E5%B1%80%E6%9C%80%E4%BC%98%E8%A7%A3%EF%BC%8C%E4%BA%8C%E8%80%85%E9%83%BD%E9%9C%80%E8%A6%81%E5%9C%A8%E7%B3%BB%E7%BB%9F%E5%88%9D%E5%A7%8B%E5%8C%96%E6%97%B6%E5%86%B3%E5%AE%9A%E6%AF%8F%E4%B8%AA%E8%B5%84%E6%BA%90%E7%9A%84ceiling%E3%80%82%0A%0A-%20%E4%B8%8D%E5%90%8C%E7%9A%84%E6%98%AF%EF%BC%8C%E4%B8%A4%E8%80%85%E8%AF%84%E4%BC%B0%E7%BA%BF%E7%A8%8B%E9%87%8D%E8%A6%81%E7%A8%8B%E5%BA%A6%E7%9A%84%E6%8C%87%E6%A0%87%E4%B8%8D%E5%90%8C%E3%80%82PCP%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8CSRP%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF%E6%8A%BD%E8%B1%A1%E7%9A%84preemption%20level%E3%80%82%E8%BF%99%E5%AF%BC%E8%87%B4%E4%B8%A4%E8%80%85%E7%9A%84ceiling%E6%8C%87%E6%A0%87%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95%E4%B9%9F%E4%B8%8D%E5%A4%AA%E4%B8%80%E6%A0%B7%E3%80%82%E8%80%8C%E4%B8%94SRP%E5%9B%A0%E4%B8%BA%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF%E6%8A%BD%E8%B1%A1%E7%9A%84preemption%20level%EF%BC%8C%E8%BF%99%E5%9C%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E8%B0%83%E5%BA%A6%E7%AD%96%E7%95%A5%E4%B8%8B%E7%9A%84%E5%90%AB%E4%B9%89%E4%B9%9F%E4%B8%8D%E4%B8%80%E6%A0%B7%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E8%83%BD%E5%9C%A8%E5%90%8C%E4%B8%80%E7%A7%8D%E8%B0%83%E5%BA%A6%E7%AD%96%E7%95%A5%E4%B8%8B%E5%8F%82%E4%B8%8E%E7%BB%9F%E7%AD%B9%E8%AE%A1%E7%AE%97%E3%80%82%0A%0A-%20SRP%E5%AF%B9%E8%B5%84%E6%BA%90ceiling%E7%9A%84%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95%EF%BC%8C%E8%80%83%E8%99%91%E4%BA%86%E5%A4%9A%E8%B5%84%E6%BA%90%EF%BC%8C%E8%80%8CPCP%E5%8F%AA%E8%83%BD%E4%BD%BF%E7%94%A8%E5%9C%A8%E4%BA%8C%E4%B9%89%E9%94%81%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E3%80%82%0A%0A-%20%E5%9B%A0%E4%B8%BASRP%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF%E6%8A%BD%E8%B1%A1%E7%9A%84preemption%20level%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AF%E4%BB%A5%E5%BE%88%E5%A5%BD%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%9C%A8%E7%B1%BBEDF%E8%B0%83%E5%BA%A6%E7%AD%96%E7%95%A5%E4%B8%8B%E3%80%82%E8%80%8CPCP%E5%A6%82%E6%9E%9C%E8%A6%81%E5%B7%A5%E4%BD%9C%E5%9C%A8EDF%E4%B8%8B%EF%BC%8C%E5%88%99%E6%AF%94%E8%BE%83%E5%9B%B0%E9%9A%BE%E3%80%82%E5%9B%A0%E4%B8%BAEDF%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E7%94%B1%E4%BB%BB%E5%8A%A1%E7%9A%84%E7%BB%9D%E5%AF%B9Deadline%E6%9D%A5%E5%86%B3%E5%AE%9A%EF%BC%8C%E8%BF%99%E4%B8%8E%E4%BB%BB%E5%8A%A1%E8%BE%BE%E5%88%B0%E7%9A%84%E6%97%B6%E5%88%BB%E7%82%B9%E6%9C%89%E5%85%B3%E7%B3%BB%EF%BC%8C%E5%A6%82%E6%9E%9C%E8%A6%81%E5%81%9APCP%EF%BC%8C%E5%B0%B1%E8%A6%81%E7%9F%A5%E9%81%93%E7%BA%BF%E7%A8%8B%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E5%88%99%E8%A6%81%E7%BB%B4%E6%8A%A4%E4%BB%BB%E5%8A%A1%E5%88%B0%E8%BE%BE%E7%82%B9%E4%BF%A1%E6%81%AF%EF%BC%8C%E5%B9%B6%E8%AE%A1%E7%AE%97%E4%BC%98%E5%85%88%E7%BA%A7%E3%80%82%0A-%20SRP%E5%9B%A0%E4%B8%BA%E4%BB%96%E7%AE%97%E6%B3%95%E7%9A%84%E4%BC%98%E5%8A%BF%EF%BC%8C%E8%BF%98%E5%B8%A6%E6%9D%A5%E4%BA%86%E4%B8%80%E4%BA%9B%E5%85%B6%E4%BB%96%E7%9A%84%E4%BC%98%E7%82%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%0A%20%20-%20%E7%BA%BF%E7%A8%8B%E4%B8%80%E6%97%A6%E5%BC%80%E5%A7%8B%EF%BC%8C%E5%B0%B1%E4%B8%8D%E4%BC%9A%E5%9B%A0%E4%B8%BA%E8%B5%84%E6%BA%90%E8%80%8C%E8%A2%ABblock%EF%BC%8C%E8%BF%99%E4%BD%BF%E5%BE%97%E4%B8%8A%E4%B8%8B%E6%96%87%E5%88%87%E6%8D%A2%E6%AC%A1%E6%95%B0%E5%8F%AF%E4%BB%A5%E5%87%8F%E5%B0%91%E5%88%B0%E6%9C%80%E5%B0%91%E3%80%82%0A%20%20-%20%E7%9B%B8%E6%AF%94PCP%EF%BC%8CSRP%E6%9B%B4%E6%98%93%E4%BA%8E%E5%AE%9E%E7%8E%B0%E3%80%82%0A%0A%23%23%20%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%0A%0A%5B1%5D%20Bhuvan%20Middha%2C%20Matthew%20Simpson%20and%20Rajeev%20Barua%2C%20%22MTSS%3A%20Multi%20Task%20Stack%20Sharing%20for%20Embedded%20Systems%20%22%2C%20Department%20of%20Electrical%20%26%20Computer%20Engineering%20University%20of%20Maryland%20College%20Park%0A%0A%5B2%5D%20T.P.%20Baker%2C%20%22A%20Stack-Based%20Resource%20Allocation%20Policy%20for%20Realtime%20Processes%20%22%2C%20In%20Proceedings%20of%20the%20Real-Time%20Systems%20Symposium%2C%20pages%20191%E2%80%93200%2C%201990%20%0A%0A%5B3%5D%20Lui%20Sha%3B%20Ragunathan%20Rajkumar%20%26%20John%20P.%20Lehoczky%20(September%201990).%20%22Priority%20Inheritance%20Protocols%3A%20An%20Approach%20to%20Real-Time%20Synchronization%22.%20IEEE%20Transactions%20on%20Computers.%0A%0A%5C%5B4%5D%20The%202011%20book%20*Hard%20Real-Time%20Computing%20Systems%3A%20Predictable%20Scheduling%20Algorithms%20and%20Applications*%20by%20Giorgio%20C.%20Buttazzo%20featured%20a%20dedicated%20section%20to%20reviewing%20SRP%20from%20Baker%201991%20work.%0A%0A%5C%5B5%5D%20%5B%22Resource%20Access%20Protocols%22%20slides%20from%20UPPSALA%20UNIVERSITET%5D(%20%3Chttp%3A%2F%2Fuser.it.uu.se%2F~yi%2Fcourses%2Frts%2Fdvp-rts-08%2Fnotes%2Fsynchronization-resource-sharing.pdf%3E)%0A%0A%5C%5B6%5D%20%5BPriority%20ceiling%20protocol%20on%20wiki%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPriority_ceiling_protocol)%0A%0A%0A%0A%0A%0A%0A%0A