Re: AW: Re: beta5 ... - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: AW: Re: beta5 ...
Date
Msg-id 200102191508.KAA23550@candle.pha.pa.us
Whole thread Raw
In response to AW: Re: beta5 ...  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
List pgsql-hackers
> 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,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PHP 4.0.4pl1 / Beta 5
Next
From: Bruce Momjian
Date:
Subject: Re: floating point representation