From owner-freebsd-threads@FreeBSD.ORG Sat Nov 29 22:06:54 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 91FCF16A4CE for ; Sat, 29 Nov 2003 22:06:54 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C99C43FE5 for ; Sat, 29 Nov 2003 22:06:53 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id hAU66q1G013179; Sun, 30 Nov 2003 01:06:52 -0500 (EST) Date: Sun, 30 Nov 2003 01:06:52 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: "Christopher M. Sedore" In-Reply-To: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE system scope vs non system scope threads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2003 06:06:54 -0000 On Sat, 29 Nov 2003, Christopher M. Sedore wrote: > I have a fairly simple question about KSE threads: In a threaded program > using KSE threads, what is the effective difference between a system-scope > thread and a non-system-scope thread? If I understand the KSE architecture > correctly, there should not be a significant functional difference. If my > reading lead me to the right conclusion, at the nitty-gritty level, there > are multiple KSE groups created with system-scope threads, as I understand > it, meaning that the kernel scheduler actually does the scheduling work for > system-scope threads, instead of the userland KSE scheduler. For the most part yes, but even system scope threads are sometimes dependent on the userland scheduler (when it comes to mutexes, CVs, signals, etc). > I ask this because I'm observing some behavior that I don't expect. When > running a threaded program with KSE and non-system-scope threads, I see > performance degradation in my network traffic when I'm attempting to connect > to remote hosts that are down. Libthr doesn't see this degradation, and KSE > with system-scope threads doesn't perform as well as libthr, but is much > closer. Define what you think is degradation. Process scope threads run in the same KSEG. They are all kept in the same priority-based run-queue. If you have other threads that have equal or higher priority than the network threads in question, they will/may run before those threads. All it takes is one thread that doesn't block (CPU-bound) to eat away at the time allotment for your other threads. If a remote host is down and a thread can't connect to it, that thread should block allowing other threads to run. Are you using blocking or non-blocking connects? > If there is a canonical document that describes all this, a pointer would > be very welcome. It pretty much is what POSIX states it should be, WRT process and system scope. Other than that, see: http://www.freebsd.org/kse/index.html and "Further Reading". -- Dan Eischen