Multithreading implementation for different platforms

David Holmes David.Holmes at oracle.com
Tue Apr 13 05:53:55 PDT 2010


Hi Tim,

Tim Steffens said the following on 04/13/10 21:21:
> I'm not quite sure if this is the right list for my question, but to me
> it seemed the most suitable.
> 
> How do you find out if a particular JVM for a particular operation
> system will handle Java Threads (especially: is each Java thread mapped
> to a system thread; is it assured, that all CPU cores will be used for
> computation [given there are enough threads])?

Are you asking what threading model Hotspot uses on different operating 
systems? The answer is that we use a 1:1 native threading model on all 
systems, so the JVM will use as many cores as it needs from the cores 
made available to it.

Is this documented somewhere? It sure should be! But I haven't been able 
to find it in the JDK docs :( It is mentioned in the Hotspot Runtime 
overview:

http://openjdk.java.net/groups/hotspot/docs/RuntimeOverview.html

If you want to know for JVM's in general, it depends on each VM and the 
Java platform they are supporting. General purpose JVMs will typically 
use 1:1 native threading to allow scalability on multi-processor/core 
systems. But some VMs for more constrained devices will use a M:1 or M:N 
threading model where Java threads are multiplexed across one or more 
native threads. (In the very old days of the JDK this was known as the 
"green threads" model.)

HTH

David Holmes
Senior Java Technologist
Java SE VM Real-Time and Embedded Group




More information about the hotspot-dev mailing list