views:

105

answers:

1

I'm curious what the CPU ordering is in Linux. Say I bind a thread to cpu0 and another to cpu1 on a hyperthreaded system, are they both going to be on the same physical core. Given a Core i7 920 with 4 cores and hyperthreading, the output of /proc/cpuinfo has me thinking that cpu0 and cpu1 are different physical cores, and cpu0 and cpu4 are on the same physical core.

Thanks.

+1  A: 

The physical core is listed as physical id.

cat /proc/cpuinfo | grep 'physical id'

I would imagine this could easily vary between kernels, distributions, but mine shows: cpu0 and cpu1 on the same physical id=0, and cpu2 and cpu3 on physical_id=1.

Note that each physical cpu (physical id) can have multiple logical cpus (core id), which are hyperthreaded cores. The logical cpus are overall ordered by processor id.

Stephen