硬件线程还是软线程? [英] Hardware thread vs soft threads?

查看:86
本文介绍了硬件线程还是软线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读到,在多核处理器中,每个内核包含2个硬件线程,例如在双核处理器中,有4个硬件线程正在运行.现在,如果我在Java中创建2个线程,这些线程是否将与2个硬件线程映射,或者那2个Java线程是由特定内核的单个硬件线程执行的?

I have read that in a multi core processor each core contains 2 hardware threads for example in dual core processor 4 hardware threads are running. Now if i create 2 threads in java are those threads going to map with 2 hardware threads or those 2 java threads are executed by single hardware thread of a particular core ?

推荐答案

这取决于很多事情,但是,每个内核所指的2个硬件线程是Intel HyperThreading技术.这项技术使CPU可以在内存中具有两个线程上下文,并且可以同时执行,从而共享执行资源.

That is dependent on a lot of things, however the 2 hardware threads per core you are referring to is the Intel HyperThreading technology. This technology enables the CPU to have two Thread Context's in memory and be executing simultaneously, sharing execution resources.

运行哪些线程取决于OS的实现方式,并且大部分由OS的Thread Scheduler算法解决.

What threads run where is OS implemention dependent and mostly resolved by the Thread Scheduler algorithm of your OS.

这篇关于硬件线程还是软线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆