Priority inheritance when OS_USE is called

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Priority inheritance when OS_USE is called

    Hi,
    We understand form the user manual, the OS has the following behaviour when we call
    OS_Use()
    Quote" Case C: The resource is being used by another task.
    The execution of this task is suspended until the resource semaphore is released.
    In the meantime if the task blocked by the resource semaphore has a higher priority
    than the task blocking the semaphore, the blocking task is assigned the priority
    of the task requesting the resource semaphore. This is called priority
    inheritance. Priority inheritance can only temporarily increase the priority of a
    task, never reduce it."
    When we executed OS_Use() in Task A and inherited the priority of the higher priority task (Task B) which also calls OS_Use(), Task A we call
    OS_GetPriority()and we noticed that priority of A was not changed to higher priority but reflecting the base priority.
    best regards
    Chu-Lih


    TaskA()
    {
    OS_Use(&pRSema);
    OS_Delay(30);
    OS_GetPriority(NULL);
    while (1)
    {}
    }

    TaskA()
    {
    OS_Delay(20);
    OS_Use(&pRSema);
    while (1)
    {}
    }
  • Hello Chu-Lih,

    the priority inversion is handled with priority inheritance which means that the low priority task is activated until it releases the resource semaphore.
    The scheduler will activate the low prio task TaskA() instead of the high prio task TaskB() when it detects that the resource is being used by another task.
    But this is completely handled internally so you will not see any modified priority in the tasks.

    Best regards,
    Til