物理CPU个数:物理cpu就是主板上的cpu数量,可通过不重复的physical id判断

    1. ejuoajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "physical id"
    2. physical id : 0
    3. physical id : 0
    4. physical id : 0
    5. physical id : 0

    逻辑CPU个数:就是processor

    1. 18kejuoajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "processor"
    2. processor : 0
    3. processor : 1
    4. processor : 2
    5. processor : 3
    6. oajy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "processor" | wc -l
    7. 4

    CPU核心数:如双核、四核等 (cpu cores 核心)

    1. jy5x6zakvmZ:~$ cat /proc/cpuinfo | grep "cpu cores"
    2. cpu cores : 2
    3. cpu cores : 2
    4. cpu cores : 2
    5. cpu cores : 2
    1. 5x6zakvmZ:~$ lscpu
    2. Architecture: x86_64
    3. CPU op-mode(s): 32-bit, 64-bit
    4. Byte Order: Little Endian
    5. CPU(s): 4 # 逻辑cpu个数
    6. On-line CPU(s) list: 0-3
    7. Thread(s) per core: 2 # 每个cpu核心数
    8. Core(s) per socket: 2 # 物理cpu
    9. Socket(s): 1
    10. NUMA node(s): 1
    11. Vendor ID: GenuineIntel
    12. CPU family: 6
    13. Model: 85
    14. Model name: Intel(R) Xeon(R) Gold 6149 CPU @ 3.10GHz
    15. Stepping: 4
    16. CPU MHz: 3100.000
    17. BogoMIPS: 6200.00
    18. Hypervisor vendor: KVM
    19. Virtualization type: full
    20. L1d cache: 32K
    21. L1i cache: 32K
    22. L2 cache: 1024K
    23. L3 cache: 22528K
    24. NUMA node0 CPU(s): 0-3

    总的逻辑Cpu = 物理Cpu个数 * 每个物理cpu核心数

    如果开启了超线程,总的逻辑cpu就是没开超线程时总的逻辑cpu个数的两倍