FreeRTOS-Kernel icon indicating copy to clipboard operation
FreeRTOS-Kernel copied to clipboard

[Feature Request] Enhhanced mutex priority inheritance algorithm

Open rhajdaj opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. See this thread for a good, detailed explanation of the desired enhancement (esp, the initial entry by mastupristi): https://forums.freertos.org/t/priority-inheritance-proposal/11175 See attached image.

Describe the solution you'd like An enhanced version of the priority inversion algorithm that disinherits the promoted task when the mutex that caused the inheritance is given back (as opposed to the last mutex held by the task is given back).

Describe alternatives you've considered

  1. A mutex semaphore, in which case the developer must be sure that no other mutexes are taken while the outer mutex is held. This takes additional effort (esp with third party software) by developers who want to be "lazy" with regard to mutex use.
  2. A binary semaphore, which is subject to priority inversion. We're currently using option 2, but would prefer to use a mutex to protect against priority inversion.

Additional context For Xilinx users, this issue is particularly problematic because many Xilinx drivers use "busy waits" for I/O out of the box. Because of this, if a task that calls "busy CPU" driver functions is disinherited later than it could be, this will mean 100% starvation for all tasks below or equal to the inherited priority until the loop finishes, which can be a long time for large I/O operations. priority_inheritance

rhajdaj avatar Feb 11 '21 16:02 rhajdaj