通常一个java程序运行时只有一个名为"javaw"的进程.当我运行一个进程时,我只能获得一个核心(多核)的最大资源.但是当我在jvm中运行多线程程序时,它使用的核心数量是根据超出一个进程可以执行的线程数量.那么有人能给我一些关于jvm如何处理多核cpu机器中的多线程程序的信息吗?
/**
* I run this program in my machine which has 8 core cpu
* and the jre is 1.6.0_24
* How does jvm use one process to use all the cpu resources?
*/
public class MultiCoreUseTest implements Runnable{
@Override
public void run() {
int i;
while(true)
i =1;
}
public static void main(String[] args) {
//create 8 threads
//8 threads the usage of cpu is 100%
// if 4 threads the usage of cpu is 50%
for(int i …Run Code Online (Sandbox Code Playgroud)