CPU ordering in Linux (with hyper threading)
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 th开发者_StackOverflowe 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.
The physical cpu/socket is listed as physical id
.
The physical core is listed as core id
.
A processor entry due to hypherthreading will get its own processor
, but share core id
and physical id
with another.
Note that each physical cpu (physical id
) can have multiple cores (core id
), which can further be broken up into additional logical cpus by hyperthreading. The logical cpus are overall ordered by processor id
.
There's a detailed explanation with examples here: archive.richweb.com/cpu_info via web.archive.org
You can use likwid-topology -g
to get graphical topology of the cpu. It shows each cpu primary cores along with the sibling core.
See the pointer provided in this link. The information is all in /proc/cpuinfo with regards to physical processors, cores, and hyperthreading, but you have to match info from multiple entries in that file to identify which ones group together.
精彩评论