Linux checks the number of CPUs, cores, and threads in the system

1. Check the number of physical CPUs

grep 'physical id' /proc/cpuinfo | sort -u  | wc -l
1
2. Check the number of cores

grep 'core id' /proc/cpuinfo | sort -u | wc -l
1
3. Check the number of threads

grep 'processor' / proc / cpuinfo | sort -u | wc -l
1
Example:

[root@test1 ~]# grep 'physical id' /proc/cpuinfo | sort -u  | wc -l
2
[root@test1 ~]# grep 'core id' /proc/cpuinfo | sort -u | wc -l
8
[root@test1 ~]# grep 'processor' /proc/cpuinfo | sort -u | wc -l
32

This server has 2 CPUs, each with 8 cores and 4 threads per core, for a total of 32 threads.
The CPU model can be viewed through dmidecode, and the specific parameters of the CPU can also be found according to the model.

[root@qtrac1 ~]# dmidecode -s processor-version
Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327056678&siteId=291194637