1 NAME = "Priority inversion tests" 2 AUTHOR = "Michal Piotrowski <michal.k.k.piotrowski (a] gmail.com>" 3 TIME = "SHORT" 4 TEST_CATEGORY = "FUNCTIONAL" 5 TEST_CLASS = "KERNEL" 6 TEST_TYPE = "CLIENT" 7 DOC = """ 8 The basic premise here is to set up a deadlock scenario and confirm that PI 9 mutexes resolve the situation. Three worker threads will be created from the 10 main thread: low, medium and high priority threads that use SCHED_FIFO as 11 their scheduling policy. The low priority thread claims a mutex and then 12 starts "working". The medium priority thread starts and preempts the low 13 priority thread. Then the high priority thread runs and attempts to claim 14 the mutex owned by the low priority thread. Without priority inheritance, 15 this will deadlock the program. With priority inheritance, the low priority 16 thread receives a priority boost, finishes it's "work" and releases the mutex, 17 which allows the high priority thread to run and finish and then the medium 18 priority thread finishes. 19 20 That's the theory, anyway... 21 """ 22 23 job.run_test('pi_tests') 24