From owner-freebsd-java@FreeBSD.ORG Thu Aug 28 02:08:55 2003 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4187216A4BF for ; Thu, 28 Aug 2003 02:08:55 -0700 (PDT) Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BE5743F3F for ; Thu, 28 Aug 2003 02:08:54 -0700 (PDT) (envelope-from sheldonh@starjuice.net) Received: from sheldonh by axl.seasidesoftware.co.za with local (Exim 4.22) id 19sIlw-000MFc-Cr for freebsd-java@FreeBSD.org; Thu, 28 Aug 2003 11:08:52 +0200 Date: Thu, 28 Aug 2003 11:08:52 +0200 From: Sheldon Hearn To: freebsd-java@FreeBSD.org Message-ID: <20030828090852.GC83970@starjuice.net> Mail-Followup-To: freebsd-java@FreeBSD.org References: <20030828090512.GB83970@starjuice.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030828090512.GB83970@starjuice.net> User-Agent: Mutt/1.5.4i Sender: Sheldon Hearn Subject: Re: FreeBSD vs Windows 2000 "Advanced" Server X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2003 09:08:55 -0000 On (2003/08/28 11:05), Sheldon Hearn wrote: > The test class at the bottom of this message can fire about 1,800 [1] > threads on my FreeBSD 5.1-CURRENT box, with the native jdk-1.4.1. My > box is a PIII with 1G of RAM. Oops, make that about 8,000 threads. :-) And I forgot to include the class source. Ciao, Sheldon. public class TestThreads extends Thread { private long sleepMillis; public TestThreads(long sleepMillis) { this.sleepMillis = sleepMillis; } public void run() { try { Thread.sleep(sleepMillis); } catch (InterruptedException e) { } } public static void main(String[] args) { int threadCount = 0; long sleepMillis = 0; try { threadCount = new Integer(args[0]).intValue(); sleepMillis = new Long(args[1]).longValue(); } catch (Exception e) { usage(); } int i = 0; try { for (i = 0; i < threadCount; i++) { TestThreads test = new TestThreads(sleepMillis); test.start(); } System.out.println( "TestThreads: successfully fired " + threadCount + " threads" ); } catch (OutOfMemoryError e) { System.out.println("TestThreads: after creating " + i + " threads: " + e.getMessage()); } try { Thread.sleep(sleepMillis); System.out.println("TestThreads: waited " + sleepMillis + " milliseconds for all threads to complete"); } catch (InterruptedException e) { } } private static void usage() { System.err.println("usage: TestThreads threadCount sleepMillis"); System.exit(1); } }