language agnostic - Are there any cases where priority inheritance is not desirable? -


i understand priority inheritance is. understand, mars pathfinder's system reset issue, of time, depending upon criticality of operation, enable/implement priority inheritance.

however, there cases priority inheritance not desirable , may cause problems if enabled/implemented? if so, please provide example while preferably describing problem?

op gives example priority inheritance desirable. there have short mutex-protected transaction between threads of highest , lowest priorities , long-running thread medium priority block transaction if priority inheritance not used. in example high-priority thread more important application medium-priority thread.

to priority inheritance not desirable, make application these assumptions opposite above example. let's make transaction between threads of highest , lowest priorities longer time available medium-priority thread perform task. , let's assume results of medium-priority thread more important results of high-priority thread.

imagine application should serve 100 interrupts per second high-priority thread. , 10 interrupts per second medium-priority thread (where each interrupt needs 30 ms processed). low-priority thread lock resource (used high-priority thread). , (very rarely) lock long time (1 sec). priority inheritance first access resource high-priority thread boosts priority of background thread 1 sec. medium-priority thread miss 10 interrupts. @ same time high-priority thread miss 100 interrupts. without priority inheritance medium-priority thread serves interrupts high-priority thread misses 130 interrupts. if interrupts served medium-priority thread more valuable, should prefer disable priority inheritance.

i never seen real-life application this. invented 1 illustrate case. let video capture application computer vision task in background , (as additional bonus) sound recording. video frames captured medium-priority thread. sound captured high-priority thread (because otherwise video capturing process block significant portion of sound interrupts). video captured pre-allocated buffer. audio captured silence suppression (no memory needed capture silence). audio thread needs dynamically allocated memory blocks (this our shared resource). computer vision task allocates memory blocks. when out-of-memory, garbage collector thread blocks memory allocation , work. here without priority inheritance video capture works flawlessly. priority inheritance audio thread blocks video capture (which considered bad application).


also there applications priority inheritance not give benefits:

  • when there (1) several background threads , (2) several short-living priority threads. each group of threads shares resources inside own group.
  • when 1 resource shared threads priorities 1 & 2, other 1 - threads priorities 3 & 4, etc.
  • when processor has more cores there time-critical threads in application.
  • in many other cases.

if priority inheritance enabled in such cases, performance (or power efficiency) degradation because priority inheritance implementation in kernel needs additional resources.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -