I've heard the terms hyper-threading and multi-threading, but what exactly is the difference between them? What kind of Intel processor uses them?
closed as off-topic by Canadian Luke REINSTATE MONICA, Ƭᴇcʜιᴇ007, Moses, random♦ Apr 16 '14 at 12:55
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question is not about computer hardware or software, within the scope defined in the help center." – Canadian Luke REINSTATE MONICA, Ƭᴇcʜιᴇ007, Moses, random
Multithreading refers to the general task of running more than one thread of execution within an operating system. Multithreading is more generically called "multiprocessing", which can include multiple system processes (a simple example on Windows would be, e.g., running Internet Explorer and Microsoft Word at the same time), or it can consist of one process that has multiple threads within it.
Multithreading (or should I say, multiprocessing) is a software concept. Practically any Turing-complete CPU can perform multithreading, even if the computer only has one CPU core and that core does not support hyperthreading. In order to support multiprocessing, the CPU will interleave execution of different threads of execution, by executing one, then another, then another, where the operating system will divide up the time available into "slices" and give a roughly equal amount of time to each thread (the time doesn't have to be equal, but that's typically how it's done unless a process requests a higher priority).
Note that, whenever there are more software threads of execution trying to execute at any given time than there are available hardware (simultaneous) threads of execution, then these software threads will be "interleaved" among the available cores. In the case of a "uniprocessor" (one CPU core with no hyperthreading), if you have more than one software thread, they will always be interleaved. If you have a 4-core CPU with hyperthreading, that's 8 "hardware threads", meaning the CPU can execute 8 simultaneous threads of execution at the same instant, so if you had 8 software threads trying to run, they could all run at once; but if you had 9 software threads, one of the hardware threads would have to interleave a pair of threads (the exact pair of threads chosen would depend on the operating system's scheduler implementation).
Hyperthreading, on the other hand, refers to a very specific hardware technology created by Intel, which allows a single processor core to interleave multiple threads of execution more efficiently. In other words, a CPU with hyperthreading is going to provide performance which is somewhat greater than a CPU which is otherwise the same but without hyperthreading, because the hyperthreaded CPU will be able to concurrently balance two (sometimes more, but hyperthreading is usually 2-way) threads of execution on a given core.
However, hyperthreading is strictly slower than having completely separate physical cores, because there are some types of operations that can disrupt the performance advantages of hyperthreading, while there are fewer operations that can cause such an event with completely separate cores.
Take the following example, where "1 core" is assumed to perform exactly the same in all examples:
Example 1: 2 cores, no hyperthreading.
Example 2: 4 cores, no hyperthreading.
Example 3: 2 cores with hyperthreading.
Example 4: 4 cores with hyperthreading.
In this case, Example 4 will always be fastest. Example 2 might sometimes be about as fast as Example 4, on workloads that are extremely poorly suited to taking advantage of hyperthreading's optimizations.
Example 3, on the other hand, might sometimes, on workloads where hyperthreading is most advantageous, be almost as fast as Example 2, even though it has half as many physical cores.
Example 1 of course, will be slowest of all the examples, but it might sometimes be about as fast as Example 3, when running a workload poorly suited to hyperthreading.
In real world benchmarks with modern Intel CPUs, we typically find that hyperthreading results in, speakly very generally, 20% to 40% improvement in performance compared to no hyperthreading (with the "no hyperthreading" case being benchmarked by disabling the hyperthreading feature in the BIOS). Occasionally there will be workloads where disabling hyperthreading shows a performance advantage, but these workloads can be rare in actual usage. But, if I had a choice between 4 cores with hyperthreading or 8 cores, assuming that each core itself has the same performance, I would choose the 8 core CPU every time.
Multithreading is a term for parallel processing on the operating system level. The processor has nothing to do with multithreading.
Hyperthreading is an Intel concept that implements "simultaneous" processing of multiple threads in a single processor core. The operating system sees two processor cores, although there is only one physical core.