Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2001 09:42:31 -0600 (MDT)
From:      Nate Williams <nate@yogotech.com>
To:        past@netmode.ntua.gr
Cc:        Greg Lewis <glewis@eyesbeyond.com>, Ian Jenkinson <ian.jenkinson@blueyonder.co.uk>, freebsd-java@FreeBSD.ORG
Subject:   Re: Threads in Java on a variety of platforms
Message-ID:  <15179.8807.678021.249446@nomad.yogotech.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
[ 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15179.8807.678021.249446>