written 3.6 years ago by |
Bounded priority inversion:
When a task (say T1) with lower priority is in execution and a higher priority task (say T3) pre-empts, then the execution of higher priority task begins. Now if a operation is to be done by lower priority task (i.e. T1) then the lower priority task starts its execution and the higher priority task has to wait. This is called as bounded priority inversion and the time for which the higher priority task has to wait for the lower priority task is called as priority inversion time. Figure below shows the time for which priority inversion takes place.
Unbounded priority inversion:
When a task (say T1) with lower priority is in execution and a higher priority task (say T3) pre-empts, then the execution of higher priority task begins. Now if a operation is to be done by lower priority task (i.e. T1) then the lower priority task starts its execution and the higher priority task has to wait. Now if an intermediate priority task (say T2) pre-empts the lower priority task (i.e. T1), then the highest priority task (i.e. T3) has to wait for an unbounded time. This is called as the unbounded priority inversion. Figure below shows the time for which priority inversion takes place.
Solutions to the priority inversion problem:
Priority Inheritance: In this case the lower priority task is given a higher priority for some time, so that the intermediate priority task will not pre-empt the lower priority task and hence no unbounded priority inversion. For example in the above case the task T1 will be given a priority of 4, instead of its intial priority i.e. 1. Hence the task T2 of priority 2, will not be able to pre-empt the task T1.
Priority Ceiling: In this case the lower priority task is given a highest possible (ceil) priority for some time, so that the no other task will not pre-empt the lower priority task and hence no unbounded priority inversion. For example in the above case the task T1 will be given a priority of 10 (assuming 10 is the top priority), instead of its initial priority i.e. 1. Hence the task T2 of priority 2, will not be able to pre-empt the task T1.