Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2008 09:42:54 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Bakul Shah <bakul@bitblocks.com>
Cc:        "JINMEI Tatuya / ?$B?@L@C#:H" <Jinmei_Tatuya@isc.org>, Thomas Vogt <freebsdlists@bsdunix.ch>, freebsd-net@freebsd.org
Subject:   Re: too many open file descriptors messages since bind 9.4.2-P1 (port dns94)
Message-ID:  <20080715234254.GZ62764@server.vk2pj.dyndns.org>
In-Reply-To: <20080715230917.DAC3B5B46@mail.bitblocks.com>
References:  <m2skuag4c2.wl%Jinmei_Tatuya@isc.org> <20080715230917.DAC3B5B46@mail.bitblocks.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--FoibaoN3dya3u5fy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2008-Jul-15 16:09:17 -0700, Bakul Shah <bakul@bitblocks.com> wrote:
>IIRC, when poll() returns n, you only look at the first n
>values in the pollfd array so it is a win when you expect a
>very small number of fds to be ready.  In the select case you
>have to test the bit array until you see the last ready fd.

No.  Both poll(2) and select(2) return the number of FDs ready for
I/O.  You need to scan the pollfd or fd_set array until you find that
many FDs ready.

poll(2) is a win if you only need to test a small number of FDs
compared to the number of FDs that the process has open.  In the case
of bind, you have a large number of FDs to test, of which you are
only expecting a very small number to be ready - if you don't
treat fd_set as opaque, select(2) allows you to quickly skip large
(roughly wordsize) chunks of un-interesting FDs.

Note that, based on sys_generic.c in 7.x and -CURRENT, poll(2) is
limited to checking FD_SETSIZE descriptors, whilst select(2) has
no upper limit.

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--FoibaoN3dya3u5fy
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkh9Nf4ACgkQ/opHv/APuIdj8QCcDoK8GqnIVYsXpwhO2Gb57jW1
0dEAnjPKIwfegANc3GRD19L3wMJfWfEp
=AhqU
-----END PGP SIGNATURE-----

--FoibaoN3dya3u5fy--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080715234254.GZ62764>