Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When running a compute-intensive task on a server with an Intel i7 quad-core processor with Hyperthreading, is it ideal to run eight threads (for the eight virtual cores), or only four (for the four physical cores)? Each thread achieves consistent 100% utilization of a virtual core.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

8 threads would be ideal, assuming there's no significant additional overhead in result combining or anything like that. With only four threads, any execution units that couldn't be saturated by the single thread per virtual core would be wasted. With eight threads, they can be used.

Note that this only applies to the unrealistic assumption that each thread can saturate a core. Also, it might not apply if the division of the processor cache resources negatively impacted performance. Some tasks have performance that "falls off a cliff" at a certain cache size. If your cliff is between the full cache size of the physical core and half that cache size, then four threads might be better.

share|improve this answer

The doctrine I was taught when compiling was 1.5x the number of cores. This accounts for any time when a thread/process is waiting on I/O.

If your task has no chance of blocking on slower operations like I/O then there may be no need to exceed the number of cores but if it can, you will want more processes than cores.

Look at it this way: if you have four cores and three processes, you can never achieve 100% CPU. The same is true for four processes when one of them is blocking on I/O. If you have six processes with no blocking, you might be slightly less efficient as the kernel uses up some CPU time swapping the processes on and off the four cores but no core will ever be idle.

Unfortunately I have no idea about the physical/virtual aspect of your question.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.