Welcome, Guest. Please login or register.

Author Topic: Kickstart 1.x - 3.x and Exec Priority Inversion  (Read 1732 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show all replies
    • http://www.krishnasoft.com
Re: Kickstart 1.x - 3.x and Exec Priority Inversion
« on: September 19, 2008, 10:33:47 AM »
>by Trev on 2008/9/17 21:09:35
>
>(Retyping this because my session timed out the last time. !@#%)

I have had that happen a few times to me as well.

>In a nutshell, if a high priority task is waiting on a semaphore held by a low priority task, the high priority task is effectively running at the priority of the low priority task. If a medium priority task comes along before the low priority task releases the semaphore, you end up with a serious case of priority inversion.

If the semaphore involves something critical which you are allowing a lower priority task to do then there's nothing wrong with that.  You could enforce some rule that the semaphore has to be released by a lower priority task within a certain time frame-- but that would involve the highest priority task handling all semaphores through inheritance and/or some sort of timer interrupt.

>Can a simple wrapper be used to implement priority inheritance?

I guess if you try a timer sort of set-up so after a while it undoes whatever the lower priority task did (so as to avoid disaster) and gives the semaphore capability over to the next priority task.  I am assuming timers itself won't be allowed to be disabled by lower priority tasks in the call to Forbid() like if it does a Move.w #$7FFF,$DFF09A.

--------
Use PC peripherals with your amiga: http://www.mpdos.com