How to view the number of physical CPUs, cores, threads, and Linux on linux

Source: Internet
Author: User

How to view the number of physical CPUs, cores, threads, and Linux on linux

First, let's take a look at what is hyper-threading.

Hyper-Threading Technology uses special hardware commands to simulate two logical kernels into two physical chips, so that a single processor can use thread-level parallel computing, and thus be compatible with multi-threaded operating systems and software, this reduces the idle CPU time and improves the CPU running efficiency.
Hyper-threading technology is used to execute multiple programs at the same time on one CPU and share resources in one CPU. Theoretically, we need to execute two threads at the same time like two CPUs, although hyper-threading technology can be used to execute two threads at the same time, each CPU has independent resources, not just like two real CPUs. When both threads need a certain resource at the same time, one of them must be temporarily stopped and the resources must be made available until these resources are idle. Therefore, the performance of hyper-threading is not equal to the performance of two CPUs.

 

Next, let's look at the relationship between the number of physical CPUs, the number of cores, and the number of threads.

Total number of cores = number of physical CPUs * Number of cores per physical CPU
Total logical cpu count = number of physical CPUs * Number of cores per physical CPU * Number of hyper-threading

In the preceding formula, the number of logical CPUs is the number of threads.

 

How to view the number of physical CPUs

# Grep 'physical id'/proc/cpuinfo | sort-u

physical id    : 0physical id    : 1

 

How to view the number of cores of each physical CPU

# Grep 'core id'/proc/cpuinfo | sort-u | wc-l

8

 

How to view the total number of logical CPUs

# Grep 'processor '/proc/cpuinfo | sort-u | wc-l

32

32/8/2 = 2. The CPU supports and hyperthreading is enabled.

 

How to view the CPU Model

# Dmidecode-s processor-version

Intel(R) Xeon(R) CPU E5-2658 @ 2.10GHzIntel(R) Xeon(R) CPU E5-2658 @ 2.10GHz

 

Differences between physical CPUs, cores, and hyper-threading

A core is the most basic computational unit of a processor. A processor is made up of one or more cores. Tradition processors had only one core while modern processors have multiple cores.

A core consists of an ALU, CU, and a set of registers.

A core consists of two levels of caches called L1 and L2 which is there in each core.

A processor consists of a cache that is shared by call cores called L3 cache. It is common to all cores.

A processor depending on the architecture can consist of a memory controller and an input/output controller.

Certain processor packages consist of Graphics Processing Units (GPU) as well.

A core that does not have hyper-threading can execute only one instruction at a time while a multicore processor made up of several cores can execute several instructions parallel. if a processor is made up of 4 cores that do not support hyper threading then that processor can execute 4 instructions at the same time.

A core having hyper-threading technology has redundant functional units so that they can execute multiple instructions at a time. for example, a core with 2 threads can execute 2 instructions at the same time hence a processor with 4 such cores can execute 2 × 4 instructions parallel. these threads are usually called logical cores and the task manager of Windows generally show the number of logical cores but not the physical cores.

 

Refer:

1. http://www.differencebetween.com/difference-between-core-and-vs-processor/

2. http://jingyan.baidu.com/article/63acb44a81001361fcc17e21.html



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.