如何看当前Linux系统有几颗物理CPU和每颗CPU的核数?

图片[1]-如何看当前Linux系统有几颗物理CPU和每颗CPU的核数?-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

可以通过命令行工具 lscpu 来查看当前 Linux 系统的 CPU 信息,包括物理 CPU 数量、每个物理 CPU 的核数、CPU 型号等。

打开终端,输入以下命令即可查看 CPU 信息:

Copy codelscpu

执行该命令后,会输出类似下面的信息:

lessCopy codeArchitecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               58
Model name:          Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Stepping:            9
CPU MHz:             1201.000
CPU max MHz:         3100.0000
CPU min MHz:         1200.0000
BogoMIPS:            4988.43
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            3072K
NUMA node0 CPU(s):   0-3

在输出的信息中,可以找到以下几个重要的参数:

  • CPU(s):表示当前系统中 CPU 的数量,包括逻辑 CPU 和物理 CPU。
  • Thread(s) per core:表示每个核心中的线程数,即超线程技术(Hyper-Threading Technology)支持的线程数。如果不支持超线程,则该值为 1。
  • Core(s) per socket:表示每个物理 CPU 中核心的数量。
  • Socket(s):表示当前系统中物理 CPU 的数量。

根据以上参数,可以计算出当前系统中的物理 CPU 数量和每个物理 CPU 的核数。例如,上面输出的信息中,物理 CPU 数量为 1,每个物理 CPU 的核数为 2。


Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Harry
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments