From owner-freebsd-hackers Thu Aug 17 18:56:35 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.129.65]) by hub.freebsd.org (Postfix) with ESMTP id F38BA37BF28 for ; Thu, 17 Aug 2000 18:51:44 -0700 (PDT) Received: from resnet.uoregon.edu (resnet.uoregon.edu [128.223.122.47]) by mx1.FreeBSD.org (Postfix) with ESMTP id D366B6E3E55 for ; Thu, 17 Aug 2000 16:05:02 -0700 (PDT) Received: from localhost (dwhite@localhost) by resnet.uoregon.edu (8.10.1/8.10.1) with ESMTP id e7HN3lV85034; Thu, 17 Aug 2000 16:03:47 -0700 (PDT) Date: Thu, 17 Aug 2000 16:03:47 -0700 (PDT) From: Doug White To: Kevin Mills Cc: hackers@FreeBSD.ORG Subject: RE: freebsd and non-preemtive threads In-Reply-To: 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 Thu, 17 Aug 2000, Kevin Mills wrote: > > > > This reminds me of coroutines or userland select- or kqueue-based > > "threading." Coroutines is a bit more complex but a library is > > available. > > I've seen the term 'kqueue-based threading' on this list a few times now. > Could you explain what you mean by that? I think I coined it. :) It's the technique of using kqueue to multiplex I/O. You can create highly efficient multi-connection servers by using kqueue (or select/poll) to dispatch work. It works very nicely for protocols like SMTP that have a send/response style, where you receive a command, process it, and send back the response. When you send or receive, you do the read or write nonblocking and let kqueue/select/poll tell you when it's done. The URL I quoted in my last message is a Python implementation of select-based threading. We've done a somewhat trivial port of it to kqueue and are working on a better integration module. Doug White | FreeBSD: The Power to Serve dwhite@resnet.uoregon.edu | www.FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message