1. 优先继承协议(PIP):
优先继承协议(PIP)是一种关键资源共享协议,用于在不同任务之间共享关键资源。这允许在不同的之间共享关键资源而不会发生无界的优先级反转。当任务发生优先级倒置时,优先级继承机制会提高具有关键资源的低优先级任务的优先级。它允许这个任务在不经过抢占的情况下尽早使用关键资源。它避免了无界的优先级倒置。
2. 优先上限协议(PCP):
优先天花板协议 (PCP) 是优先继承协议 (PIP) 和最高储物柜协议 (HLP) 的扩展。解决了优先继承协议的无界优先级倒置、Highest Locker Protocol 的死锁和锁链问题,同时也最大限度地减少了Highest Locker Protocol 的局限性与继承相关的倒置。它不是像优先继承协议那样贪婪的方法。在 PCP 中,尽管资源是空闲的,但任务可能会被拒绝访问。
PIP和PCP的区别:
PRIORITY INHERITANCE PROTOCOL | PRIORITY CEILING PROTOCOL |
---|---|
It is a critical resource sharing protocol used for sharing critical resources among different tasks. | It is a critical resource sharing protocol which is an extension of PIP and HLP. |
It overcomes the limitations of traditional resource sharing techniques. | It overcomes the limitations of PIP and HLP. |
It requires minimum support from the operating system. | While it requires maximum support from the operating system. |
It can not prevent the deadlock. | While it prevents tasks from going into deadlock. |
Tasks using PIP may suffer chain blocking. | While the tasks using PCP can not suffer from chain blocking. |
It is the simplest protocol among all resource sharing protocols. | While it is the complex and most efficient one among all. |
It can not minimize the inheritance-related inversions. | While it is able to minimize the inheritance-related inversions. |
It solves the problem of unbounded priority inversion. | While it solves the problem of unbounded priority inversion, deadlock and chain blocking. |
In PIP, highest priority task can not be denied access if resource is free. | While in PCP, highest priority task can be denied access although resource is free if priority value is less than CSC (Current System Ceiling). |
It is mostly used in small applications. | While it is used in large applications. |