Priority inversion

Copyright: free to reprint, indicate the link address to https://blog.csdn.net/weixin_38812277/article/details/91404147

Reference: https: //blog.csdn.net/u014089131/article/details/74011084 

1, priority inversion: Because multiple processes to share resources with the highest priority process is blocked low-priority process, but the process has the priority to the implementation of high-priority process, lead to the collapse of the system. This is called priority inversion (Priority Inversion).

 

2, cause
      in fact, priority inversion is high priority level (assumed to be A) the task to access the resource occupied a low priority task (assuming C) when blocked. And this time there are priority precedence over task (C) and lower than the resource occupancy task (a) is blocked priority task (assumed to be B), then, the task is suspended on the share of resources (resource occupied it still occupies ), possession of resources because of the low priority task, so it may have been suspended another task. and it has been the possession of resources will not be released, so that the cause has been no way to perform the task a, while lower priority than it the task but can be performed.  

 

3, solutions

Priority inheritance (priority inheritance): Priority inheritance refers to the priority of the low priority task to wait for it to elevate the priority (low priority) occupies the highest priority task of some resources as a high-priority task due to the wait. when the resource is blocked, then the owner of the resource priority will automatically be lifted.

Ceiling priority (priority ceilings)
      priority ceiling refers to the priority application for a resource to the task of lifting the priorities of all tasks may access the resource of the highest priority task. (This is called the priority of priorities for the resource ceiling)   

Priority inheritance , only when the low-priority task is blocked resources possession, possession of resources will raise the priority of the task, and the priority ceiling, regardless of whether clogged are promoted

The above two solutions are considering how to adjust the priority of the low priority of a process. In most cases, these two solutions can solve priority inversion problem.

Guess you like

Origin blog.csdn.net/weixin_38812277/article/details/91404147