物理 CPU、CPU 核数、逻辑 CPU
1. 物理 CPU
服务器插槽上的 CPU 个数,对应 /proc/cpuinfo 中不同的 physical id。
"Any cpu with the same physical id are threads or cores in the same physical socket."
2. CPU 核数
一块 CPU 上面能处理数据的芯片组的数量,对应 /proc/cpuinfo 中的 cpu cores。
"Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core."
3. 逻辑 CPU
对应 /proc/cpuinfo 中的 processor0 - processor n,n 即为逻辑 CPU 总数。此外,top 查看到的也是逻辑 CPU。
一般来说,物理 CPU 个数 × 每颗核数 应该等于 逻辑 CPU 总数。如果不相等,则表示服务器的 CPU 支持超线程(HT)技术,可以在逻辑上再分一倍数量的 CPU core 出来,因此:
逻辑 CPU 总量 = 物理 CPU 数量 x CPU cores 这个规格值 x 2(如果支持并开启HT)
而 /proc/cpuinfo 中的 siblings 条目列出了位于相同物理封装中的逻辑处理器的数量。
以 ThinkPad X230 为例,物理 CPU 个数为 1,CPU 核数为 2,逻辑 CPU 为 4,证明支持 HT。
core id 为 0 和 1,在此处凑巧是连续的。
CPU architecture information
可以看出,/proc/cpuinfo 中显示的 cache size 为 3 级缓存。此外,model name 中显示的频率为 2.6GHz,但 CPU MHz 中显示的为 1976,而且 /proc/cpuinfo 中各个 processor 的 CPU MHz 也均不相同。你们觉得这是什么原因呢?
转载于:https://blog.51cto.com/wilber1202/1384263