Re: Question about sched_yield()

From: David Schwartz (
Date: Mon Jun 17 2002 - 19:46:29 EST

On Sat, 15 Jun 2002 15:15:32 -0700, wrote:
>I am seeing some strange linux scheduler behaviours,
>and I thought this'd be the best place to ask.
>I have two processes, one that loops forever and
>does nothing but calling sched_yield(), and the other
>is basically benchmarking how fast it can compute
>some long math calculation.

        You seem to have a misconception about what sched_yield is for. It is not a
replacement for blocking or a scheduling priority adjustment. It simply lets
other ready-to-run tasks be scheduled before returning to the current task.

        Here's a quote from SuS3:

"The sched_yield() function shall force the running thread to relinquish the
processor until it again becomes the head of its thread list. It takes no

        This neither says nor implies anything about CPU usage. It simply says that
the current thread will yield and be put at the end of the list.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:15 EST