48

In a conversation with the network administator, I mentioned that my machine was a dual-core. He told me it was not. I brought up the task manager, went to the perfomance tab, and showed him that there are two separate CPU usage graphs. I have a quad-core machine at home and it has four graphs. He told there were two graphs on this particular machine because of hyper-threading. I used to have a hyper-thread pentium 4 processor back in the day, but I never fully understood what it meant. So what is the difference between hyper threading and dual-core? And how do you tell which one you have?

3 Answers 3

24

Hyper-threading exposes multiple logical cores for a single physical CPU core. In simple terms, hyper-threading makes context-switching more efficient for each CPU core.

Dual-core chips, on the other hand, actually have two physical CPU cores which can execute different processes simultaneously.

There are also other multi-core chips that have many more than two cores, and--as Svish mentioned--Intel's latest multi-core offerings also support Hyper-threading on all the cores.

You can use a CPU identification utility like CPU-Z to determine how many cores you have. As you can see near the bottom of the screenshot, the CPU in this case has 2 physical cores. If the number of threads is higher than the number of cores, Hyper-threading is enabled. To-date all consumer-oriented CPUs with Hyper-threading have 2 threads per core, so if HT is enabled, the number of threads will be 2x the number of cores.

enter image description here

If you have an Intel CPU, you can download Intel's CPU ID utility instead.

6
  • And multi-core chips that supports hyper-threading so you get twice the amount of logical cores.
    – Svish
    Apr 20, 2010 at 19:40
  • Thank! How do I tell (from within the OS) which type of CPU I have? Apr 20, 2010 at 19:56
  • 3
    The UltraSparc T2+ has 8 Cores, each of which supporting 8 threads making it a 64 virtual CPUs on a single chip: en.wikipedia.org/wiki/UltraSPARC_T2
    – jlliagre
    Apr 20, 2010 at 19:59
  • The way to know the CPU you have depends on the OS you are running.
    – jlliagre
    Apr 20, 2010 at 20:00
  • @jilliagre: nice!
    – rob
    Apr 20, 2010 at 21:00
19

Hyper-threading is where your processor pretends to have 2 physical processor cores, yet only has 1 and some extra junk.

The point of hyperthreading is that many times when you are executing code in the processor, there are parts of the processor that is idle. By including an extra set of CPU registers, the processor can act like it has two cores and thus use all parts of the processor in parallel. When the 2 cores both need to use one component of the processor, then one core ends up waiting of course. This is why it can not replace dual-core and such processors.

See also: This question

8

Hyperthreading is a cheaper and slower alternative to having multiple-cores

The Intel Manual Volume 3 System Programming Guide - 325384-056US September 2015 8.7 "INTEL HYPER-THREADING TECHNOLOGY ARCHITECTURE" describes HT briefly. It contains the following diagram:

enter image description here

TODO it is slower by how much percent in average in real applications?

Hyperthreading is possible because modern single CPUs cores already execute multiple instructions at once with the instruction pipeline https://en.wikipedia.org/wiki/Instruction_pipelining

The instruction pipeline is a separation of functions inside of a single core to ensure that each part of the circuit is used at any given time: reading memory, decoding instructions, executing instructions, etc.

Hyperthreading separates functions further by using:

  • a single backend, which actually runs the instructions with its pipeline.

    Dual core has two backends, which explains the greater cost and performance.

  • two front-ends, which take two streams of instructions and order them in a way to maximize pipelining usage of the single backend by avoiding hazards.

    Dual core would also have 2 front-ends, one for each backend.

    There are edge cases where instruction reordering produces no benefit, making hyperthreading useless. But it produces a significant improvement in average.

Two hyperthreads in a single core share further cache levels (TODO how many? L1?) than two different cores, which share only L3, see:

The interface that each hyperthread exposes to the operating system is similar to that of an actual core, and both can be controlled separately. Thus cat /proc/cpuinfo shows me 4 processors, even though I only have 2 cores with 2 hyperthreads each.

Operating systems can however take advantage of knowing which hyperthreads are on the same core to run multiple threads of a given program on a single core, which might improve cache usage.

This LinusTechTips video contains a light-hearted non-technical explanation: https://www.youtube.com/watch?v=wnS50lJicXc

"Simultaneous multithreading" is a more general/less Intel-specific name for this type of technique.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .