turkey3_scratch :
kaleem104 :
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?
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.