Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux's method of checking the number of CPU kernels

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report