MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Linux Tips: How to Find Out if a Your CPU Supports HT (Hyper-Threading)?

| Comments

Intel introduced Hyper-Threading Technology (HT) in its line of Xeon processors in 2002. HT Technology enables multiprocessor servers to act as if they had twice as many processors installed. Intel’s HT Technology allows a single processor to handle two independent sets of instructions at the same time. In essence, HT Technology converts a single physical processor into two virtual processors. Currently HT is present in other Intel CPUs besides the high level Xeons, like Pentium 4 (with 800MHz CPU bus speed) or Pentium 4 Extreme Edition and the dual-core Pentium Extreme Edition. For more details see Intel’s site: http://www.intel.com/products/ht/hyperthreading_more.htm

In order to make use of Hyper-Threading in Linux, you will need Hyper-Threading enabled in kernel. But how can you find out if your CPU supports HT? We can get the information from our running Linux system about its CPU by looking into /proc. For example, bellow you can see the output taken from a Xeon system:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**cat /proc/cpuinfo**
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.20GHz
stepping        : 3
cpu MHz         : 3201.940
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss **ht **tm pbe nx lm pni monitor ds_cpl cid cx16 xtpr
bogomips        : 6404.17

Inside the flags section we are looking for a “ht” flag. If it is present, this means that the system supports HT. Let’s look on another sample taken from a Pentium4 CPU (the un-needed infos were removed):

1
2
3
model name      : Intel(R) Pentium(R) 4 CPU 3.20GHz
cpu MHz         : 3192.092
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss **ht **tm

Again this system also supports HT. If you don’t see the HT flag, then your system doesn’t support HT. Obviously this will not be available on AMD processors as this is an Intel technology (this might not be true anymore with newer AMD CPUs). Here is an example from an AMD Opteon system:

1
2
3
model name      : AMD Opteron(tm) Processor 242
cpu MHz         : 1593.326
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow

If your CPU supports HT, then you can take advantage of this technology only if HT support is enabled in your running kernel. You can either install a kernel provided by your Linux distribution with HT support (one that has SMP inside its name for ex.) or you can compile your own kernel and include HT support.

Once you are running a HT enabled kernel your should normally see the virtual CPU as a regular extra CPU (you will see 2 CPUs on a single CPU system, 4 CPUs on a dual processor system, etc.). You can easily check this with:

cat /proc/cpuinfo

If you still see only one CPU even after you have installed a HT enabled kernel, then you might want to check:

  • HT is not disabled in BIOS.

  • APCI is enabled in BIOS.

Comments