This can be done with the command line tool lscpu
to view the CPU information of the current Linux system, including the number of physical CPUs, the number of cores of each physical CPU, CPU model, etc.
Open a terminal and enter the following command to view CPU information:
Copy codelscpu
After executing this command, a message similar to the following is output:
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
In the output, the following important parameters can be found:
CPU(s)
: Indicates the number of CPUs in the current system, including logical and physical CPUs.Thread(s) per core
: Indicates the number of threads in each core, i.e. the number of threads supported by Hyper-Threading Technology. If Hyper-Threading is not supported, the value is 1.Core(s) per socket
: Indicates the number of cores in each physical CPU.Socket(s)
: Indicates the number of physical CPUs in the current system.
Based on the above parameters, you can calculate the number of physical CPUs and the number of cores of each physical CPU in the current system. For example, in the above output, the number of physical CPUs is 1 and the number of cores per physical CPU is 2.
No comments