From owner-freebsd-arch Tue Nov 2 15:21:49 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id C0FF5152F4 for ; Tue, 2 Nov 1999 15:21:39 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id AAA28340 for ; Wed, 3 Nov 1999 00:21:31 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id AAA83003 for freebsd-arch@freebsd.org; Wed, 3 Nov 1999 00:21:31 +0100 (MET) Received: from ns.mt.sri.com (ns.mt.sri.com [206.127.79.91]) by hub.freebsd.org (Postfix) with ESMTP id AC5EA152F4 for ; Tue, 2 Nov 1999 15:20:01 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.9.3/8.9.3) with SMTP id QAA04024; Tue, 2 Nov 1999 16:19:59 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id QAA26200; Tue, 2 Nov 1999 16:19:58 -0700 Date: Tue, 2 Nov 1999 16:19:58 -0700 Message-Id: <199911022319.QAA26200@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Julian Elischer Cc: freebsd-arch@freebsd.org Subject: Re: Threads models and FreeBSD. (Next Step) In-Reply-To: <19991102173736.9E34E1FCD@io.yi.org> References: <19991102173736.9E34E1FCD@io.yi.org> X-Mailer: VM 6.34 under 19.16 "Lille" XEmacs Lucid Reply-To: nate@mt.sri.com (Nate Williams) Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [ Jumping in headlong into this thing, after reading the 'Scheduler Activations paper. I may be a bit confused, so feel free to correct me, but I have a potential issue with the implementation described in the paper. ] First, some background. One of the big reasons that FreeBSD is chosen over other platforms is it's ability to handle heavy loads well. It's both robust *AND* makes very good use of available hardware. The types of loads that FreeBSD excels usually involve lots of I/O (WWW servers, disk farms for video, network servers, etc...). Being able to effeciently pump out *LOTS* of bandwidth in an extremely effecient manner is one of FreeBSD's strengths. We get close-to-hardware speeds for networking performance, file system performance, and the like, and that's one of our big selling points. IMO, any threading solution we implement must maintain this advantage. However, I'm not sure using 'scheduler activation' would allow us to do that well. In particular, the threading model proposed assumes that Activation Upcalls to userland will be minimized. However, in the multi-threaded applications I'm aware, the design tends to have *many* threads, where each thread is responsible for one/more I/O channels (files, sockets, clients, etc...) One of the biggest advantages of kernel threads (vs. userland threads) is that regardless of the type of I/O, a kernel thread can 'block' waiting for data and/or waiting for data to be written while allowing other 'threads' of execution to continue. Therefore, you'd want to have lots of 'kernel threads' active at any one time if you had lots of channels for I/O to occur. (Note, select/poll don't always work, and are not a good 'map' into threading models, IMO. Feel free to point out why I'm out to lunch, as I'd love to have a discussion on this.). So, assuming we're not using select/poll, there are potentially a *LOT* of kernel threads blocked in the kernel. In the SA model, once a 'thread' was blocked in the kernel, an SA (which is in effect the kernel thread) would be passed back via an upcall to the userland scheduler to allow it to continue working on other threads, so the process is allowed to continue using the rest of its quantum. Given that there are N userland threads 'blocked' in the kernel, and M active 'SA' (kernel threads), everytime one of the userland threads 'unblocks' due to I/O coming in or completing, there is potentially a *LOT* of upcall traffic, especially in applications that manage lots of I/O channels (WWW servers, ftp servers, etc..). It would seem to me that the SA model is a poor match for this kind of application, which tends to be the kind of application that FreeBSD is best suited for. What am I missing? Is it just a fact that there is no good threading solution for this kind of application? Solaris seems to do a pretty good job of optimizing this case, although it may be that we have nothing better to compare it to simply because no one has implemented a robust enough implementation on any other OS/hardware platform? Comments appreciated!! Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message