From owner-freebsd-threads@FreeBSD.ORG Mon Aug 7 14:51:24 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org 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 3B4D816A4DD; Mon, 7 Aug 2006 14:51:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5488343D6E; Mon, 7 Aug 2006 14:51:23 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.0.1.106] (nat-outside.atlanta.corp.yahoo.com [63.172.193.57]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k77EpMU6035301; Mon, 7 Aug 2006 10:51:22 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: David Xu Date: Mon, 7 Aug 2006 10:33:11 -0400 User-Agent: KMail/1.9.1 References: <20060804140657.GK4498@obiwan.tataz.chchile.org> <200608041134.43979.john@baldwin.cx> <200608050806.24502.davidxu@freebsd.org> In-Reply-To: <200608050806.24502.davidxu@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608071033.12277.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [66.23.211.162]); Mon, 07 Aug 2006 10:51:22 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1639/Mon Aug 7 09:34:09 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.2 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: freebsd-threads@freebsd.org Subject: Re: system scope vs. process scope X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2006 14:51:24 -0000 On Friday 04 August 2006 20:06, David Xu wrote: > On Friday 04 August 2006 23:34, John Baldwin wrote: > > > Suppose you have a system with 2 processes. One process is single-threaded > > and is CPU bound. The other process has 2 threads both of which are also > > CPU bound. If the threads in the second process are PTHREAD_SCOPE_SYSTEM, > > then each thread will get 33% of the CPU. If the threads in the second > > process are PTHREAD_SCOPE_PROCESS, then the each process will get 50% of > > the CPU. The second process will then use its own algorithm to split it's > > 50% of the CPU up between it's two threads. If it divides it evenly, then > > each of its' threads will end up with 25% of the CPU whereas the thread for > > the first process has 50% of the CPU. The idea for this is that if you > > have a system with several single-threaded processes and one process with > > 1000 threads, you don't want that process to starve out all the other > > processes. > > > I can make my application fork 800 processes and starve out all the other > user. Yes, but then you aren't sharing the same address space, which your application might need if it wants to do threading. :) And, your statement aside, I believe the above is why the difference exists. Your statement is more about the usefulness of the distinction, not about the justification for when it was created. -- John Baldwin