Highest Locker Protocol (HLP)
Highest Locker Protocol (HLP) is a critical resource sharing protocol that is an extension of Priority Inheritance Protocol which was introduced to overcome the limitations of Priority Inheritance Protocol. In this critical resource sharing protocol, every critical resource is assigned a ceiling priority value. This value is the maximum of priorities of all those tasks which may request to hold this critical resource.
Basic Concept of HLP :
The basic concept of Highest Locker Protocol is based on the ceiling priority value. When a task holds a critical resource its priority is changed to the ceiling priority value of the critical resource. If a task holds multiple critical resources, then maximum of all ceiling priorities values is assigned as priority of the task.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Working of HLP :
- Resources required by each task is found before the compile time.
- Initially a ceiling priority value is assigned to each critical resource.
- Ceiling priority value of a critical resource is calculated as the maximum of priorities of all those tasks which may request to hold this critical resource.
- When a task holds a critical resource, corresponding ceiling priority value is assigned as priority to the task.
- Task acquiring multiple critical resources is assigned maximum of all ceiling priority value.
- Further the execution is done on the basis of allotted priorities.
Features of HLP :
- When HLP is used for resource sharing, once the task holds the required critical resource then it is not blocked any further.
- Before a task can hold one resource, all the resources that may be required by this task should be free.
- It prevents tasks from going into deadlock or chain blocking.
Advantages of HLP :
Following are the advantages of Highest Locker Protocol:
- It is useful into critical resource sharing by several tasks.
- It avoids the unbounded priority inversion among tasks.
- It overcomes the limitations of priority inheritance protocol.
- It prevents from deadlock as a task hols one resource, all other required resources by this task must be free.
- A task can not go into chain blocking using Highest Locker Protocol.
Disadvantages of HLP :
The major disadvantage of Highest Locker Protocol is Inheritance related Priority Inversion.
Inheritance related Priority Inversion occurs when the priority value of low priority task acquiring a critical resource is assigned the highest priority using ceiling rule then the intermediate priority tasks that do not need the resource can not execute and undergo Inheritance related Priority Conversion.