Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2001 14:38:50 +0300
From:      Panagiotis Astithas <past@netmode.ntua.gr>
To:        Greg Lewis <glewis@eyesbeyond.com>
Cc:        Ian Jenkinson <ian.jenkinson@blueyonder.co.uk>, freebsd-java@FreeBSD.ORG
Subject:   Re: Threads in Java on a variety of platforms
Message-ID:  <20010710143850.B12282@netmode.ece.ntua.gr>
In-Reply-To: <20010710004206.A80869@misty.eyesbeyond.com>; from glewis@eyesbeyond.com on Tue, Jul 10, 2001 at 12:42:06AM +0930
References:  <000201c1086c$433a29e0$0a64a8c0@buxtongw> <20010710004206.A80869@misty.eyesbeyond.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, Jul 10, 2001 at 12:42:06AM +0930, Greg Lewis wrote:
> On Mon, Jul 09, 2001 at 12:42:41PM +0100, Ian Jenkinson wrote:
> > 	I've a question about thread models employed within a Java JVM.
> > 	Can anyone kindly offer a concise discussion on the comparison of the
> > thread model employed on
> > Microsoft Windows, Linux, FreeBSD and Solaris? If it's the same model on all
> > of them, is the model the same
> > with 'green' and 'native' on the Unix platforms? 
> 
> Hmmm, not sure how concise this will be, but I'll try to give you some 
> idea :).  Green threads are essentially the same across all platforms.
> They are implemented within and managed by the JVM itself.  Native
> threads, however, rely on the underlying thread mechanism that is "native"
> to the OS.  So Linux, for example, uses its clone() based kernel
> threads which have a pthreads interface.  Solaris uses its native thread
> library.  Etc.  The FreeBSD JDK port doesn't support native threads at the 
> moment.
 
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? I see that
KSE's are taking off, but there is a long way ahead. I am thinking of something
like a straight port of the Linux JDK native threads. Have you contemplated this
in your 1.3 porting efforts, or did you stick to green threads?

> > Are these two logically the
> > same at the level of java source that I write,
> > just different deep within the JVM/how the OS implements it?
> 
> 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".

> > 	If this is covered on a URL I'll be happy to read it but the research I've
> > done so far hasn't lead me to an answer.
> 
> I would have thought the main Java site has something on this somewhere,
> but no idea where.

IIRC the java-linux mailing list had a recent thread on the subject. You might
want to check the archives for more.

-past

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20010710143850.B12282>