本文介绍了什么是CPU线程,它与代码中的逻辑线程有何关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文献中已经看到一些较新的CPU,例如英特尔至强"Nehalem-EX" 具有8个内核和16个线程.他们在说什么呢?我在参考资料中也提到了这一点,所以SPARCS也一定是代码产生的逻辑线程吗?这个超线程重命名了吗?

I have been seeing in the literature for some of the newer CPU's such as the Intel Xeon "Nehalem-EX" as having 8 cores and 16 threads. What are they talking about here? I saw mention of this in reference so SPARCS too, surely this isn't the kind of logical threads spawned by code ? Is this hyperthreading re-named?

推荐答案

是的, Nehalem-基于的处理器实现超线程.

您所指的新Nehalem-EX具有8个物理核心,其中每个核心可视为2个逻辑核心,总共16个逻辑核心,从而允许在单个处理器上执行16个应用程序线程.

The new Nehalem-EX which you refer to has 8 physical cores where each core can be seen as 2 logical cores for a total of 16 logical cores, allowing for the execution of 16 application threads on a single processor.

这与启用超线程的Pentium 4处理器以及最近在Atom处理器中使用的技术相同.我的Eee PC有一个具有两个逻辑核心的单核Atom处理器-Windows任务管理器将显示两个CPU图形;每个逻辑核心一个.

This is the same technology used in the Hyper-threading-enabled Pentium 4 processors, and more recently, on the Atom processors. My Eee PC has a single-core Atom processor which has two logical cores -- the Windows Task Manager will show two CPU graphs; one for each logical core.

Sun的 UltraSPARC T2 (和T1)也允许同时多线程(Intel的实现称为超线程-Intel的商标),它允许一个核心显示为多个逻辑核心,以在单个核心上执行多个线程.

Sun's UltraSPARC T2 (and the T1) also allow for simultaneous multithreading (of which Intel's implementation is called Hyper-Threading -- an trademark of Intel) which allows a single core to appear as multiple logical cores to execute multiple threads on a single core.

同时多线程背后的粗略想法是要有多个寄存器来存储处理器状态,因此似乎一个内核中实际上有多个内核,因为它具有多个完整的硬件寄存器集.

The rough idea behind simultaneous multithreading is to have multiple registers to store the processor state, so it appears that there actually are multiple cores in a single core, because it has multiple full-sets of hardware registers.

虽然诸如ALU和FPU之类的物理设施可能不会增加,但是拥有更多的寄存器集来在物理内核上运行更多线程可能会导致对可用处理器资源的更好利用.执行单个线程时,内核可能尚未饱和,但是执行多个线程可能会使所有单元饱和,从而发挥最大潜力.

While the physical facilities such as the ALU and FPU may not increase, having more sets of registers to run more threads on a physical core can lead to better utilization of the available processor resources. The core may have not been saturated when executing a single thread, but executing multiple could saturate all the units to its fullest potential.

那对程序员意味着什么?

So what does it mean for programmers?

这意味着我们仍然需要编写多线程软件-具有仅具有单个线程的程序将只能使用单个逻辑核心.只有拥有编写良好的多线程代码,我们才能利用这些处理器提供的大量逻辑核心.

It means that we still will need to write multi-threaded software -- having a program that only has a single thread will only be able to utilize a single logical core. Only by having well-written multi-threaded code are we able to take advantage of the massive number of logical cores these processors offer.

即使同时进行多线程处理,也可以在每个逻辑内核的一个线程中执行代码.

Even with simultaneous multithreading, the code is executed at one thread per logical core.

这篇关于什么是CPU线程,它与代码中的逻辑线程有何关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 05:23