Re: Microsecond sleeps with select()

Поиск
Список
Период
Сортировка
Искать
От
Bruce Momjian
Тема
Re: Microsecond sleeps with select()
Дата
Msg-id
200102171808.NAA24405@candle.pha.pa.us
Ответ на
Список
Дерево обсуждения
Re: Microsecond sleeps with select() Lamar Owen <lamar.owen@wgcr.org>
> Bruce Momjian  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, Pennsylvania 19026

В списке pgsql-hackers по дате отправления
От: Bruce Momjian
Дата:
Сообщение: WAL and commit_delay
От: Bruce Momjian
Дата:
FAQ