From owner-freebsd-hackers Sun Jul 4 9:16:46 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from hoser.devel (hoser.devel.redhat.com [207.175.42.139]) by hub.freebsd.org (Postfix) with ESMTP id BCF1314C09 for ; Sun, 4 Jul 1999 09:16:44 -0700 (PDT) (envelope-from zab@zabbo.net) Received: from localhost (zab@localhost) by hoser.devel (8.9.3/8.9.3) with ESMTP id MAA17326; Sun, 4 Jul 1999 12:15:54 -0400 X-Authentication-Warning: hoser.devel: zab owned process doing -bs Date: Sun, 4 Jul 1999 12:15:54 -0400 (EDT) From: Zach Brown X-Sender: zab@hoser To: Peter Wemm Cc: "Brian F. Feldman" , Jonathan Lemon , wayne@crb-web.com, hackers@FreeBSD.ORG Subject: Re: poll() vs select() In-Reply-To: <19990704040435.35CD464@overcee.netplex.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 4 Jul 1999, Peter Wemm wrote: > Now what I particular like is the event queue system that David Filo put > together for Yahoo. In a nutshell you create a queue (a fd), and then > register the descriptors you want to monitor with the queue. You then run > an accept()-like loop where the accept returns the fd number that has met > the conditions you asked for. For example, if you wanted to know if fd > number 4251 becomes readable, then the accept would return 4251. This has > potential to work across multiple processes sharing a queue so that events > could get round robined or whatever. The other good part is that it > maintains the state and lists persistantly and doesn't have to keep copying > it to/from the kernel. It handles 50,000 to 100,000 connections without > too much trouble. You can still use this with select as the queue fd > becomes readable when there is an event waiting for your process. > > Is there interest in doing something like this in general? yes, its been done, and its called posix real time signal queues :) check out http://www.redhat.com/~zab/phhttpd it basically registers sigio on the fds it cares about, but the signal it registers is a real time signal ( > 32) so the kernel queues them in a fifo rather than usually delivering them. for each signal in the queue there is an attached siginfo struct that has things like which fd the event is for, which POLL_ event caused the signal, etc. phhttpd is a quick silly static web server that masks the signal and has threads spinning on sigwaitinfo() popping events off the queue. phhtpd isn't going anywhere, but it's event model is planned to go into apache's mpm architecture once dean has it solid, and I'm debating writing up a super-mega network server based around it.. If anyone's near ottawa in late july, head over to ols and we'll chat about this stuff over drinks ;) -- zach - - - - - - 007 373 5963 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message