Linux's method of checking the number of CPU kernels
Xiaobian to share with you the Linux view CPU core number method, I believe most people do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
In Linux, you can use cat /proc/cpuinfo| grep "cpu cores"| uniq"to see CPU cores, the number of cores in each physical CPU.
I. Introduction to Knowledge Points
CPU information is recorded in/proc/cpuinfo.
2. Top in Linux is equivalent to the task manager under win system, which can also be used to query
Total CPU cores = Number of physical CPUs * Number of cores per physical CPU
4. Total number of logical CPUs = number of physical CPUs * number of cores per physical CPU * number of hyperthreads
II. Inquiry command
View CPU info (model)[root@AAA ~]# cat /proc/cpuinfo| grep name | cut -f2 -d: | uniq -c 24 Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz #View number of physical CPUs [root@AAA ~]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l2#View the number of cores per physical CPU [root@AAA ~]# cat /proc/cpuinfo| grep "cpu cores"| uniqcpu cores : 6#View number of logical CPUs [root@AAA ~]# cat /proc/cpuinfo| grep "processor"| wc -l24
What does this mean? Look at the CPU architecture.
Multiple physical CPUs, CPU communication through the bus, efficiency is relatively low, as follows:
Multi-core CPU, different cores communicate through L2 cache, storage and peripherals communicate with CPU through bus, as follows:
Multi-core hyperthreading, each core has two logical processing units, two cores share the resources of a core, as follows:
From the results of the above execution, it proves that the CPU I use has 2 * 6 = 12 cores, each core has 2 hyperthreads, so there are 24 logical CPUs.
The above is all about Linux's method of checking CPU cores. Thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!