CPU physical number, multi-core, Hyper-threading judgment analysis under Linux

Source: Internet
Author: User
Tags amd processors intel pentium

In the Linux system, the software and hardware information of proc file system display system is supplied. If you want to understand the system of CPU suppliers and coherent device information, it can be obtained through the process/proc/cpuinfo file. This article makes a brief summary of the file.

Unlike the/proc/cpuinfo file generated by the instruction set (ISA) CPU, the/proc/cpuinfo file based on the X86 instruction set CPU contains the following:

processor:0
Vendor_id:genuineintel
CPU Family:6
Model:23
Model Name:intel (R) Xeon (r) CPU E5430 @ 2.66GHz
Stepping:10
CPU mhz:2666.890
Cache size:6144 KB
Physical id:0
Siblings:4
Core id:0
CPU Cores:4
apicid:0
Initial apicid:0
Fpu:yes
Fpu_exception:yes
CPUID level:13
Wp:yes
FLAGS:FPU VME de PSE TSC MSR PAE MCE cx8 APIC MTRR PGE MCA cmov Pat PSE36 clflush DTS ACPI MMX FXSR SSE SSE2 s S HT TM PBE syscall nx LM constant_tsc Arch_perfmon pebs BTS rep_good aperfmperf pni tm2 ssse3 lahf_lm DTS
bogomips:5333.78
Clflush size:64
Cache_alignment:64
Address sizes:38 bits physical, bits virtual
Power Management:

The above output items have the following meanings:

Processor: The number of logical processing penalty cores in the system. For a single-core processing penalty, the class is considered to be its CPU number, and for multi-core processing the penalty can be physical kernel, or the application of Hyper-threading technique virtual Logical kernel
VENDOR_ID:CPU Builders
CPU FAMILY:CPU Product Family Code
Model:cpu belongs to which generation in its series
Model NAME:CPU belongs to the name and its number, the nominal frequency
Stepping:cpu belongs to build newer version
The actual application frequency of CPU MHZ:CPU
Cache Size:cpu Level Two buffer size
Physical ID: The label of a single CPU
Siblings: Number of logical physical cores for a single CPU
Core ID: The number of the current physical core in its CPU, this number is not necessarily breathless
CPU Cores: The physical core number of the CPU at which the logical core is located
Apicid: Used to distinguish the number of illogical nuclei, the system of each logical core of this number must be incompatible, this number is not necessarily breathless son
FPU: Whether a floating point unit is in operation (floating)
Fpu_exception: Whether to support floating point plotting anomalies
CPUID level: The value in the EAX store before the CPUID command is fulfilled, and the CPUID instruction returns the inappropriate content according to the value of the
WP: note whether the current CPU supports write protection for user space in the kernel state (write Protection)
Flags: Features of current CPU support
Bogomips: CPU Speed (Million instructions Per Second) that is roughly measured when the system kernel starts
Clflush size: per-flush cache
Cache_alignment: Cache Address Alignment Units
Address sizes: Number of addresses that can be interviewed
Power Management: Support for energy management

CPU information in the flags of the meaning:

Fpu:onboard (x87) floating point Unit
Vme:virtual Mode Extension
De:debugging Extensions
Pse:page Size Extensions
Tsc:time Stamp Counter:support for RDTSC and WRTSC instructions
Msr:model-specific Registers
Pae:physical Address extensions:ability to access 64GB of memory; Only 4GB can is accessed at a time though
Mce:machine Check Architecture
CX8:CMPXCHG8 instruction
Apic:onboard Advanced Programmable Interrupt Controller
Sep:sysenter/sy***it instructions; Sysenter is used for jumps to kernel memory during system calls, and Sy***it are used for Jumps:back to the user code
Mtrr:memory Type Range Registers
Pge:page Global Enable
Mca:machine Check Architecture
Cmov:cmov instruction
Pat:page Attribute Table
Pse36:36-bit Page Size extensions:allows to map 4 MB pages into the first 64GB RAM, used with PSE.
Pn:processor Serial-number; Only available on Pentium 3
Clflush:clflush instruction
Dtes:debug Trace Store
ACPI:ACPI via MSR
Mmx:multimedia Extension
Fxsr:fxsave and fxstor Instructions
Sse:streaming SIMD Extensions. Single instruction multiple data. Lets you does a bunch of the same operation on different pieces of input:in a single clock tick.
Sse2:streaming SIMD Extensions-2. More of the same.
SELFSNOOP:CPU self Snoop
Acc:automatic Clock Control
IA64:IA-64 processor Itanium.
Ht:hyperthreading. Introduces an imaginary second processor that doesn ' t does much but lets you run threads in the same process a bit quicker.
Nx:no ute bit. Prevents arbitrary code running via buffer overflows.
Pni:prescott New Instructions aka. SSE3
Vmx:intel Vanderpool Hardware Virtualization Technology
SVM:AMD "Pacifica" Hardware virtualization Technology
LM: "Long Mode," which means the chip supports the AMD64 instruction set
TM: "Thermal Monitor" Thermal throttling with IDLE instructions. Usually hardware controlled in response to CPU temperature.
TM2: "Thermal Monitor 2″decrease speed by reducing multipler and VCore.
EST: "Enhanced SpeedStep"

1. View CPU Information commands
Cat/proc/cpuinfo
2. View memory Information commands
Cat/proc/meminfo
3. View the hard drive information command
Fdisk-l

According to the above, we can easily know the current system about the CPU, CPU cores, CPU is enabled Hyper-threading and other information.

1. Query the System CPU physical number: Cat/proc/cpuinfo |grep "Physical id" |sort |uniq|wc-l

2. The query system has a dash of logical core: Cat/proc/cpuinfo | grep "Processor" | Wc-l

3. Query the physical cores of the system CPU: Cat/proc/cpuinfo | grep "CPU Cores" | Uniq

4. Query the system CPU whether Hyper-Threading is enabled: Cat/proc/cpuinfo | Grep-e "CPU Cores"-e "siblings" | Sort | Uniq

5. Query CPU Frequency: Cat/proc/cpuinfo |grep Mhz|uniq

Output Example:

CPU Cores:6
Siblings:6

6. View current system kernel information: $ uname-a
Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 gmt2011x86_64 x86_64 x86_64 GNU/LINUX &NB sp;  7. View current operating system release information: Cat/etc/issue | grep linux    Red Hat Enterprise Linux as Release 4 (Nahant Update 5)      8. View logical CPU, CPU Model: Cat/proc/cpuinfo | grep name | Cut-f2-d: | uniq-c    8  Intel (R) Xeon (r) cpu             e5410   @ 2.33ghz     9.# cat/proc/cpuinfo | grep Physical | uniq-c      4 Physical id     : 0      4 Physical id     : 1    (description is actually two 4-core CPUs)      10.# getconf long_bit    32    (indicates that the current CPU is running in 32bit mode, but does not mean that the CPU does not support 64bit)       11.# Cat/proc/cpuinfo | grep Flags | grep ' LM ' | wc-l    8    (results greater than 0, said64bit calculation is supported. LM refers to long mode, support LM is 64bit)      12. If the number of CPUs cores and the number of siblings is the same, no Hyper-threading is enabled, or Hyper-threading is enabled.

Query the system whether the CPU supports a function, the root is similar, output results to sort, uniq and grep can achieve results.

The processor entry includes a unique identifier for this logical processor.
The physical ID entry includes a unique identifier for each physical package.
The core ID entry holds a unique identifier for each kernel.
The siblings entry lists the number of logical processors in the same physical package.
The CPU cores entry contains the number of cores in the same physical package.
If the processor is an Intel processor, the string in the vendor ID entry is Genuineintel.

All logical processors with the same physical ID share the same physical outlet. Each physical ID represents a unique physical package. Siblings represents the number of logical processors located on this physical package. They may or may not support Hyper-Threading (HT) technology. Each core ID represents a unique processor core. All logical processors with the same core ID are located on the same processor core. If more than one logical processor has the same core ID and physical ID, the system supports Hyper-threading (HT) technology. If two or more two logical processors have the same physical ID, but the core ID is different, this is a multi-core processor. CPU cores entries can also indicate whether multiple cores are supported.

For example, if the system contains two physical packages, and each package contains two processor cores that support Hyper-Threading (HT) technology, the/proc/cpuinfo file will contain this data. (Note: The data is not in the table.) )
<!--[If!supportlinebreaknewline]-->
<!--[endif]-->
Processor 0? 1 2? 3? 4? 5? 6? 7
? physical ID 0? 1? 0? 1? 0? 1? 0? 1
? Core ID 0 2 1? 3 0? 2? 1? 3
Siblings 4? 4 4? 4? 4? 4? 4? 4
? CPU cores? 2? 2 2? 2? 2? 2? 2? 2

This example shows that logical processors 0 and 4 reside on the core 0 of the physical package 0. This means that logical processors 0 and 4 support Hyper-Threading (HT) technology. The same work can be used to encapsulate the logical processors 2 and 6 on the 0 core 1, to encapsulate the logical processors 1 and 2 on the 1 core 5, and to encapsulate the logical processors 1 and 3 on the 3 core 7. This system supports Hyper-threading (HT) technology because two logical processors share the same kernel. There are two ways to determine if multiple cores are supported. Since the cores 0 and 1 exist on the package 0, and the cores 2 and 3 exist on package 1, this is a multi-core system. In addition, the CPU cores entry is 2, which also indicates that two cores reside in the physical package. This is a multi-channel system because there are two packages.

It is important to note that the physical ID and core ID numbers may or may not be contiguous. There are two physical packages on the system that are not uncommon, and the physical ID equals 0 and 3

CPU IDCPU ID is the CPU manufacturer to identify different types of CPUs, and the different single code for the CPU, different manufacturers of CPUs, their CPU ID definition is also different, such as "0f24" (Inter processor), "681H" (AMD processor), Based on these numeric codes, you can tell what type of CPU it is, which is the CPU ID in general.
Because the computer is using hexadecimal, the CPU ID is also represented in hexadecimal. The CPU ID of the Inter processor contains a total of four digits, such as "0f24", representing the type (type), Family (series), Mode (model), and stepping (step number), respectively, from left to right. Starting with a processor with the CPUID "068X", Inter added the brand ID (symbol) to assist the application in recognizing the CPU type, so the Pentium and Celerom processors are not correctly discriminated against according to the "068X" CPUID. You must match the brand ID to subdivide it. AMD processors are generally divided into three bits, such as "681", which are represented as family (series), Mode (model), and stepping (step numbering), respectively, from left to right.
Type (types)
Type identification is used to differentiate whether an Intel microprocessor is used for installation by an end user or by a professional personal computer system integrator, service company, or producer; the digital "1" identifies the microprocessor being tested for installation by the user; the digital "0" identifies the microprocessor being tested for integration by a professional personal computer system Service companies or manufacturers. The Intel processor type identifier we typically use is "0", and the "0f24" CPUID is of this type.
Family (series)
The series identification can be used to determine the processor belongs to that generation of products. Intel processors such as the 6 series include Pentium Pro, Pentium II, Pentium II Xeon, Pentium III, and Pentium III Xeon processors. The 5 Series (fifth generation) includes the Pentium processor and the Pentium processor with MMX technology. AMD's 6 series actually refers to the K7 series of CPUs, with Duron and athion in two major categories. The family value of the latest generation of Intel Pentium 4 series processors (including the same core Celerom processors) is "F"
Mode (model)
The model designation can be used to determine the processor's manufacturing technology and the design (or core) of the first generation of the series, and the models and series are usually in conjunction with each other to determine which particular type of processor the computer is installed on is part of a series of processors. If you can determine whether the Celerom processor is Coppermine or Tualutin core, Athlon XP processor is Paiomino or thorouhgbred core.
Stepping (step number)
The step number identifies the design or production version of the processor, helps control and track changes to the processor, and allows the end user to more specifically identify the processor version of their system installation and determine the internal design or fabrication characteristics of the microprocessor. The step number is like the processor's minor version number, such as the Cpuid "686" and "686A" are like the relationship between WINZIP8.0 and 8.1. The step number and core stepping are closely related. As the Pentium III processor with the CPUID "686" is the CCO core, and "686A" represents the updated version cD0 core.
Brand ID (Variety identification)
Intel has introduced brand ID as a secondary recognition tool for CPUs from the Coppermine core processor. If we can identify whether the processor is Celerom or Pentium 4 through the brand ID.
In a Linux system, a hyper-threaded CPU, which is identified as two CPUs, a dual-core CPU, is also recognized as two CPUs, and a dual-core hyper-threading CPU is considered to be 4 CPUs. So how do we determine the number of CPUs in our machines?
Looking closely at/proc/cpuinfo we will find the following information:
1, physical ID represents the ID of each physical CPU, there are several CPU IDs, there are several physical CPUs.
2. Siblings distinguishes the logical CPU core in the Hyper-threading CPU, a hyper-threading CPU whose physical ID is
The same, but the siblings is different.
3, core ID and CPU cores used to distinguish the dual core (multi-core) CPU, the CPU cores represents this
The CPU has several cores, and the core ID is used to represent the various cores of the CPU.

For example: How to differentiate a dual-core hyper-threading CPU?
Cat/etc/proc/cpuinfo
{
Physical Id=0 (1 physical CPUs)
[
Core Id=0 (the first core in a dual-core CPU)
CPU cores=2 (Dual-core CPU)
Siblings=0 (the first logical CPU in this core)
Siblings=1 (another logical CPU in this core)
]
[
Core Id=1 (another nucleus in a dual-core CPU)
CPU cores=2 (Dual-core CPU)
Siblings=0 (the first logical CPU in this core)
Siblings=1 (another logical CPU in this core)
]
}

CPU physical number, multi-core, Hyper-threading judgment analysis under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.