2010-09-16 52 views
-2

所有mlutiple线程我们知道JVM安排在一个基于单一CPU的机器的用户线程。为什么不能单个CP运行mltiple工艺/并行线程,什么是约束停止这种能力运行在CPU

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.

+0

好吧,单核一次只能执行一条指令。 – Anycorn 2010-09-16 02:26:41

+3

@aaa鲤鱼:一次一个“指令流”会更合适。大多数现代处理器可以预先执行几条流水线指令。 – casablanca 2010-09-16 02:34:33

回答

1

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

多线程支持是通过在cpu上给予线程'转向'来合成实现的,以便它们似乎同时运行。

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

这个问题更多的是关于CPU硬件设计,而不是编程,特别是没有单一的语言,即Java作为限制是全面的。

+0

讨论CISC流水线? – Xailor 2010-09-16 15:31:44

2

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

而且一些CPU在每个内核中并行运行多个线程。看看英特尔和超线程技术......一个拥有8个线程的4核心机器,与您的建议相反。