Priority reversal + solution

Source: Internet
Author: User

1. priority inversion)
Because multi-process resources are shared, the process with the highest priority is blocked by the low-priority process. Instead, the process with the medium priority is executed before the high-priority process, leading to system crash. This is the so-called priority inversion ).

2. Cause
In fact, priority inversion is blocked when a high-priority task (assumed as a) accesses resources occupied by a low-priority task (assumed as C. at this time, when there are tasks with a higher priority than (c) that occupy resources, and tasks with a lower priority than (B) of the blocked task (, A task that occupies a resource is suspended (the occupied resource is still occupied). Because the priority of a task that occupies the resource is very low, it may be suspended by another task all the time. the resources it occupies cannot be released, which causes task a to be unable to execute. tasks with lower priority can be executed.

Therefore, a solution is to increase the priority of a resource-consuming task, so that it can be executed normally, and then release the resource so that task a can obtain the resource and execute it normally.

3. solution (Priority Inheritance/priority ceiling)

Currently, there are many ways to reverse the priority. There are two commonly used methods: Priority Inheritance and priority ceilings ).

. priority Inheritance
Priority Inheritance increases the priority of a low-priority task to the highest-priority task waiting for its resources. when a high-priority task is blocked due to waiting for resources, the priority of the resource owner is automatically increased.
B. priority ceiling (Priority ceilings)
the priority ceiling refers to raising the priority of a task applying for a resource to the highest priority of all tasks that may access the resource. (this priority is called the priority ceiling of the resource.)
Differences between A and B:
Priority Inheritance, only when a task with a low priority of a resource is blocked will the priority of the task with a higher priority be raised, and the priority ceiling is increased whether or not the task is blocked.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.