[Gllug] Programming for performance on Linux

Nix nix at esperi.org.uk
Sat May 15 22:07:23 UTC 2010


On 14 May 2010, general said:
> I don't think L1 cache is shared, L2 cache can be though depending on
> the architecture. IIRC Intel Core 2 Duos have a shared L2 cache common
> to all cores

No, they have a shared *L3* cache common to all cores. L1/L2 is private
to a single core (though of course shared between hyperthreads on one
core).

e.g. on my hyperthreaded quad-core Nehalem:

spindle:/sys/devices/system/cpu/cpu0/cache# for name in index*; do echo $(cat $name/type):L$(cat $name/level):$(cat $name/size):$(cat $name/shared_cpu_list); done
Data:L1:32K:0,4
Instruction:L1:32K:0,4
Unified:L2:256K:0,4
Unified:L3:8192K:0-7

(this provides benefits for multithreading -- less cache bouncing if
running several threads of the same program -- and downsides for
multiprocessing -- the effective available cache shrinks as the number
of simultaneously running processes not sharing cache goes up.)
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list