Hi,
does anybody know how priority inheritance in embOS (we use version 4.04) works in more complex scenarios? Example: lets say we have five tasks LOWEST/LOW/MEDIUM/HIGH/HIGHEST with lowest/low/medium/high/highest priority and lets say we have two mutexes A and B (implemented using OS_Use and OS_Unuse). Now the following happens:
* LOWEST locks mutex A
* MEDIUM interrupts LOWEST, locks mutex B and waits for mutex A
* Priority inheritance kicks in and continues task LOWEST with priority of MEDIUM (so the LOW task is not activated even if it would be ready)
* HIGHEST interrupts LOWEST before LOWEST can unlock mutex A. HIGHEST waits for mutex B.
In general, we would now need to activate MEDIUM because it has the mutex which HIGHEST is waiting for. However, MEDIUM itself is blocked because it waits for mutex A. Is now task LOWEST activated because it has medium priority at the moment (because of the priority inheritance) or would be task LOW activated (if ready)? Or does priority inheritance kick in again, so that LOWEST task has now highest priority and wouldn't be interrupted by LOW or HIGH (kind of a transitive priority inheritance from HIGHEST via MEDIUM to LOWEST)?
Another scenario:
* LOWEST locks mutex A and B
* Task MEDIUM inhterrupts LOWEST and waits for mutex B
* LOWEST is activated and runs with prio of task MEDIUM
* HIGHEST interrupts LOWEST and waits for mutex A
* LOWEST is activated
Is LOWEST now running with the prio of HIGHEST? What happens after releasing mutex A? Does task LOWEST now have its original prio again or does the mechanism start again so that LOWEST runs with MEDIUM prio (scheduler notices that MEDIUM is blocked by LOWEST and activates LOWEST with medium prio)?
The documentation only describes the most basic scenario. Some more detailed information about the implementation / about the behavior in more complex scenarios would be quite nice
Thx!
Chris
does anybody know how priority inheritance in embOS (we use version 4.04) works in more complex scenarios? Example: lets say we have five tasks LOWEST/LOW/MEDIUM/HIGH/HIGHEST with lowest/low/medium/high/highest priority and lets say we have two mutexes A and B (implemented using OS_Use and OS_Unuse). Now the following happens:
* LOWEST locks mutex A
* MEDIUM interrupts LOWEST, locks mutex B and waits for mutex A
* Priority inheritance kicks in and continues task LOWEST with priority of MEDIUM (so the LOW task is not activated even if it would be ready)
* HIGHEST interrupts LOWEST before LOWEST can unlock mutex A. HIGHEST waits for mutex B.
In general, we would now need to activate MEDIUM because it has the mutex which HIGHEST is waiting for. However, MEDIUM itself is blocked because it waits for mutex A. Is now task LOWEST activated because it has medium priority at the moment (because of the priority inheritance) or would be task LOW activated (if ready)? Or does priority inheritance kick in again, so that LOWEST task has now highest priority and wouldn't be interrupted by LOW or HIGH (kind of a transitive priority inheritance from HIGHEST via MEDIUM to LOWEST)?
Another scenario:
* LOWEST locks mutex A and B
* Task MEDIUM inhterrupts LOWEST and waits for mutex B
* LOWEST is activated and runs with prio of task MEDIUM
* HIGHEST interrupts LOWEST and waits for mutex A
* LOWEST is activated
Is LOWEST now running with the prio of HIGHEST? What happens after releasing mutex A? Does task LOWEST now have its original prio again or does the mechanism start again so that LOWEST runs with MEDIUM prio (scheduler notices that MEDIUM is blocked by LOWEST and activates LOWEST with medium prio)?
The documentation only describes the most basic scenario. Some more detailed information about the implementation / about the behavior in more complex scenarios would be quite nice
Thx!
Chris