I am using the Ubuntu. How can I check whether Hyper Threading is enabled or not. And if it is disabled, how can I enable it?
Asked
Active
Viewed 1.6k times
4 Answers
6
You can check the pseudo file /sys/devices/system/cpu/smt/active
- it contains 1
if hyperthreading is enabled and 0
otherwise.
Shell example:
$ printf 'Hyperthreading '; \
sed -e s/1/enabled/ -e s/0/disabled/ /sys/devices/system/cpu/smt/active
You can either enable it in the BIOS - or in Linux with
# echo on > /sys/devices/system/cpu/smt/control
if and only if
# cat /sys/devices/system/cpu/smt/control
returns off
.

maxschlepzig
- 35,645
- 14
- 145
- 182
-
I have a quad core cpu, and have 8 total threads, which is also what i see with `lscpu`. but i have read on internet that there should be 16 threads if i have hyperthreading enabled. your last command returned on for me. but, why am i only getting 8 threads then? – Naveen Reddy Marthala Dec 14 '20 at 05:09
-
1@NaveenKumar - most CPUs that implement hyperthreading implement 2 threads of execution per core. So 8 threads is expected for a quad core CPU then. You can also cross-check by looking up your CPU model name in the vendor's online CPU database. – maxschlepzig Dec 14 '20 at 16:08
-
I have a 1 in this file, but `dmidecode` shows 4 for both "Core Count" and "Thread Count". – user2023370 Jul 15 '21 at 11:24
-
@user2023370 dmidecode just reads out the DMI tables which are populated by the BIOS at some point during system initialization. Thus the information contained therein isn't necessarily accurate, especially after an operating system kernel (re-)initializes much hardware. If you want to get on the bottom of this you can cross check these numbers against the data sheet of your CPU and the `lscpu` output. – maxschlepzig Sep 10 '22 at 09:17
3
You can check if HyperThreading is enable or not with
dmidecode -t processor|grep Count
if "Core Count" is the same as "Thread Count" ex:
Core Count: 32 Thread Count: 32
The HT is Disabled.
Else HT is Enabled.
Flag "HTT" shows the possibility of HyperThreading.

mik-mak
- 43
- 3
1
If you have root permission
dmidecode -t processor | grep HTT

Steephen
- 14,645
- 7
- 40
- 47
-
when i run grep -i 'ht' /proc/cpuinfo its showing flags in cpuinfo....what is the correct one – Anil Kumar Apr 13 '15 at 13:33
-
@AnilYadav I read your all comments in Leon's answers also, you have HT capability but it is not enabled. So you have to check in BIOS to find is it enabled or not . – Steephen Apr 13 '15 at 14:24
-
This only checks if the CPU supports hyperthreading, i.e. it also prints HTT if it's disabled. – maxschlepzig Aug 24 '19 at 17:11
1
You can check cpuinfo
grep -i 'ht' /proc/cpuinfo
The ht flag indicates that Hyper Threading is enabled

Leon
- 12,013
- 5
- 36
- 59
-
its showing flags row....but when i run dmidecode -t processor | grep HTT command provide by Steephen its not showing anything. – Anil Kumar Apr 13 '15 at 13:31
-
-
-
In that case it could be that HyperThreading is disabled. On the command I gave, is the ht flag there? You can also run `dmidecode -t processor` without grep and check which flags are set – Leon Apr 13 '15 at 13:39
-
Processor Information Socket Designation: CPU socket #0 Type: Central Processor Family: Unknown Manufacturer: GenuineIntel ID: D7 06 02 00 FF FB AB 1F Version: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz Voltage: 3.3 V External Clock: Unknown Max Speed: 30000 MHz Current Speed: 2700 MHz Status: Populated, Enabled Upgrade: ZIF Socket L1 Cache Handle: 0x0054 L2 Cache Handle: 0x0055 L3 Cache Handle: Not Provided Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Handle 0x0042, DMI type 4, 35 bytes – Anil Kumar Apr 13 '15 at 13:42
-
-
-
1This check just checks if the CPU supports hyperthreading. Since `/proc/cpuinfo` also contains the 'ht' flag if hyperthreading is disabled your grep always matches on CPUs with HT support - even if it's disabled. – maxschlepzig Aug 24 '19 at 17:15