14

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.

Jason
  • 2,233
  • 3
  • 24
  • 27

3 Answers3

22

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

Zulan
  • 21,896
  • 6
  • 49
  • 109
Stephen
  • 47,994
  • 7
  • 61
  • 70
  • 1
    That's incorrect. 'Physical id' is a socket. He has a single socket computer with a quadcore i7 with hyperthreading. All of his cores should have 'physical id' 0. 'core id' refers to the physical cores, and he should have 0-3 of those. The logical cores are defined as 'processor' and should be numbered 0-7. ... On my system, processors 0 and 4 share the same core id, processors 1 and 5 share the same core id, etc. Just make sure you don't bind two processes to the same 'core id' unless you really want to. So processor 0 and 4 are logical cpus (hyperthreading) on the same core. – bobpaul Feb 14 '13 at 22:52
  • 3
    You can use `egrep "(( id|processo).*:|^ *$)" /proc/cpuinfo` to get only the relevant information from `/proc/cpuinfo` – Elmar Zander Aug 21 '13 at 13:47
2

You can use likwid-topology -g to get graphical topology of the cpu. It shows each cpu primary cores along with the sibling core.

Jijith
  • 83
  • 1
  • 4
-1

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.

Community
  • 1
  • 1
user117529
  • 663
  • 8
  • 16