Andrew Haley wrote:
 > I think the long term view is to switch to POSIX threads. Having
 > used the Jikes RVM for an OS like project, relying on native
 > threads wouldn't have been desirable. In theory green thread
 > context switches should be possible in a few instructions whereas a
 > full context switch takes a few hundred. I guess its all down to
 > the situation the JVM is trying to optimise for.

Indeed.  I've been thinking about this, and it occurs to me that
threads are used to solve two entirely problems, and which threading
model is desirable depends on which problem you are trying to solve.

IMHO using POSIX threads is the only "right" answer for a multi-platform
JVM. You have no other choice except to leave it up to the specific
platform to then implement POSIX threads efficiently.

For example, on Linux where each POSIX thread is a cloned process, it's
Linux's fault (not the JVM's fault) if that doesn't scale well. For example,
other OS's don't have such heavyweight threads. FreeBSD's KSE's are an
example of a better tradeoff using M:N user:kernel threading.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

Reply via email to