What the Heck Are CPU Threads, Anyway?

CPU Threads

So-called “threads” have been a frequent source of confusion for those comparing or buying CPUs. What they are is never really explained, and most explanations that do exist only give a rough idea or mix it up with other things.

Let’s clear this up once and for all.

So, What is a Thread?

“Thread” refers to two things, but both are closely related to each other.

The most common use of the term refers to threads in software. Software threads are, as far as the CPU is concerned, a sequence of instructions that the software uses to do… whatever the software does. There’s plenty that can be discussed about them, especially since they play a direct, critical role in how different core counts affect performance in software, but that’s a topic for another day.

R9 3900XHowever, specifications like you might see on a CPU product page, or on AMD’s or Intel’s websites, refer to threads in hardware. Hardware threads are the primary source of confusion here when talking about “threads”.

Hardware threads are infrastructural in nature. Simply put, hardware threads hold important information about a software thread that is needed for the core to run that software thread. That’s it. They don’t do the actual work (that’s for the rest of the CPU core). They aren’t like “weaker” or “pseudo” cores, or anything else fancy. They just hold information. The rest of the core handles the rest (with some slight modification to avoid technical problems and maintain performance, of course).

And so, the number of hardware threads tells us how many software threads can be running on the CPU simultaneously.

But you may have also seen the terms “logical processor” or “virtual core” or something similar, potentially in the same context as a hardware thread. This is merely the operating system’s (e.g. Windows, Linux, etc.) view of hardware threads. As far as we’re concerned as users, they’re the same thing really. However, don’t get these two confused—hardware threads are things that actually, physically exist. “Logical processors” don’t physically exist. The operating system decides to have a certain software thread be run on a certain logical processor, and a corresponding hardware thread on a certain core runs that software thread. And that’s the end of it.

What’s the Deal with SMT / Hyper-Threading?

Hyper-Threaded CPU

Simplified diagram of Hyper-Threading from Wikipedia (groups of colored rectangles are analogous to software threads)

So if hardware threads don’t actually do anything on their own, why does simultaneous multi-threading (called Hyper-Threading in Intel CPUs, probably because Intel likes feeling special) have the potential to increase performance?

In short, SMT / Hyper-Threading entails running two software threads per core at the same time, which gives the core more to work with. Modern cores are strong and wide, and hardware architects are very proud of them: One solitary software thread pretty much always leaves some brawny hardware sitting around doing nothing. It’s like an employer who has too many people for the typical workload, but on occasion those extra people might actually be necessary. Two threads at once? That takes away some of the breathing room, and keeps things nice and busy.

Now, if there’s something specific in the hardware that’s already limiting performance with one thread and it’s just as bad or even gets worse with two threads, then there won’t be a benefit (and in that circumstance, SMT may actually be a detriment). But this isn’t the typical case with most software—hence why SMT is a common feature.

As an aside, you may sometimes see hardware threads added with SMT be referred to as “hyper-threads” or something else similar. To be clear, there’s no difference between hardware threads already used without SMT and those added for SMT—they’re the exact same.

Conclusion

In essence, hardware threads are an indication of how much work can be done on a CPU at once. At least technically, anyway. 8 threads from 4 cores with SMT still isn’t as useful as 8 threads on 8 cores (at least when comparing CPUs from the past handful of years), since there are far fewer hardware resources there, even if they may be running the same number of threads at a given time.

Beyond what you see in comparative benchmarks for specific uses (i.e. games), hardware threads are important insomuch as they affect your CPU’s ability to multitask. A four-core CPU with SMT will handle a background task like video encoding with less potential impact on other tasks than would a similar four-core CPU without SMT. But I digress.

CPUs can be a topic that is simultaneously confusing and simple. If you’ve any further questions, feel free to ask in the comments!