I have a CPU with four cores, but the specification shows it to have four cores and eight threads. How is that possible? Can I actually run eight threads in parallel?
-
http://en.wikipedia.org/wiki/Hyper-threading or ... the specs for your CPU. – Brian Roach Feb 13 '12 at 20:14
-
3I'm always surprise to see people down-voting a question, without telling why. I know that question is kind simple, and can be answered by a simple googling, but still. – Nettogrof Feb 13 '12 at 20:26
-
1@Nettogrof: Totally agree. The question is clear and on point, and not anybody is born perfect. What a shame... – emboss Feb 13 '12 at 20:39
-
@Nettogrof - for *exactly* that reason. Hover your mouse over the downvote arrow. Reason #1: *research effort*. If this was a *specific* technical question about hyper-threading it would be appropriate for SO. – Brian Roach Feb 13 '12 at 20:40
5 Answers
Depending on the CPU type, each core can have two virtual CPUs (or threads as you put it). The effect is achieved using Hyperthreading.

- 242,243
- 40
- 408
- 536
I guess that you have a hyperthreaded machine with two processors per core.
Yes it can run 8 threads concurrently.

- 2,053
- 1
- 15
- 28
This one can deceive you. Intel's HT technology does indeed allow the operating system to schedule two threads for each physical core, due to a virtual duplication of the core's resources.
"Technically" you are able to run eight threads. Notice the quotes. The main purpose of this technology was to not let the CPU resources get wasted (e.g. if your instruction pipeline has a width of four instructions, make sure it's almost always getting instructions, since one thread can rarely achieve this).
However, if your system does not have enough resources to accommodate the computations done by your threads, you will not actually have any benefit, or worse, your performance will degrade. For example, say your CPU has only four floating-point units while all your eight threads are doing floating point calculations. In this case you cannot have parallelism. Another case is when all your threads are doing memory-intensive computations. The bus from CPU to main memory will be saturated and eight threads will definitely not be able to execute their code in parallel as you expect. For more about the pitfalls of HT check this article: http://software.intel.com/en-us/articles/performance-insights-to-intel-hyper-threading-technology/
Also, make sure you understand the various levels of threading in the system. I hate to reference myself but here goes: multithreading on dual core machine?
It's called a superscalar CPU, where the pipeline is duplicated in each core, allowing it to dispatch multiple instructions in parallel. Note that Intel calls it HyperThreading but it's essentially the same.

- 17,009
- 4
- 47
- 74