From owner-freebsd-hackers@FreeBSD.ORG Fri May 23 13:33:18 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2652137B401 for ; Fri, 23 May 2003 13:33:18 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5085A43FA3 for ; Fri, 23 May 2003 13:33:17 -0700 (PDT) (envelope-from eischen@pcnet1.pcnet.com) Received: from pcnet1.pcnet.com (localhost [127.0.0.1]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h4NKX7wQ010945; Fri, 23 May 2003 16:33:07 -0400 (EDT) Received: from localhost (eischen@localhost)h4NKX776010941; Fri, 23 May 2003 16:33:07 -0400 (EDT) Date: Fri, 23 May 2003 16:33:07 -0400 (EDT) From: Daniel Eischen To: Julian Elischer In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: Dan Nelson Subject: Re: libkse and SMP (was Re: USB bulk read & pthreads) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2003 20:33:18 -0000 On Fri, 23 May 2003, Julian Elischer wrote: > > > On Fri, 23 May 2003, Terry Lambert wrote: > > > Daniel Eischen wrote: > > > > This is handy to know; so basically, my expectation from > > reading the code around PTHREAD_SCOPE_SYSTEM was correct: > > a single CPU system with PTHREAD_SCOPE_PROCESS (the default) > > can still get itself blocked in the kernel by a single > > blocking call (as in the USB bulk read device issue). > > > No you are completely wrong.. > > Each PTHREAD_SCOPE_PROCESS gets its OWN KSE to run on. > that thread may block but other threads may run unimpeded. I'm not sure if what you meant here, but here's a (hopefully) clearer explanation. All threads that are created with PTHREAD_SCOPE_PROCESS (the default) will run in the same (initial) KSEG. The initial KSEG will have as many KSEs as CPUs by default. When a scope process thread blocks in the kernel, upcalls are made to the originating KSE and a new thread is scheduled. When scope process threads unblock in the kernel, upcalls are made to one or more of the same KSEs within the initial KSEG to notify the library that the threads can be resumed. Each scope system thread gets its own KSE/KSEG pair in which to run. -- Dan Eischen