ChibiOS/RT Architecture - Reference Manual - Guides |
Three threads are involved in the classic priority inversion scenario, a medium priority thread tries to starve an high priority thread by blocking a low priority thread into a mutex lock zone.
The test expects the threads to reach their goal in increasing priority order by rearranging their priorities in order to avoid the priority inversion trap.
This weird looking diagram should explain what happens in the test case:
Time ----> 0 10 20 30 40 50 60 70 80 90 100 0 ......AL++++++++++............2+++++++++++AU0---------------++++++G... 1 ..................++++++++++++------------------++++++++++++G......... 2 .............................AL..........++++++AUG................... ^ ^ Legend: 0..2 - Priority levels +++ - Running --- - Ready ... - Waiting or Terminated xL - Lock operation on mutex 'x' xUn - Unlock operation on mutex 'x' with priority returning to level 'n' G - Goal ^ - Priority transition (boost or return).