For faster navigation, this Iframe is preloading the Wikiwand page for
优先级倒置.
优先级倒置,又称优先级反转、优先级逆转、优先级翻转,是一种不希望发生的任务调度状态。在该种状态下,一个高优先级任务间接被一个低优先级任务所抢先(preempted),使得两个任务的相对优先级被倒置。
这往往出现在一个高优先级任务等待访问一个被低优先级任务正在使用的临界资源,从而阻塞了高优先级任务;同时,该低优先级任务被一个次高优先级的任务所抢先,从而无法及时地释放该临界资源。这种情况下,该次高优先级任务获得执行权。
在多数个案,发生优先级倒置并不导致直接伤害──高优先级任务的延迟执行不被察觉,最终,低优先级任务释放共享资源。虽然,亦存在很多情况优先级倒置会导致严重问题
在操作系统中,一般情况下,
- 进程分优先级,高优先级进程需要执行时可打断现正在执行的低优先级进程;
- 普通的临界资源使用方法,如果一个临界资源被获取了,则其它想要获取此资源的程序被阻塞,直到此资源被释放;
- 有三个进程(其优先级从高到低分别为T1、T2、T3),有一个临界资源CS(T1与T3会用到)。这时,T3先执行,获取了临界资源CS。然后T2打断T3。接着T1打断T2,但由于CS已被T3获取,因此T1被阻塞,这样T2获得时间片。直到T2执行完毕后,T3接着执行,其释放CS后,T1才能获取CS并执行。这时,我们看T1与T2,虽然T1优先级比T2高,但实际上T2优先于T1执行。这称之为优先级逆转。
"Introduction to Priority Inversion" by Michael Barr(页面存档备份,存于互联网档案馆)
{{bottomLinkPreText}}
{{bottomLinkText}}
This page is based on a Wikipedia article written by
contributors (read/edit).
Text is available under the
CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.
{{current.index+1}} of {{items.length}}
Thanks for reporting this video!
This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:
An extension you use may be preventing Wikiwand articles from loading properly.
If you're using HTTPS Everywhere or you're unable to access any article on Wikiwand, please consider switching to HTTPS (https://www.wikiwand.com).
An extension you use may be preventing Wikiwand articles from loading properly.
If you are using an Ad-Blocker, it might have mistakenly blocked our content.
You will need to temporarily disable your Ad-blocker to view this page.
✕
This article was just edited, click to reload
Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}
Follow Us
Don't forget to rate us
Oh no, there's been an error
Please help us solve this error by emailing us at
support@wikiwand.com
Let us know what you've done that caused this error, what browser you're using, and whether you have any special extensions/add-ons installed.
Thank you!