7

I recently purchased a i5-9600K. Which is supposed to run 6 cores and 6 threads (hyperthreading), when I take a look into /proc/cpuinfo the ht flag is on, and checking a tool like htoponly shows 6 cores, as you can see in the image below.

I've used other Intel and AMD processors, and usually when the product says 6 cores/6 threads the total amount is 12, but in this case I see just 6.

Am I wrong or what could be the problem?

Thank you!

enter image description here

  • 11
    In Intel speak, 6 cores and 6 threads means one thread per core, ie no hyperthreading. If it said 6 cores and 12 threads, that would mean 2 threads per core, which is hyperthreading. – trr Dec 03 '19 at 01:30
  • 4
    "usually when the product says" No. You seem to be blinded by wanting to have extra 6 threads. 6 cores / 6 threads is 1 thread per core. 6 cores / 12 threads means 2 thread per core, i.e. hyperthreading. Nowhere do they write 6 cores / 6 threads to mean hyperthreading. – Giacomo Alzetta Dec 03 '19 at 11:33
  • If you wanted one with hyperthreading, I think you wanted the i7 version. – Mast Dec 03 '19 at 14:18

3 Answers3

23

If you scroll down on your CPU’s Ark page, you’ll see that it says

Intel® Hyper-Threading Technology ‡ No

Your CPU has six cores, but it doesn’t support hyper-threading, so your htop display is correct.

The CPU specifications on Ark show the full thread count, there’s no addition or multiplication involved; see for example the Xeon E3-1245v3 for a hyper-threading-capable CPU (four cores, two threads per core, for eight threads in total).

The ht moniker given to the underlying CPUID flag is somewhat misleading: in Intel’s manual (volume 3A, section 8.6), it’s described as “Indicates when set that the physical package is capable of supporting Intel Hyper-Threading Technology and/or multiple cores”. So its presence indicates that the CPU supports hyper-threads (even if they’re disabled), or contains multiple cores in the same package, or both. To determine what is really present, you need to enumerate the CPUs in the system, using firmware-provided information, and use the information given to figure out whether there are multiple logical cores, on how many physical cores, on how many sockets, etc. Depending on the CPU, a “CPU” shown in htop (and other tools) can be a thread (on a hyper-threading system), a physical core (on a non-hyper-threading system), or even a full package (on a non-hyper-threading, single-core system).

The Linux kernel does all this detection for you, and you can see the result using for example lscpu.

At least your CPU isn’t affected by any of the hyperthreading-related vulnerabilities!

Stephen Kitt
  • 434,908
  • Then where does the 'ht' flag in /proc/cpuinfo come from? Is the cpuinfo output inaccurate? – WooShell Dec 03 '19 at 12:42
  • Phrasing of your comment: I'd say "to find out if any logical cores share the same physical core or package with other logical cores". AFAIK there isn't any sense in which one logical core is "real" and corresponds to a physical core but another logical core doesn't. They both equally share one physical core in one package. The only special core is the bootstrap processor (BSP): the core that booted first. – Peter Cordes Dec 03 '19 at 15:33
  • Logical cores basically are HW threads; those terms are synonyms. But I know what you mean anyway: that logical cores map to one of multiple SMT siblings. Other than that, yes, we're on the same page and that's a good description. – Peter Cordes Dec 03 '19 at 16:01
  • 1
    Looks good to me. Not exactly the way I'd describe it, but that's not a bad thing. – Peter Cordes Dec 03 '19 at 16:16
3

In this context, "threads" is a synonym for "logical cores", i.e. total amount of logical cores, regardless of how many physical cores implement them. Not extra threads.

Your CPU has 6 logical cores, so booting Linux on it "sees" 6 CPUs.

Your CPU has 6 physical cores, so each logical core has a whole physical core to itself, rather than having a pair of logical cores sharing a physical core with Intel's SMT, which they call Hyperthreading.

I've used other Intel and AMD processors, and usually when the product says 6 cores/6 threads the total amount is 12

[citation needed]. Terminology like 2c4t (2 physical cores, 4 logical cores) has been standard for many years, across all architectures, not just x86.

I've never seen anything described as N "real" cores + N "extra" threads because that's not how it even works. Both logical cores are "symmetric", it's not like one had to be started up specially. They each act as full CPUs. (When one is in an idle deep sleep, the other one can go into single-thread mode and get all the execution resources. When both are asleep, the physical core can actually sleep)

Fun fact: OS support for hyperthreading lets the OS tell which logical cores share a physical core by reading CPUID data, and/or APIC / LAPIC interrupt-controller stuff. An OS that wasn't aware of hyperthreading would still boot up and see however many logical cores the CPU supports (HT was enabled in the BIOS), and I think everything would just work except that it might schedule 2 tasks onto cores that compete with each other for execution resources, while leaving other physical cores idle.


Some CPUs have more than 2-way SMT. e.g. Xeon Phi has 4-way SMT (4 logical cores per physical core) as a way to hide memory and ALU latency and get good total throughput without a lot of out-of-order execution resources.

IBM POWER uses 8-way SMT on big physical cores.

Peter Cordes
  • 6,466
0

If you look at other processors e.g. i7-10710u from Intel then this shows as 6 cores and 12 threads, so it appears that your cpu only has one thread per core rather than the 2 you are expecting.

icarus
  • 17,920