Reputation: 13
I am running a multi-threaded program (contains large number of atomic operations) with 16 threads on a 16 core machine. When I set the affinity of the threads such that each thread runs on a unique cpu, the execution time of the program increases compared to the non-affined version of the program. Using perf I can see that when the thread-core affinity is used, the cache misses increases from 10% to 30% which is probably the reason for increase in execution time. Can you please shed some light on how using the affinity can cause more cache misses?
Upvotes: 1
Views: 312
Reputation: 22890
Can you please shed some light on how using the affinity can cause more cache misses?
Because these are CPU caches ie a set of caches of individual to each processor. For instance two thread read the same data :
Please look at What is a cache miss
Upvotes: 2