Re: AW: Re: beta5 ...

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'The Hermit Hacker'" <scrappy(at)hub(dot)org>, Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: AW: Re: beta5 ...
Date: 2001-02-19 15:08:29
Message-ID: 200102191508.KAA23550@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-02-19 15:22:57 Re: floating point representation
Previous Message Bruce Momjian 2001-02-19 14:54:45 Re: PHP 4.0.4pl1 / Beta 5