Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2001 09:42:31 -0600 (MDT)
From:      Nate Williams <>
Cc:        Greg Lewis <>, Ian Jenkinson <>, freebsd-java@FreeBSD.ORG
Subject:   Re: Threads in Java on a variety of platforms
Message-ID:  <>
In-Reply-To: <>
References:  <000201c1086c$433a29e0$0a64a8c0@buxtongw> <> <>

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

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.


To Unsubscribe: send mail to
with "unsubscribe freebsd-java" in the body of the message

Want to link to this message? Use this URL: <>