I find myself searching for this Linux kernel mailing list thread about once a year, when I need to reason through what, exactly, sched_yield is supposed to mean, and currently accomplishes. The root problem seems to be some people want it to mean "I am not doing useful work, please schedule someone else and deprioritize me", yet others want it to mean "I am voluntarily allowing others to be scheduled now so that I can get more slices in the future".
The conclusion I've gathered is that do not use it in a busy-wait loop, as it has the opposite effect of what you would want there. Perhaps an even more important conclusion is that sched_yield is confusing, there is significant disagreement over what it should mean, so don't use it.
The conclusion I've gathered is that do not use it in a busy-wait loop, as it has the opposite effect of what you would want there. Perhaps an even more important conclusion is that sched_yield is confusing, there is significant disagreement over what it should mean, so don't use it.