FreeRTOS and priority inversion

Hi, are ressource semaphors with priority inheritance planned to be realized to avoid priority inversion of tasks? Thanks in advance. Regards Thomas

FreeRTOS and priority inversion

Hi again, This is a subject that causes a lot of debate! Including a priority inversion mechanism is straight forward.  I think there may be an example knocking about somewhere.  Basically the semaphore requires an extra member that contains the priority of the task that currently holds the semaphore, as follows: + TaskA is priority 1, TaskB priority 2. + TaskA taskes the semaphore, its priority is stored in the semaphore. + TaskB attempts to get the semaphore.  It has a higher priority, so the priority of TaskA is raised to that of TaskB. + TaskA releases the semaphore, and as it does so has its priority reset back to that stored in the semaphore. So you may say, if that is all there is to it, why not implement it, which is where people normally start to disagree with me ;-) IMHO FreeRTOS.org is designed to work with small embedded systems.  As such priority inversion should be taken into account at the application design level.  In other words, don’t design your application so that priority inversion can occur in the first place.  Even with the inversion mechanism in place a higher priority task can be delayed by a lower priority task, albeit for less time than if the inversion prevention mechanism was not in place. If you were designing a large system where resource management across multiple developers was a trickier problem, then a safeguard within the RTOS itself would be more appropriate.  As it is I prefer not to introduce the extra RAM and runtime overhead. This could be introduced as a compile time option.  The original intent was to limit the number of compile time options within the code to aid readability, but this seems to be going out the window somewhat anyway. Flame away! Regards.

FreeRTOS and priority inversion

I agree that it is helpful to keep source code simpler for the purpose of troubleshooting, special modification, and code maintenance. Because I make simple and well integrated solutions on small systems, I prefer to specifically design each application so it does not risk priority inversion. In the long run, I think doing it conciously helps streamline my small systems.