Menu

#403 POSIX: Create mutexes with priority inheritance

3.0.0.0
closed
2343 (1)
2024-02-05
2022-11-23
No

For the POSIX OS vos implementation, the proposal is to use the protocol PTHREAD_PRIO_INHERIT during the creation of the mutexes.

When a thread is blocking higher priority threads because of owning one or more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it shall execute at the higher of its priority or the priority of the highest priority thread waiting on any of the mutexes owned by this thread and initialized with this protocol.

This would ensure that the higher priority task is kept in the blocked state for the shortest time possible, and in doing so minimize the 'priority inversion' that has already occurred.

If needed, this could also be kept as a compilation-flag controlled option, so that it comes into effect only if the integrator explicitly enables this flag.

Discussion

  • Chirag Khangani

    Chirag Khangani - 2022-11-25
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -3,3 +3,5 @@
     When a thread is blocking higher priority threads because of owning one or more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it shall execute at the higher of its priority or the priority of the highest priority thread waiting on any of the mutexes owned by this thread and initialized with this protocol.
    
     This would ensure that the higher priority task is kept in the blocked state for the shortest time possible, and in doing so minimize the 'priority inversion' that has already occurred.
    +
    +If needed, this could also be kept as a compilation-flag controlled option, so that it comes into effect only if the integrator explicitly enables this flag.
    
     
  • Armin-Hagen Weiss

    • status: open --> accepted
    • assigned_to: Chirag Khangani
     
  • Armin-Hagen Weiss

    Hi Chirag,
    please to the requested change in the source code. A new compiler flag is not necessary.

    Best regards
    Armin

     
  • Chirag Khangani

    Chirag Khangani - 2023-01-03

    Code updated in commit r2343

     
  • Armin-Hagen Weiss

    • labels: --> 2343
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB