Time to reconsider m:n or green threading options?

Patrick Wright pdoubleya at gmail.com
Sat Jun 21 03:18:36 PDT 2008


Looks like the original threading model in the Sun JVM was 1:n threading

http://en.wikipedia.org/wiki/Green_threads

Most of what I found on a quick Google seemed to confirm that article.
Apparently "green threads", as implemented earlier in the Sun JVMs,
had one OS thread, running the VM, which would then manage multiple
green threads. There are apparently different mechanisms for deciding
when to switch between the green threads. Big drawback appears to have
been a) blocking I/O could cause the whole VM to wait and b) there's
only 1 OS thread underneath, meaning no use of multiple processors.

Apparently, the Blackdown JVM used to allow for green or native
threading selection.

I didn't find any references to m:n threading regarding green threads,
though. I suspect the terminology will get in the way in this
discussion.

Actors, as implemented in Scala, allow many Actor instances to be
scheduled from one thread pool, which means the number of Actors can
be many many times the number of threads in use; but that is
implemented as a library. Kilim has impressive benchmarks but is using
some annotations and some complex bytecode manipulation to works its
magic. Both of these work with the current JVM architecture.

What would you want the JVM to provide that it doesn't provide currently?


Patrick



More information about the mlvm-dev mailing list