From owner-freebsd-arch@FreeBSD.ORG Fri Nov 11 14:04:39 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 80C2716A41F; Fri, 11 Nov 2005 14:04:39 +0000 (GMT) (envelope-from bms@spc.org) Received: from arginine.spc.org (arginine.spc.org [83.167.185.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 107D443D45; Fri, 11 Nov 2005 14:04:38 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id C672A6541D; Fri, 11 Nov 2005 14:04:34 +0000 (GMT) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10042-01-2; Fri, 11 Nov 2005 14:04:34 +0000 (GMT) Received: from empiric.dek.spc.org (unknown [62.53.14.79]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id A7D746538E; Fri, 11 Nov 2005 14:04:33 +0000 (GMT) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 6525A6B39; Fri, 11 Nov 2005 14:04:24 +0000 (GMT) Date: Fri, 11 Nov 2005 14:04:24 +0000 From: Bruce M Simpson To: Maxim Konovalov , Xin LI , delphij@freebsd.org, freebsd-arch@freebsd.org Message-ID: <20051111140424.GB733@empiric.icir.org> References: <20051110172650.Q48388@mp2.macomnet.net> <20051110204849.GC775@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051110204849.GC775@funkthat.com> Cc: Subject: Re: [PATCH FOR REVIEW] kqueue'ify inetd(8) and several other cleanups X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2005 14:04:39 -0000 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