[Go] physical CPU, CPU cores, logical CPU, Hyper-threading

Source: Internet
Author: User

Turn from: http://wulc.me/2016/01/06/physical CPU, CPU cores, logical CPUs, Hyper-threading/

Basic concepts
    • Physical CPU:
      The physical CPU is the real CPU hardware plugged into the host, and the number of physical CPUs of the host can be verified under Linux under different physical IDs.

    • Number of cores:
      The next layer of the physical CPU is the core number, and we often hear about multicore processors, where the cores are the core numbers. Under Linux, cores can be used to confirm the core number of the host's physical CPU.

    • Logical CPU:
      The core number of the next layer of the concept is a logical CPU, logical CPU with Hyper-Threading technology, if the physical CPU does not support Hyper-threading, then the number of logical CPUs equals the number of cores;
      If the physical CPU supports Hyper-threading, then the number of logical CPUs is twice times the number of cores. The number of logical CPUs can be confirmed by the number of processors under Linux.

    • Hyper-Threading:
      Hyper-Threading is a technology developed by Intel that allows a single processor to run like two logical processors, so that a single processor executes threads in parallel.
      A single processor here can also be understood as a core of the CPU, so you can understand why hyper-Threading technology is turned on, and the number of logical CPUs is twice times the number of cores.

View the physical CPU, core count, logical CPU, and whether Hyper-threading is supported under Linxu

Some information about the CPU can be viewed in the/proc/cpuinfo file.

cat  /proc/cpuinfo

You can see that the content inside is divided by processor (that is, logical CPU) as the base unit,
The core ID under processor indicates which kernel this logical CPU belongs to,
The physical ID, however, indicates which physical CPU the core or logical CPU belongs to.

By understanding this information, you can easily see the parameters mentioned above.

    • To view the number of physical CPUs
      The physical CPU is the number of different phycical IDs that can be implemented by the following command:

      cat /proc/cpuinfo | grep 'physical id' | uniq |wc -l

      Uniq is to remove duplicate records of multiple logical CPUs belonging to the same physical CPU.

    • View the number of cores
      The number of cores is the number of different core IDs that can be implemented by the following command

      cat /proc/cpuinfo | grep 'core id' | uniq |wc -l
    • To view the number of logical CPUs
      Logical CPU is the number of processor

      cat /proc/cpuinfo | grep 'processor' | wc -l

      No need to go to the logical CPU when viewing

    • To see if hyper-threading is supported
      If hyper-Threading is supported, it means that there are two processors under the same core, so you can simply observe the contents of/proc/cpuinfo.
      If the core ID of the two processor is the same, then the description supports Hyper-Threading.
      Another way is to see if the values of the siblings and CPU cores are consistent, judging by the following

If "siblings" and "CPU cores" are consistent, hyper-threading is not supported, or hyper-threading is not open.
If "siblings" is twice Times "CPU cores", then hyper-Threading is supported and Hyper-threading is turned on.

In addition, the number of CPUs seen in the top command is the logical CPU (enter top and press 1).

[Go] physical CPU, CPU cores, logical CPU, Hyper-threading

Related Article

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.