Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Nov 2005 14:04:24 +0000
From:      Bruce M Simpson <bms@spc.org>
To:        Maxim Konovalov <maxim@macomnet.ru>, Xin LI <delphij@gmail.com>, delphij@freebsd.org, freebsd-arch@freebsd.org
Subject:   Re: [PATCH FOR REVIEW] kqueue'ify inetd(8) and several other cleanups
Message-ID:  <20051111140424.GB733@empiric.icir.org>
In-Reply-To: <20051110204849.GC775@funkthat.com>
References:  <a78074950511091943v5cc5c701p5b977630c84d35a8@mail.gmail.com> <20051110172650.Q48388@mp2.macomnet.net> <20051110204849.GC775@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 10, 2005 at 12:48:49PM -0800, John-Mark Gurney wrote:
> > > Here is a patchset that taught inetd(8) about kqueue, and some other
> > > cleanups that raises WARNS level from 2 to 3, etc.
> > > The kqueue part was a continuation of jmg@'s patchset.
> > Can I ask: why?
> Or to ask a different question, why continue to use select?  When I
> originally did the patch for inetd, I was VERY surprised at how little
> of the logic I had to change to make it use kqueue...

I'm ambivalent about the change. On one hand, more exposure for kqueue
considered a good thing. On the other, this means change in inetd which
causes it to deviate from common BSD -- although I think we're happy for
inetd to deviate because we already have special cases for IPSEC in there,
which is actually quite cool.

On a slightly different note, writing a BSD-only routing daemon with
kqueue is quite easy -- it readily facilitates event driven programming
and explicit co-routines.

If you can divide your program up into logical event-driven steps, whilst
preserving the state you need, kqueue makes dispatch more simple. select()
alone involves copying and maintenance of multiple fd_sets, as well as
converting the results you get back into things which make sense.

What I'd like to see from someone with free time on their hands is to look
at how kqueue might be used within XORP, which has used a select() driven
event loop for far too long: http://www.xorp.org/

Regards,
BMS



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