4 ms·
Here is what is going on: He's using Intel Core i7. This architecture is very similar to AMD Hypertransport in that each CPU is directly attached to a bank of
by illumin8 16y ago
Here is what is going on:
He's using Intel Core i7. This architecture is very similar to AMD Hypertransport in that each CPU is directly attached to a bank of memory, and has an on-die memory controller.
This has obvious performance benefits because smart operating system kernels can take advantage of this and locate a processes memory on the bank connected directly to the CPU the process is running on. There is a slight disadvantage though when running highly multithreaded applications: If a thread running on CPU A wants to access memory on CPU B, it takes an extra hop to get there. This increases memory latency.
What is happening is that he has a highly multithreaded application where threads are accessing memory attached to a different CPU. When he restricts the process to a single core, all memory is directly attached to the CPU and there are no extra hops, decreasing memory latency and increasing performance dramatically.
This trick only works on processes that can effectively run on only one CPU and within the memory limit of that CPU's attached RAM.
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- illumin8 16y agoI may have to revise my theory because it seems like he is running a single CPU system (quad core, hyperthreaded to look like 8 cores). Without a multiple physical CPU system the extra memory hop wouldn't exist. This could also be an issue caused by hyperthreading itself. The extra 4 cores are not real physical cores on the die. They are just an extra thread that runs on each of the existing cores. What could be happening is that there is some thread locking going on where one thread is waiting for a message or event from a thread that is executing on the virtual second core, which in turn isn't executing right at the moment because it's not a real core. An interesting test would be to have him turn off Hyperthreading in the BIOS and see if that improves performance without limiting to only 1 core. Alternatively, he could restrict the process to run on CPUs 0, 2, 4, and 6, which should run it on only the "real" cores. I always disliked Intel's hyperthreading. Don't try to fool me into thinking I have more cores than I really do. I know it speeds up some apps, but it hurts others.
- azim 16y agoIf you disliked HT in the Pentium 4, take another look at it today. The Pentium 4 had four dispatch ports and not too many execution units - a single thread was able to exploit that. The i7, in contrast, has 6 dispatch ports feeding 12 execution units. It's extremely difficult to find instruction-level parallelism within a single thread that can exploit that architecture, hence the need for HT to keep the execution units cranking. These days it's quite rare to find applications which are slowed by HT.
- ntoshev 16y agoYou seem to think a hyperthreaded system exposes to the OS 4 "real" and 4 "virtual", slower cores. This is not true, if you have 2 threads executing on a single core at the same time each gets equal attention / performance. Also, hyperthreading really does make a lot of sense on today's hardware. The gap between CPU and memory performance is wide and getting wider each year, when you have a cache miss and your core has several hundred cycles to get its data from memory, you's better have another thread that can keep it busy.
- illumin8 16y agoI get your point, but by turning off HT or only running processes on 1 of 2 threads you can ensure that only a single thread is executing on a single core at a time. Your point about cache misses is well taken. HT is good overall.