On Tue, 21 Dec 1999 09:22:04 -0600 (CST), Jonathan Lemon <[EMAIL PROTECTED]> wrote:
>In article
><local.mail.freebsd-hackers/[EMAIL PROTECTED]>
> you write:
>>In my case, load is reasonably distributed. Is poll() really that much
>>better than select()? I thought that, excepting bit flag manipulations,
>>it worked basically the same way on the kernel end.
>
>Yes, it is better. Select uses the same backend as poll(), but those
>"bit flag manipulations" that you are talking about consume a measurable
>amount of CPU time when you start throwing thousands of descriptors at it.
I'm not as sure that it's that clear cut. poll(2) requires far more
copyin/copyout than select(2) (8 bytes per fd instead of 1-3 bits/fd).
And if it's the bit twiddling that you're worried about, the kernel
has to check 10 bits in each pollfd entry, rather than the 1-3 bits
for select(2). If you have a very sparse set of FD's to select on,
then poll(2) should be better. I suspect the normal server case is
closer to selecting on fds [3 .. nfds-1] - so select(2) is probably
faster.
poll(2) does have advantages over select(2):
- Separate input-only and output-only fields mean you may not need to
separately keep (or re-generate) the list of events of interest.
- A wider range of states/events can be requested/reported.
Has anyone done any timing comparisons between poll(2) and select(2)?
Peter
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message