From owner-freebsd-current@FreeBSD.ORG Sun Oct 29 16:21:31 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0336916A407; Sun, 29 Oct 2006 16:21:31 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5840B43D4C; Sun, 29 Oct 2006 16:21:29 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k9TGLGif030928; Sun, 29 Oct 2006 09:21:21 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4544D4FC.4070201@samsco.org> Date: Sun, 29 Oct 2006 09:21:16 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060910 SeaMonkey/1.0.5 MIME-Version: 1.0 To: Robert Watson References: <917908193.20061027102647@serebryakov.spb.ru> <20061027103924.F79313@fledge.watson.org> <45426071.7020403@elischer.org> <602423478.20061028001449@serebryakov.spb.ru> <4542896D.1050001@elischer.org> <20061027231642.GJ30707@riyal.ugcs.caltech.edu> <45429703.8070305@elischer.org> <20061028104741.Q69980@fledge.watson.org> <45442A35.2030803@elischer.org> <20061029090309.T27107@fledge.watson.org> In-Reply-To: <20061029090309.T27107@fledge.watson.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: Paul Allen , Lev Serebryakov , Julian Elischer , current@freebsd.org Subject: Re: KSE, libpthread & libthr: almost newbie question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Oct 2006 16:21:31 -0000 Robert Watson wrote: > > On Sat, 28 Oct 2006, Julian Elischer wrote: > >> Robert Watson wrote: >>> >>> On Fri, 27 Oct 2006, Julian Elischer wrote: >>> >>>> there is class of problems (e.g. some java programs) that have >>>> THOUSANDS of threads, each representing an active aspect of some >>>> object. How do you put an rlimit on that without either 1/ stopping >>>> the program from working or 2/ allowing thousands of threads to >>>> exist but not screwing other users. >>> >>> Does the JVM actually expose thousands of threads to the OS, or does >>> it actually do its own M:N threading internally based on its >>> execution model? My impression is the latter, exposing threads to the >>> OS only when it needs them to consume kernel or CPU resources. >> >> I don't know the answer to that question, only that there is a class >> of program style that uses this model. > > FYI, last night following comments about the change away "green > threads", I ran some simple tests with the 1.4.2 JVM. It appears that, > at least in my simple test cases, all threads created in the JVM are > exposed to the OS. Typically this appears to be about n+8 to n+9 > threads, where n is the number of threads created by the application > itself, and 8/9 is the number created by the JVM. I assume the variance > of one is likely the garbage collector kicking in every now and then (or > something along those lines). > This is correct. The JVM maps all threads directly into the native threading mechanism provided by the OS. 'Green threads' have been defunct since Java 1.3, and no other magic happens behind the scenes. Scott