当前位置:网站首页>priority inversion problem

priority inversion problem

2022-06-13 05:01:00 Snow * sleet * snow

Priority reversal
Suppose there is a task at present A,B,C The priorities are 1,2,3( Note that the lower the priority number , The higher the priority ). In this case, if the task with high priority A、B Is pending , Lowest priority task C Running and getting mutex by M Enter the critical zone for treatment . later A、B The task is ready ,A The task has the highest priority, so you get the permission to run , So as to seize C Mission ,A The task operation also needs to obtain the mutex M, At this time, the mutex is found M Has been tasked with C occupy . therefore A The task is suspended in the mutex M On , Can only wait for C Task releases mutex M To run . And then because of B The task is ready , And the priority is higher than the task C, So the mission B Get run , until B After operation , To make the task C Get run ,C Run to release the mutex M after A To run . Thus, the task with the highest priority A Instead, there are no lower priority tasks B Priority is given to the operation , This phenomenon is called priority reversal .

 Insert picture description here

原网站

版权声明
本文为[Snow * sleet * snow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280516196530.html