tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Data layout + false sharing



How do people avoid false sharing on multicore/smp systems? Well, basically 
you should try and keep data private to each thread, but what to do when you 
have structures/arrays with shared data?

Say you have a structure that has some shared data, which is frequently 
updated by multiple threads. What good methods are there to layout your data 
in such a way that avoids false sharing?

Do you simply add some padding, taking into account CPU cache line size? There 
are many different CPUs with different cache sizes and different set 
associative ways of mapping memory locations to cache lines.

Is there some sort generic, common sense way of data layout, that works across 
most processor architectures?


Home | Main Index | Thread Index | Old Index