Home>Article>Operation and Maintenance> How to check how many cores the CPU has in centos7

How to check how many cores the CPU has in centos7

青灯夜游
青灯夜游 Original
2022-03-03 18:35:02 19985browse

How to check the number of cores in centos7: 1. Log in to the CentOS server and open the terminal; 2. In the terminal window, execute the "cat /proc/cpuinfo | grep "cores"|uniq" command to view the output The result is enough.

How to check how many cores the CPU has in centos7

#The operating environment of this tutorial: centos7 system, thinkpad t480 computer.

Concept

Physical CPU: The number of CPUs on the slot in the actual server.

Number of physical CPUs: You can count how many non-duplicate physical ids there are.

Number of CPU cores

The number of chipsets that can process data on a CPU. For example, the current i5 760 is a dual-core four-thread CPU, and the i5 2250 It is a four-core, four-thread CPU. Generally speaking, the number of physical CPUs × the number of cores should be equal to the number of logical CPUs. If they are not equal, it means that the server's CPU supports hyper-threading technology.

View CPU information

When we cat /proc/cpuinfo, CPUs with the same core id are hyperthreads of the same core, and CPUs with the same physical id They are threads or cores encapsulated in the same CPU.

The following is an example

[1] Check the CPU model: the cpu model is E7-4820

[root@node1 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 32 Intel(R) Xeon(R) CPU E7- 4820 @ 2.00GHz

[2] Check the number of physical CPUs: the number of physical cores is 2 cores

[root@node1 ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq|wc -l 2

[3] Check the number of logical cpu: the number of logical cpu is 32

[root@node1 ~]# cat /proc/cpuinfo | grep "processor" |wc -l 32

[4] Check the number of cores of the cpu: the cpu is 8 cores

[root@node1 ~]# cat /proc/cpuinfo | grep "cores"|uniq cpu cores : 8

Recommendation: "centos usage tutorial"

The above is the detailed content of How to check how many cores the CPU has in centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn