From owner-freebsd-arch Mon Nov 20 10:10:39 2000 Delivered-To: freebsd-arch@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 6A41C37B479; Mon, 20 Nov 2000 10:10:33 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id NAA21043; Mon, 20 Nov 2000 13:10:11 -0500 (EST) Date: Mon, 20 Nov 2000 13:10:10 -0500 (EST) From: Daniel Eischen To: Scott Hess Cc: Julian Elischer , jasone@FreeBSD.ORG, arch@FreeBSD.ORG, smp@FreeBSD.ORG Subject: Re: Threads (KSE etc) comments In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 20 Nov 2000, Scott Hess wrote: > I have seen the notion of limiting KSE's to the number of CPUs mentioned a > number of times on the arch and smp lists. This is presumably done to > maximize performance of CPU-bound and network-I/O-bound programs. > > Please keep disk-I/O-bound programs in mind. The current (3.x/4.x) > pthreads implementation is horrid for programs bound by disk I/O. If you > have a single multithreaded process doing lots of disk I/Os (let's call it > MySQL), then it effectively becomes seek constrained. Converting from > single disk to a 6 disk hardware RAID only gains perhaps %20 in > throughput, even though throughput should at least double or triple. > > My informal testing under 3.x with a 6 disk striped set indicated that > maximum throughput occurred with 8 seperate processes (running 8 seperate > loads), so long as the CPU didn't become a bottleneck. With 1 disk, the > maximum was more like three processes - but it was still more than the > single process your posting would restrict things to. Presumably more > disks would want more processes, with some upper limit where more > processes don't help. You can't compare one multi-threaded process with our current threads implementation to one KSE/KSEG. With one CPU, and therefore 1 KSE within the KSEG, a thread really blocks in the kernel waiting for disk I/O. Unlike our current threads implementation, when that happens under the KSE implementation, the KSE continues to run by issuing an upcall to the threads library to schedule another thread. This can repeat itself, allowing many threads to be blocked in the kernel waiting for disk I/O, but the KSE will not block unless it runs out of resources (needed to save kernel state for threads blocked in the kernel), is preempted by a higher priority process or kernel thread, or exhausts its quantum. With 2 CPUs, you could have 2 KSEs within the KSEG. Nothing changes except that the KSEG workload is spread across 2 KSEs running on different CPUs. The quantum for the KSEG, regardless of whether there are 1 or more KSEs associated with it, remains the same (I would advocate a separate quantum in this case, but I think I'm outvoted on that front). This is all for PTHREAD_SCOPE_PROCESS threads. PTHREAD_SCOPE_SYSTEM threads will be bound to their own KSEG with one KSE. These will act more like LinuxThreads; when one of these threads block in the kernel, another one will not be executed (because there are no other threads allocated for that KSEG/KSE by the threads library). -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message