dan at ns15.lightwave.net.ru
Mon Aug 6 21:28:45 EST 2007
On Sat, 4 Aug 2007, Damien Miller wrote:
> We also prefer to use the queue macros instead of hand-rolled
> linked list implementations, though I'm not sure that a linked list is
> the right data structure (remember you need to support by-id lookups
> too), whether you need to change the data structure at all or whether
> traversing an array of a few dozen elements is worth optimising.
By-id lookups can be facilitated with a hash table.
> It seems you could avoid most of the channel array scans by simply
> tracking the number of channels actually used and stopping the loop
> after seeing that many open channels (this would work very well unless
> the entries were fragmented across the array). If you wanted to be
> tricky, you could add a precomputed skip step to the channels array that
> would point to the next allocated channel, allowing the loop to skip
> past unused channels.
The array of channels has undesireable effect of imposing a restriction on the
number of channels which can be simultaneously open.
Sincerely Your, Dan.
More information about the openssh-unix-dev