[Date Prev][Date Next]
Re: (ITS#3950) sched_yield() considered harmful
At 07:24 PM 8/17/2005, email@example.com wrote:
>Full_Name: Bernardo Innocenti
>Version: 2.2.26 to 2.3.5, possibly others
>Submission from: (NULL) (188.8.131.52)
>Calling sched_yield() makes slapd slow down considerably
>under load since kernel 2.6.
I note that pthread_yield is not actually part of the
POSIX Thread standard. It's part of the old DCE Thread
interface, which was deprecated in favor of the POSIX
Thread standard. No modern threaded application should
be calling pthread_yield(3). sched_yield(3) should do
the right thing.
Guess we'll have to consider this yet another Linux
pthread implementation quirk. Now, the fun thing would
be to devise a configure test to determine that the
deprecated pthread_yield(3) interface should be used
(without resorting to #ifdef linux or equivalent).
Oh, BTW, sched_yield(3p) on my SuSE Linux box says:
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 arguments.