From owner-freebsd-java@FreeBSD.ORG Tue Apr 1 12:04:44 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 3E9C837B404 for ; Tue, 1 Apr 2003 12:04:44 -0800 (PST) Received: from ns.yogotech.com (ns.yogotech.com [206.127.123.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD46843F85 for ; Tue, 1 Apr 2003 12:04:42 -0800 (PST) (envelope-from nate@yogotech.com) Received: from emerger.yogotech.com (emerger.yogotech.com [206.127.123.131]) by ns.yogotech.com (8.9.3p2/8.9.3) with ESMTP id NAA09993; Tue, 1 Apr 2003 13:04:32 -0700 (MST) (envelope-from nate@yogotech.com) Received: (from nate@localhost) by emerger.yogotech.com (8.12.8/8.12.8) id h31K4V8s026999; Tue, 1 Apr 2003 13:04:31 -0700 (MST) (envelope-from nate) From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16009.61647.371831.725618@emerger.yogotech.com> Date: Tue, 1 Apr 2003 13:04:31 -0700 To: Tom Samplonius In-Reply-To: References: <002501c2f841$86e3e480$9001000a@thorsten4> X-Mailer: VM 7.07 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid cc: Thorsten Mauch cc: freebsd-java@freebsd.org Subject: Re: Is FreeBSD the right platfrom for JBOSS ? X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Nate Williams List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Apr 2003 20:04:44 -0000 > There is a perception that native OS threads are always faster than > green threads or some other internally implemented thread system. It turns out that if you're application is CPU and not I/O bound, in most cases 'green threads' or non-kernel threads will almost always faster. (I/O can read/writing logfiles, reading/writing to the console, etc..) In fact, even if you're doing network I/O, Java's internal threading library does a pretty good job of not blocking due to it's use of select/poll. However, if you have to read/write files, then the simple threading model used by FreeBSD (pthreads and/or green-threads) doesn't work well, because it ends up blocking inside the syscall. > That isn't always the case. For intstance, Weblogic built their own > JVM (JRockit) and they purposesly implemented their own thread system > that does not use OS threads at all. They claim that their JVM is > faster for hosting server apps than any other JVM. That's not suprising at all. I wrote a network client/server application in 100% Java that used thousands of threads, and it ran up to 2 orders of magnitude faster using green-threads vs. native (kernel) threads on Solaris. It was a fun problem, and optimizing the solution to work well using both threading models allowed us to find and fix a number of design problems where we made some invalid assumptions about how the thread scheduling would happened. Live-lock, dead-lock, and races are *very* common in many Java programs. The best way to avoid them is to test your app using the different threading models available. Besides, it's good practice for doing SMP work. :) :) Nate