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

How to distinguish between physical CPU, logical CPU and CPU kernels under Linux

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to distinguish physical CPU, logical CPU and CPU kernels under Linux". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to distinguish physical CPU, logical CPU and CPU kernels under Linux".

㈠ concept

① physical CPU

Number of CPU on the slot in the actual Server

Number of physical cpu. You can count the number of physical id that are not duplicated.

② logic CPU

Linux users must be familiar with the file / proc/cpuinfo. It is used to store cpu hardware information

The information content lists the specifications of processor 0-n respectively. It should be noted here that if you think n is the real cpu number, you are making a big mistake.

In general, we think that a cpu can have multiple cores, coupled with intel's hyperthreading technology (HT), it can be logically divided into twice the number of cpu core.

Number of logical CPU = number of physical cpu x cpu cores this specification value x 2 (if ht is supported and enabled)

Note: the number of CPU viewed by top under Linux is also the number of logical CPU

③ CPU kernels

The number of chipsets on a CPU that can process data, such as i5760, is a dual-core four-thread CPU, while i5 2250 is a four-core four-thread CPU

Generally speaking, the number of physical CPU × the number of each core should be equal to the number of logical CPU. If it is not equal, it means that the CPU of the server supports hyperthreading technology.

㈡ View CPU Information

When we cat / proc/cpuinfo

A CPU with the same core id is a hyperthread of the same core

A CPU with the same physical id is a thread or core encapsulated by the same CPU

㈢, the following is an example

① to view the number of physical CPU

Cat / proc/cpuinfo | grep "physical id" | sort | uniq | wc-l

② to check the number of logical CPU

Cat / proc/cpuinfo | grep "processor" | wc-l

③ check how many cores CPU is.

Cat / proc/cpuinfo | grep "cores" | uniq

= supplement = =

Number of number of processors cores per cpu

Reference: http://www.aixchina.net/Question/13399

= = supplementary = =

CPUs, Cores, Sockets in AWR

Http://blog.itpub.net/35489/viewspace-742337/

NUM_CPUS 8 represents the number of logical CPU (the initial parameter cpu_count shown in the Oracle database)

NUM_CPU_CORES 8 corresponds to the number of CPU Cores

Number of NUM_CPU_SOCKETS 2 CPU Sockets

-stat_name = NUM_CPUS. This value should correspond to the number of logical CPUs. For systems with CMT or

Hyper-threaded processors, this value should correspond to the total number of hardware threads. For systems with

Multi-core processors, this value should correspond to the total number of hardware threads across all cores in the

System. NUM_CPUS should be greater than or equal to NUM_CPU_CORES and NUM_CPU_SOCKETS.

Number of corresponding logical CPU

For CPU multithreaded or hyperthreaded, the value should refer to the total number of hardware threads.

For multicore processors, the value should correspond to the total number of hardware threads for all cores in the system.

NUM_ CPU value is greater than or equal to NUM_CPU_CORES and NUM_CPU_SOCKETS

So, if the physical number of CPU is 2, then Sockets=2 (initially understood as slot)? Each CPU uses 4 cores and 4 threads per core, so the processor (CMT)

Can support 16 parallel execution of hard threads, corresponding to NUM_CPUS is equal to 2 * 4 * 4 = 32 (according to the second red statement)? NUM_CPU_CORES=2*4 = 8?

Thank you for your reading, the above is the content of "how to distinguish physical CPU, logical CPU and CPU kernels under Linux". After the study of this article, I believe you have a deeper understanding of how to distinguish physical CPU, logical CPU and CPU kernels under Linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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