Re: Microsecond sleeps with select() - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Microsecond sleeps with select()
Date
Msg-id 200102171808.NAA24405@candle.pha.pa.us
Whole thread Raw
In response to Re: Microsecond sleeps with select()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > A comment on microsecond delays using select().  Most Unix kernels run
> > at 100hz, meaning that they have a programmable timer that interrupts
> > the CPU every 10 milliseconds.
> 
> Right --- this probably also explains my observation that some kernels
> seem to add an extra 10msec to the requested sleep time.  Actually
> they're interpreting a one-clock-tick select() delay as "wait till
> the next clock tick, plus one tick".  The actual delay will be between
> one and two ticks depending on just when you went to sleep.
> 

The BSDI code would be pselect():
    /*     * If poll wait was tiny, this could be zero; we will     * have to round it up to avoid sleeping forever.
If    * we retry below, the timercmp above will get us out.     * Note that if wait was 0, the timercmp will prevent
* us from getting here the first time.     */    timo = hzto(&atv);    if (timo == 0)        timo = 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: WAL and commit_delay
Next
From: Bruce Momjian
Date:
Subject: Re: Microsecond sleeps with select()