Re: Microsecond sleeps with select()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Microsecond sleeps with select()
Дата
Msg-id 4290.982434631@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Microsecond sleeps with select()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Microsecond sleeps with select()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Having read the select(2) man page more closely, I now realize that
>> it is *defined* not to yield the processor when the requested delay
>> is zero: it just checks the file ready status and returns immediately.

> Actually, a kernel call is something.  On kernel call return, process
> priorities are checked and the CPU may be yielded to a higher-priority
> backend that perhaps just had its I/O completed.

So *if* some I/O just completed, the call *might* do what we need,
which is yield the CPU.  Otherwise we're just wasting cycles, and
will continue to waste them until we do a select with a nonzero
delay.  I propose we cut out the spinning and just do a nonzero delay
immediately.

> I think the 0 and 10000 are correct.  They would be zero ticks and one
> tick.  You think 5000 and 10000 would be better?  I can see that.

No, I am not suggesting that, because there is no difference between
5000 and 10000.

All of this stuff probably ought to be replaced with a less-bogus
mechanism (POSIX semaphores maybe?), but not in late beta.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Re: beta5 ...
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Microsecond sleeps with select()