From owner-freebsd-java Tue Jul 10 8:42:45 2001 Delivered-To: freebsd-java@freebsd.org Received: from ns.yogotech.com (ns.yogotech.com [206.127.123.66]) by hub.freebsd.org (Postfix) with ESMTP id 1DC7B37B401 for ; Tue, 10 Jul 2001 08:42:41 -0700 (PDT) (envelope-from nate@yogotech.com) Received: from nomad.yogotech.com (nomad.yogotech.com [206.127.123.131]) by ns.yogotech.com (8.9.3/8.9.3) with ESMTP id JAA23989; Tue, 10 Jul 2001 09:42:32 -0600 (MDT) (envelope-from nate@nomad.yogotech.com) Received: (from nate@localhost) by nomad.yogotech.com (8.8.8/8.8.8) id JAA22902; Tue, 10 Jul 2001 09:42:31 -0600 (MDT) (envelope-from nate) From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15179.8807.678021.249446@nomad.yogotech.com> Date: Tue, 10 Jul 2001 09:42:31 -0600 (MDT) To: past@netmode.ntua.gr Cc: Greg Lewis , Ian Jenkinson , freebsd-java@FreeBSD.ORG Subject: Re: Threads in Java on a variety of platforms In-Reply-To: <20010710143850.B12282@netmode.ece.ntua.gr> References: <000201c1086c$433a29e0$0a64a8c0@buxtongw> <20010710004206.A80869@misty.eyesbeyond.com> <20010710143850.B12282@netmode.ece.ntua.gr> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Reply-To: nate@yogotech.com (Nate Williams) Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org [ FreeBSD uses internal green-threads, while most other OS's use native threads ] > This is something that has been bugging me for a while: would it be > good to implement the native threads in FreeBSD under LinuxThreads or > NGPT? Except that these will never be used in the 'stock' FreeBSD kernel because of the GPL virus. Second, it's alot of work to rewrite the system for another threading model. The code (as written) is coded to run either with green threads, or with native (Posix) threads. > > Well, yes and no. With green threads you should get the same sort of > > behaviour across the board. With native threads (which is the default > > on most OSes) behaviour can be somewhat different. For example, when I > > was learning Java I wrote a program which worked fine under Windows 95 > > but thrashed the CPU on Windows NT. Why? Different underlying thread > > priority models. > > The moto IIRC is "don't rely on thread priorities for your > application's logic, if you want to be cross-platform". Thread priorities aren't the only thing effected by the change from green threads and native threads. In particular, how the threads are scheduled can show up code that deadlocks, livelocks, or other strange behavior depending on the scheduling. Also, sometimes you're design *must* rely on thread priorities. They *will* work on cross-platform is you test it on the platforms you intend to run it on. Our application ran on Win95/98/NT, FreeBSD, and Solaris green-threads/native threads great. However, it took some time to tweak it so that the code was 'portable' and ran well across all of the platforms. In the end, after all was said and done, it ran better on *all* platforms because of the effort. Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message