Sometimes I have to put text on a path

Tuesday, April 21, 2015

Why does Intel CPU display 8 cores instead of true 4 cores? Hyper-threading is the answer.

Hyper-Threading Technology HTT is Intel's proprietary simultaneous multithreading (SMT) implementation used to improve parallelization of computations performed on x86 microprocessors.

For each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible. The main function of hyper-threading is to increase the number of independent instructions in the pipeline; it takes advantage of superscalar architecture, in which multiple instructions operate on separate data in parallel. With HTT, one physical core appears as 2 processors to the operating system, which can use each core to schedule 2 processes at once. In addition, 2 or more processes can use the same resources: if resources for one process are not available, then another process can continue if its resources are available.
Architecturally, a processor with HTT consists of 2 logical processors per core, each of which has its own processor architectural state. Each logical processor can be individually halted, interrupted or directed to execute a specified thread, independently from the other logical processor sharing the same physical core.

Hyper-threading is a way of taking that 2nd process of task sharing away from the operating system, at least for a little bit. The reason is that the processor can task switch much faster than the operating system can tell it to. So by presenting two logical processors when there is in fact only one, the operating system has to do only half as many task switching operations, but more CPU scheduling. But the net result is supposedly a faster machine in multi-tasking operations.

The actual benefits of this vary greatly depending on the workload that you're doing. For most people, there is no harm in leaving it on or turning it off. 4 vs 8 threads is like choosing between a ferrari or a lamborghini for home users.

However, in server scenarios, it can make a large difference. For example, hypervisors can often get a large increase in speed through the use of hyperthreading, as they have very strict CPU scheduling requirements.

No comments:

Post a Comment