Subject: Re: kern/14721: It's possible to crash the system by opening a large number of files
To: David Laight <>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 11/25/2001 15:59:01
In message <00f601c175ec$15d38580$0100a8c0@snowdrop>,
"David Laight" writes:

>How does netbsd handle large numbers of fd per process?
>SVR4 used a linked list of blocks of (about) 20 fds.  Unfortunately
>this makes looking up an fd O(n) in the fd number - making poll() O(n^2)
>and getting a large number of connections into a single process listener
>O(n^3).  And yes - I have seen this being the limiting factor! (poll on
>over 1000 fds)

1000 fds? no worries. I once used NetBSD/i386 and a 550Mhz PIII to run
an app with 6000 to 8000 open sockets, all in a single process, all
going over a single (10Mbit to 100Mbit) uplink, all serviced out of a
single select() loop.

With a little bit of hysteresis smarts, that setup happily saturated a
10Mbit pipe with 6% total CPU load; the 100Mbit pipe used considerably
more CPU.