Understanding Hyper-Threading and Virtual Processors
There is a lot of confusion about what Hyper-Threading is and what it can do. I’ve developed an example that might help understand how this technology works.
The semi-truck is used to do transportation work. The vehicle consists of a tractor and trailer.
Together these represent “are like” the physical CPU and the work being done. Hyper-Threading is like an additional physical trailer but no physical tractor. The single tractor with the physical-Trailer and the physical Hyper-Trailer together represent two logical-Semi-Trucks.
Image now that your job is to transport the two loads from Houston to Dallas but you only have the one tractor. That is equivalent to one physical CPU with Hyper-Threading. The four-hour trip will take eight hours to move both loads. (ignoring dead-heading time)
Now add virtual CPU to the mix. The definition of a virtual processor is “it doesn’t exist but you can see it”.
Now we have a load but no trailer. The load is real but there isn’t a trailer. Getting this virtual trailer to Dallas requires unloading either the physical Trailer or the physical Hyper-Trailer in order to load the virtual trailer.
The overhead in the loading and unloading of the physical trailers can become expensive increasing the time to move the loads to their destination.
According to VMWare there can be up to eight virtual-Trailers for each real and each Hyper-Trailer. There are now eight virtual-Trailers ready to be moved from Houston to Dallas with the one physical tractor. It will take a long time to move the eight virtual-Trailers even ignoring any overhead. There can be benefit found in using more virtual processors than there are physical-hyper processors. The only way to make that determination is by experimenting with various loads. There’s only a minor benefit of having many virtual-Trailers in the world of physical-Semi-Trucks.
This example or metaphor breaks down because computers are driven be events that can provide an environment where hyper-threading and virtual-CPU’s can work in limited numbers. Properly managed virtual-Processors can improve throughput but the performance will never approach a linear result.