On Sat, 1 Feb 2025 15:35:53 -0800
Linus Torvalds [off-list ref] wrote:
I didn't actually check what current active schedulers do. I would
not be in the least surprised if different schedulers end up having
very different behavior (particularly any RT scheduler).
The only real use of sched yield() I have ever seen in practice was in
a RT application where all tasks were given the same RT FIFO priority,
and the application would use the yield() system call to trigger the
next task.
That's also the only use case that really does have a strict defined
behavior for yield(). In SCHED_FIFO, as the name suggests, tasks run in
a first-in first-out order. yield() will put the task at the end of
that queue. You can use this method to implement a strict application
defined scheduler.
-- Steve.