From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Microsecond sleeps with select() |
Date: | 2001-02-17 18:30:31 |
Message-ID: | 4290.982434631@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-02-17 18:36:00 | Re: Microsecond sleeps with select() |
Previous Message | Bruce Momjian | 2001-02-17 18:14:59 | Re: Re: beta5 ... |