Determine if the system is currently hyper-threaded under Linux

Source: Internet
Author: User

#lscpu

Thread (s) per Core:2
Core (s) per Socket:6
Socket (s): 2

-----------------------------------------------

Before you can determine whether Hyper-threading is currently turned on , you need to determine the other data:
1, number of physical CPUs:

1 2 3 [email protected] ~]# Cat/proc/cpuinfo | grep "Physical id" | sort | Uniq Physical id:0 Physical Id:1

You can see the number of physical CPUs is 2, the physical CPU is the machine can be seen outside the CPU, each physical CPU also with a separate fan.
2, the logical number of cores per physical CPU:

1 2 [email protected] ~]# Cat/proc/cpuinfo | grep "Cores" | Uniq CPU Cores:6

3, the total number of CPU threads in the system:

1 2 [email protected] ~]# Cat/proc/cpuinfo | grep "Processor" | Wc-l -

With three sides of the data, you can determine whether the current Hyper-threading, without turning on Hyper-threading, the number of CPU threads of the system = Number of physical CPUs * The number of logical cores per physical CPU * *, because each logical core ran only 1 CPU threads, if hyper-threading is turned on, then the number of CPU threads = Number of physical CPUs * Number of logical cores per physical CPU *N, because each logical core ran 2 CPU threads. So, above the 24=2*6*2, you can judge that Hyper-threading is currently turned on.

1 2 3 [email protected] ~]# Cat/proc/cpuinfo | grep "model name" | Uniq Model Name:intel (R) Xeon (r) CPU X5670 @ 2.93GHz [email protected] ~]#

This is a X5670 machine, from Intel's cpuX5670 specs page ( Http://ark.intel.com/products/47920/Intel-Xeon-Processor-X5670-%2812M-Cache-2_93-GHz-6_40-GTs-Intel-QPI%29 You can see that it does support intel®hyper-threading technology. And look at the other one:

1 2 3 4 5 6 7 8 9 Ten [[email protected] ~]# cat/proc/cpuinfo | grep "Physical ID" | Sort | Uniq physical id:1 [[email protected] ~]# cat/proc/cpuinfo | grep "Cores" | Uniq CPU cores  : 4 [[email protected] ~]# cat/proc/cpuinfo | grep " Processor "| Wc-l [[email protected" ~]# Cat/proc/cpuinfo | grep "Model Name" | Uniq [[email protected ] ~]#

8=2*4, no Hyper-threading enabled, from Intel's cpuE5504 specs page ( Http://ark.intel.com/products/40711/Intel-Xeon-Processor-E5504-%284M-Cache-2_00-GHz-4_80-GTs-Intel-QPI%29 can see, it does not support intel®hyper-threading technology, want to open can not.
In addition, depending on the physical ID information, you can determine which logic cores are on the same physical core, because the physical IDs of the logical cores on the same physical core are equal, and according to the core ID information, you can determine which two CPU threads are running on the same logical core. Because the core ID of the CPU thread running on the same logical core is equal , however, because the logical core IDs on different physical cores can be equal, So before making a second judgment (that is, which two CPU threads are running on the same logical core), you need to make the first judgment (that is, which logic cores are on the same physical core).

Determine if the system is currently hyper-threaded under Linux

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.