-2

我们都知道 JVM 在基于单个 CPU 的机器上调度用户线程。为什么单个 CP 不能并行运行多个进程/线程,什么是约束阻止了该功能

Also JVM is like a another software which is running in any machine,There may be thousands of other programs may waiting for the CPU cycle at a given time between this how JVM threads get the schedules from the CPU What is the parameter which gives the speed/possibility of the allocation of cycles for any process in any machine.

4

2 回答 2

2

这不是一个真正的 Java 问题,而是一个 cpu 架构问题。

并且一些 CPU 确实每个内核并行运行多个线程。看看 Intel 和 Hyperthreading .. 一台 8 线程的 4 核机器,与您的建议相反。

于 2010-09-16T02:25:09.963 回答
1

传统的单核处理器一次只能处理一条指令,这意味着它们在任何一个时间点都只能在单个线程中工作。

多线程支持是通过在 cpu 上给线程“转”综合实现的,这样它们看起来是同时运行的。

多核处理器可以在任何一个时间点为每个 CPU 处理一条指令。

这个问题更多地与 CPU 硬件设计有关,而不是编程,尤其不是单一语言,即 java,因为限制是全面的。

于 2010-09-16T02:29:14.943 回答