多核和多线程 [英] Multicores and mulithreads
问题描述
如果一个软件开发了多线程,那么多核处理器是否确实通过使用操作系统的软件线程有效地执行了该软件,即当我在Java中创建多个线程时,多线程处理器通过将这些Java线程与OS的软件线程?
If a software devoloped with multi threading , Is it true that multicore processor executes that software efficiently by using software threads of operating system i.e when i create multiple threads in java those threads are exicuted simultineously by multicore processor by linking these java threads with software threads of OS ?
推荐答案
它随JVM实现和OS的不同而不同,但是在进行编码时,您应该采取防御措施,并假设多个线程将同时处于活动状态.
It varies with the JVM implementation and OS, but when coding you should take a defensive position and assume that multiple threads will be active at the same time.
在实用上,您会发现许多主要平台上都充分利用了多个内核.现在,商业JVM中有很多技巧可以进行垃圾回收,从而减少垃圾回收对多核平台的影响.
Pragmactically, you will see good use of multiple cores on many major platforms. There's quite a bit of cleverness in commerical JVMs now to do garbage collection so as to reduce the impact of that on muti-core platforms.
这篇关于多核和多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!