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

Source: Internet
Author: User

First, look at what the Hyper-threading concept

Hyper-Threading technology is the use of special hardware instructions, the two logical core simulation into two physical chips, so that a single processor can use thread-level parallel computing, and thus compatible with multi-threaded operating systems and software, reduce the idle time of the CPU, improve the efficiency of the CPU.
Hyper-Threading Technology is a CPU executing multiple programs at the same time to share a CPU resources, in theory, like two CPUs at the same moment to execute two threads, although the use of Hyper-Threading technology can execute two threads simultaneously, but it is not like two real CPUs, each CPU has a separate resource. When two threads require a resource at the same time, one of them is temporarily stopped and the resources are given up until the resources are idle before they can continue. Therefore, hyper-threading performance is not equal to the performance of two CPUs.

Second, look at 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 CPUs = number of physical CPUs * Number of cores per physical CPU * Number of hyper-threads

In the above formula, the number of logical CPUs is the number of threads

How to view CPU physical number

# grep ' physical id '/proc/cpuinfo | Sort-u

Physical ID    : 0physical ID    : 1

How to view the number of cores per 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, it is visible that the CPU supports and has hyper-threading turned on.

How to view the model of the CPU

# dmidecode-s Processor-version

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

About the difference between the physical CPU, the number of 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 has multiple cores.

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

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

A processor consists of a cache that's shared by call cores called L3 cache. It's 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 has hyper-threading can execute only one instruction at a time and a multicore processor made up O F several cores can execute several instructions parallel. If A processor is made up of 4 cores that does not support hyper threading then that processor can execute 4 instructions at The same time.

A Core has hyper-threading technology have redundant functional units so that they can execute multiple instructions at A time. For example, a core with 2 threads can execute 2 instructions @ the same time hence a processor with 4 such cores can EXE Cute 2x4 instructions parallel. These threads is usually called logical cores and the task manager of Windows generally show the number of logical cores But not the physical cores.

How to view the number of physical CPUs, number of cores, number of threads on 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.