
> > The easy fix is to just set the delay to zero.  Looks like that will fix
> > most of the problem.
> 
> Except that Vadim had a reason for setting it to 5, and I'm loath to see
> that changed unless someone actaully understands the ramifications other
> then increasing performance ...

Vadim originally intended 5 milliseconds, he only read the parameter wrong.
Then noticing, that the parameter is actually microseconds, he iirc decided to
leave it as is because the discussion at that time seemed to lead to the conclusion, 
that a simple yield would be optimal in lack of some sort of detection, and
the select with 5 us seemed closest to that.

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) ?

Andreas

Mon, 19 Feb 2001 10:04:43 +0100
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at>
AW: Re: beta5 ...
> 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
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 19 Feb 2001 10:08:29 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: AW: Re: beta5 ...
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at> writes:
> So, what was the case against using yield (2) ?

$ man 2 yield
No entry for yield in section 2 of the manual.

Lack of portability :-(

			regards, tom lane

Mon, 19 Feb 2001 10:29:52 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: AW: Re: beta5 ... 