Checking if HyperThreading is enabled or not?

  • How can I check if hyperthreading is enabled on a Linux machine, using a perl script to check for it?

    I'm trying the following way:

    dmidecode -t processor | grep HTT
    

    Let me know if I'm on right track.

    for `dmidecode` you have to be root.

    I like how everyone ignored the "perl script" bit ;-)

  • xebeche

    xebeche Correct answer

    9 years ago

    Notes added on July 8, 2014: As Riccardo Murri pointed out, my answer below only shows whether the processor reports to support hyperthreading. Generally, *nix O/S are configured to enable hyperthreading if supported. However, to actually check this programmatically see for instance Nils' answer!

    ---- Original answer from March 25, 2012:

    You are indeed on the right track :) with

    dmidecode -t processor | grep HTT
    

    On Linux, I generally just look for "ht" on the "flags" line of /proc/cpuinfo. See for instance

    grep '^flags\b' /proc/cpuinfo | tail -1
    

    or if you want to include the "ht" in the pattern

    grep -o '^flags\b.*: .*\bht\b' /proc/cpuinfo | tail -1
    

    (\b matches the word boundaries and helps avoid false positives in cases where "ht" is part of another flag.)

    This will only tell you if the processor is HT capable, not if HT is actually being used.

    the HTT field does not indicate that the processor is actually having hyperthreading in its cores. check the value of 'siblings' and 'cpu cores' in /proc/cpuinfo

    @Silver-Moon Can you explicate? dmidecode reads the SMBIOS and should tell the capabilities of the processor. It does not tell whether hyper-threading is seen or used by the O/S. But this has already been commented on. See also Nils answer

    @xebeche on my system dmidecode output shows "HTT (Multi-threading)" but my processor is "core 2 quad Q8400" which does not have hyperthreading. check intel specifications.

    @SilverMoon Then you should report a bug against dmidecode.

    +1 to Riccardo; I have HT disabled on an HT-capable server, and I see it print "HTT". `lscpu` is the way to check.

    @xebeche it isn’t a bug in `dmidecode`; the `CPUID` flag represented by `ht` means “that the physical package is capable of supporting Intel Hyper-Threading Technology and/or multiple cores”, not that the CPU supports hyper-threading.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM