-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug][kernel][ipc][mutex]只有在PRIO策略下进行优先级继承 #4771
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果改了这个,如果软件包或者客户代码里用fifo的方式做了互斥,也就退化成了信号量了,没有了防止优先级反转的特效,下次release版本需要强调这个API的改动了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
优先级反转,之前指的好像不是获取同一个资源排队的问题,指的是一个线程1在获取的资源A之后再去获取资源B,其中A是以互斥量的形式获取的。因此如果此时有更高优先级的线程2来获取A,那么此时就要提高线程1的优先级,保证它不会被低优先级的打断,可以及时释放资源A。
所以我又有了疑惑,因为我们之前的文档说明“mutex具有防止优先级反转的作用”,指的应该就是这个优先级继承的机制,和其内部的排队机制应该是无关的。但是,FIFO的排队机制本身就会导致优先级被反转……
而且revert掉之前的一个pr之后,FIFO下的优先级继承本来就是假的了,没有起到防止优先级反转的作用。所以以后,mutex只有以Pro的形式创建才具有防止优先级反转的功能。。。所以FIFO在mutex里存在的意义是什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
刚才我计算了一下,在FIFO处理所谓“优先级反转”的问题,根本无法防止优先级反转,因为防止优先级反转的先决条件就是等待列表按照PRIO排序才可以。