如何看当前Linux系统有几颗物理CPU和每颗CPU的核数?
时间: 2024-04-13 10:29:21 浏览: 248
您可以通过以下命令来查看当前Linux系统的物理CPU数量和每颗CPU的核数:
```shell
lscpu
```
执行上述命令后,您将会看到类似下面的输出:
```
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Stepping: 9
CPU MHz: 2800.000
BogoMIPS: 5587.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-7
```
在上述输出中,`CPU(s)` 表示物理CPU的数量,`Core(s) per socket` 表示每个物理CPU的核数。在这个例子中,系统有1颗物理CPU,每颗CPU有4个核心。
阅读全文