Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.

like image 282
Jason Avatar asked Jun 10 '10 22:06

Jason


1 Answers

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

like image 130
Stephen Avatar answered Oct 15 '22 21:10

Stephen