Many Intel processors nowadays have Hyperthreading to create virtual processor cores to improve performance when running several concurrent threads/processes. My Intel i5 750 does not, it only has 4 physical cores. I am currently developing some image processing software which greatly benefits from running 4 concurrent threads to use all 4 cores to the max. Would I gain any benefit from a similar processor with 4 physical cores but with Hyperthreading giving a total of 8 virtual cores? My guess is that I would not - 4 threads on 4 physical cores will be at least as good as 8 threads on 8 virtual cores. Where I may loose out is I could run 7 threads, leaving one virtual core to deal with other tasks rather than 3 threads, thus dedicating a whole physical core to these lower priority tasks.
Anyone got practical experience of this situation?
As far as I know, 1 physical core with hyper-threading to support 2 virtual cores is just as effective as 2 physical cores at the same processing cycle frequency. What’s more, there’s no benefit to concentrating ‘a whole physical core’ on some task that doesn’t support parallel processing - it’ll only be able to address one virtual core.
Now, if the downside to using hyperthreading is that the rated CPU speed of each core goes down, then it’s a judgement call whether you’ll get enough benefit out of those extra virtual cores to make that worth it.
SMT is a benefit where you have two threads running which aren’t using the same CPU resources. If your two threads are doing the same thing, then one will have to wait until the other is finished.
oversimplifying, but think of it this way. I have two threads running. The CPU has separate “units” to add and to multiply. if thread 1 is adding something, and thread 2 is multiplying something, then the CPU can schedule both threads at the same time because each uses separate logic “units.” If, however, both thread 1 and 2 are adding something, thread 2 will have to wait until thread one is done.
That isn’t true. Hyperthreading works by duplicating some resources on a processing core. This enables it to perform some operations on another thread while the first is blocked on operations (waiting on a memory access for example). 2 virtual cores are much slower than two physical cores. Hyperthreading generally gives a 5-25% performance improvement compared to a single core, depending on the workload. However, there are a few cases where enabling hyperthreading actually decreases performance, especially on older operating systems that do not understand the difference between real and virtual cores.
Going back to the OP and the image processing example, it should be possible to write it so that it gains a significant performance benefit from a hyperthreading. Here are a set of benchmarks comparing an i5-750 with an i7-860. Most of the difference between them is due to hyperthreading. The Photoshop test shows about a 12% difference. If your algorithm parallises well across 4 threads it will probably work OK on 8 virtual cores. You might want to check this first, how much faster does it run on 4 threads compared to one? If it’s close to 4 times faster, hyperthreading will probably work well.
That sounds pretty good to me. Can’t be certain it will scale well beyond 4 threads from that, but I think it probably will.
Glad to be of some help.
As an aside, the i5-750 has the same die as the i7-860. It physically has the circuitry to handle hyper-threading, but has it disabled to fit into Intel’s product line.
I just remembered I had an old netbook available with a single core Atom processor but with Hyperthreading gives it 2 logical cores. To my surprise it was 40% faster using 2 threads over 1. One up for HT.