> At least on AIX it looks like the select with 0 timeout is a noop, and does not
> yield the processor. There was discussion, that other OS's (BSD) also does an 
> immediate return in case of 0 timeout.
> 
> Minimum select(2) delay is 1 msec on AIX (tested with Tom's test.c).
> 
> So, what was the case against using yield (2) ?

BSDi doesn't have yield().  It does have sched_yield(), but that
controls threads:

        force the current pthread to be rescheduled

so there doesn't seem to be any portable way to do this.  Sleeps of zero
do no kernel call, and sleeps > 0 sleep for a minimum of one tick.

If you really want a near-zero sleep, you need to do a no-op kernel
call, like umask(), but doing a simple kernel call usually is not enough
because kernels usually favor the last-running process because of the
CPU cache.  We need a "try to schedule someone else if they are ready to
run, if not, return right away" call.

I think ultimately, we need the type of near-committers feedback, but
not for 7.1.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Reply via email to