What is priority inversion?

前端 未结 11 2078
北恋
北恋 2020-12-22 15:05

I\'ve heard the phrase \'priority inversion\' in reference to development of operating systems.

What exactly is priority inversion?

What is the problem it\'s

11条回答
  •  余生分开走
    2020-12-22 15:44

    Priority inversion occurs as such: Given processes H, M and L where the names stand for high, medium and low priorities, only H and L share a common resource.

    Say, L acquires the resource first and starts running. Since H also needs that resource, it enters the waiting queue. M doesn't share the resource and can start to run, hence it does. When L is interrupted by any means, M takes the running state since it has higher priority and it is running on the instant that interrupt happens. Although H has higher priority than M, since it is on the waiting queue, it cannot acquire the resource, implying a lower priority than even M. After M finishes, L will again take over CPU causing H to wait the whole time.

提交回复
热议问题