About the number of CPU "cores" in the virtual machine

Source: Internet
Author: User

  How to learn more about CPU information in Linux systems. Of course, it is checked by Cat/proc/cpuinfo, but for example several physical cpu/several cores/several threads, these questions how to determine. After viewing, my development machine was 1 physical cpu,4 cores 8 threads, Intel (R) core (TM) i7 CPU 860  @ 2.80GHz recorded, judged by the process and knowledge.   Judgment basis: 1. CPUs with the same core ID are the same core hyper-threading. 2. CPUs with the same physical ID are the same CPU-encapsulated threads or cores. English: 1.Physical ID and core ID are not necessarily consecutive but they unique. Any CPUs with the same core ID are hyperthreads in the same core. 2.Any CPU with the same physical ID are threads or cores in the same socket.   echo "Logical CPU Number:" #逻辑CPU个数 cat/proc/cpuinfo | grep "Processor" | Wc-l   echo "Physical CPU Number:" #物理CPU个数: Cat/proc/cpuinfo | grep "Physical ID" | Sort-u | Wc-l   echo "core number in a physical CPU:" #每个物理CPU中Core的个数: Cat/proc/cpuinfo | grep "CPU Cores" | Uniq | Awk-f: ' {print $} ' number of #查看core IDs, that is, the number of core on all physical CPUs Cat/proc/cpuinfo | grep "Core ID" | Uniq |  wc-l   #是否为超线程. #如果有两个逻辑CPU具有相同的 "Core ID", the Hyper-threading is turned on. Or the number of siblings is larger than the number of CPU cores. #每个物理CPU中逻辑CPU (availableNumber of core, threads or both): Cat/proc/cpuinfo | The grep "siblings"    /proc/cpuinfo file contains a paragraph of data for each processor on the system. The/proc/cpuinfo description contains 6 entries for multi-core and Hyper-Threading (HT) Technical checks: processor, vendor ID, physical ID, siblings, core ID, and CPU cores. 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.   1. All logical processors with the same physical ID share the same physical socket. Each physical ID represents a unique physical package. 2.Siblings represents the number of logical processors located on this physical package. They may or may not support Hyper-Threading (HT) technology. 3. Each core ID represents a unique processor kernel. All logical processors with the same core ID are located on the same processor core. 4. If more than one logical processor has the same core ID and physical ID, the system supports Hyper-threading (HT) technology. 5. If there are two or more logical processors with 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.   Determine if the CPU is 64 bits, check the flags section in the Cpuinfo to see if there is a LM ID. Are the processors 64-bit?    A 64-bit processor'll have LM ("long Mode") in the Flags section of Cpuinfo. A 32-bit processor won't.


Article Two:

In the study of Linux system load, contact some knowledge about CPU information view, and share with you. Through the analysis of the parameters in the/proc/cpuinfo file, also learned a lot of things.

In the Linux operating system, the CPU information is loaded into the Cpuinfo file in the virtual directory/proc under the boot process, and we can view it through Cat/proc/cpuinfo:




Above is my Computer CPU information, below we analyze some of the more important indicators: Processor logical processor ID. ID of the processor that is physically encapsulated by the physical ID. The ID of each core of the kernel ID. CPU cores The number of cores in the same physical package of processors. Siblings the number of logical processors in processors in the same physical package.

We go back to look at the graph, my physical ID is 0, indicating that I have only one physical processor;

My processor has two different numbers and belongs to a physical ID, and the CPU cores value is 2, which means my CPU is dual core and has only one logical processor per core.

To deepen your understanding of these parameters, let's look at another picture, which is a workstation server:


On this server, ' CPU cores ' is 4,physical ID has two, core ID has 8, siblings value is 8, a total of 16 processor.

So this server host's CPU is 2 physically packaged processors, each processor has 4 processing cores (CPU cores), each CPU core is divided into 2 logical processors (Hyper-Threading technology), so there are 8 logical processors per physical processor, Altogether, there are 16 processor. This time, I see. The overall structure is as follows:



But what if the system is running in a virtual machine? Let's take a look. Note: The server in this virtual machine has the same configuration as the one mentioned above.




As we can see in the picture, Linux in the virtual machine is not able to see the physical ID, and can not see the parameters such as CPU cores, all thanks to the virtual machine technology.


So what we call the "cores" of virtual machines is worth processor.

The first is from the "Icooke 51CTO official Blog" blog, please be sure to keep this source http://icooke.blog.51cto.com/4123148/757555

The second article from: http://www.linuxidc.com/Linux/2011-09/41985p2.htm


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.