Re: sched_yield() makes OpenLDAP slow

From: Nick Piggin
Date: Fri Aug 19 2005 - 23:19:59 EST


Robert Hancock wrote:


I fail to see how sched_yield is going to be very helpful in this situation. Since that call can sleep from a range of time ranging from zero to a long time, it's going to give unpredictable results.


Well, not sleep technically, but yield the CPU for some undefined
amount of time.

It seems to me that this sort of thing is why we have POSIX pthread synchronization primitives.. sched_yield is basically there for a process to indicate that "what I'm doing doesn't matter much, let other stuff run". Any other use of it generally constitutes some kind of hack.


In SCHED_OTHER mode, you're right, sched_yield is basically meaningless.

In a realtime system, there is a very well defined and probably useful
behaviour.

Eg. If 2 SCHED_FIFO processes are running at the same priority, One can
call sched_yield to deterministically give the CPU to the other guy.

--
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/