How does hyperthreading differ from actual physical cores?

How does hyperthreading differ from actual physical cores? I understand they are "virtual cores" but what really is the difference in a virtual and real core?

Also, people say only the I7 CPUs hyperthread, but on Intel's website it shows that mani I5 CPUs have 4 cores and 8 threads, so wouldn't those also be hyperthreading?
 
Solution


With Hyperthreading, only the parts of a CPU core needed to maintain the architectural state, like the CPU Registers, are duplicated. The parts that handle execution, such as ALUs, are not. As a result, while you double the amount of CPU cores exposed to the OS, you still only have one group of execution units per...

kaleem104

Distinguished
Oct 12, 2014
69
1
18,665
Hyper threading allows 1 core to 2 threads. So 1 core CPU with hyper threading can run 2, 2 core can run 4 and so on.
Hyper threading essentially allows your CPU to act as if it has double the number of core it physically has.
 


I know all that already, but how does a virtual core differ from a physical? Why not just have a single core CPU that can turn into 4 virtual cores rather than having a quad-core CPU?
 
Hey,

Think of your mouth as a CPU and jelly beans as data.

When you eat the jelly beans and chew them (processing) you periodically have a point in time when you aren't chewing because you are getting more jelly beans.

So we take a 2nd hand to get jelly beans from a second bag and chew on those while we wait for the jelly beans from the first bag.

Summary:
Hyperthreading is slightly modifying an existing CPU core so that we can run a separate thread of code at the "same time" though in fact it would toggle between the two threads.

So it is the same physical core, only slightly modified so that it isn't left waiting. It works out to a much as a 30% improvement at times for well threaded programs like Handbrake though overall savings might be closer to 15% for various reasons meaning the CPU can't run both threads on all cores 100% of the time.

Having FOUR CORES means we can have 4X the processing power so converting a video is 4X faster (assuming we can use all four cores). Adding hyperthreading just means using those four cores up to 100% of the time to provide more processing power even still.

Other:
i7's aren't the only hyperthreaded CPU's. There are i3, i5 and i7 models.
 
Update:
Naming is really confusing for Intel CPU's. Drop down about 75% of the way to see the i5-3570K example->
http://www.digitaltrends.com/computing/processor-product-names-decoded/

For example, the top-end Mac Mini now is an i7 but it's a dual-core with HT whereas it used to be a quad-core with no HT I believe (and there was more processing power on the older model). The only way to be certain is to google the model name so you get to Intel's site.

I think a lot of people who see "i7" automatically assume it's a quad-core. That's for a desktop only so be warned. The Turbo frequency, quad number, and ability to use HT can really change how much a CPU can process.

If you see "2C 4T" then it means "two cores, four threads" or in other words two PHYSICAL cores with hyperthreading ability.
 

Mohit_1024

Reputable
May 12, 2015
2
0
4,510

Till I have searched on Internet and experimented on my Pentium processor. I have found that single 64-bit core with hyper threading can execute two of 32-bit threads. Now, my doubt is that I want to confirm my 75% sure answer. Because my 25% really matters to me.
 


With Hyperthreading, only the parts of a CPU core needed to maintain the architectural state, like the CPU Registers, are duplicated. The parts that handle execution, such as ALUs, are not. As a result, while you double the amount of CPU cores exposed to the OS, you still only have one group of execution units per two cores. As a result, Hyperthreading is far less efficient then adding a full core, since if two threads need access to the same execution resource at the same time, one of them must wait for the other to finish. Both cores are EXACTLY the same in hardware; they just share the same execution resources between them.

From a software perspective, the OS sees how many register contexts a CPU contains. So a i7 with Hyperthreading is seen as being an eight core CPU by the OS. Cores 0/1, 2/3, 4/5, and 6/7 are the cores that share execution resources. Again: all these cores are equivalent in hardware, but if both paired cores are assigned work at the same time, there is the potential for a loss of performance due to the shared execution resources between them. Due to this, most OS's treat the even numbered cores as "physical" cores, and the odd numbered cores as "logical" cores, as a way to try and avoid scheduling threads on cores with shared execution resources; eg: the Odd numbered cores are assigned work last.

So to answer the OPs question: "Physical" and "Logical" cores don't exist in hardware. Those terms are just used as ways to describe the layout of HTT (or other forms of SMT) in software to try and avoid the performance loss that occurs if two cores that share execution resources both have to do work at the same time.
 
Solution