物理CPU个数:物理cpu就是主板上的cpu数量,可通过不重复的physical id判断
ejuoajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "physical id"
physical id : 0
physical id : 0
physical id : 0
physical id : 0
逻辑CPU个数:就是processor
18kejuoajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "processor"
processor : 0
processor : 1
processor : 2
processor : 3
oajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "processor" | wc -l
4
CPU核心数:如双核、四核等 (cpu cores 核心)
jy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "cpu cores"
cpu cores : 2
cpu cores : 2
cpu cores : 2
cpu cores : 2
5x6zakvmZ:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4 # 逻辑cpu个数
On-line CPU(s) list: 0-3
Thread(s) per core: 2 # 每个cpu核心数
Core(s) per socket: 2 # 物理cpu
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6149 CPU @ 3.10GHz
Stepping: 4
CPU MHz: 3100.000
BogoMIPS: 6200.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 22528K
NUMA node0 CPU(s): 0-3
总的逻辑Cpu = 物理Cpu个数 * 每个物理cpu核心数
如果开启了超线程,总的逻辑cpu就是没开超线程时总的逻辑cpu个数的两倍