• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to check if Hyper Threading (HT) is enabled or disabled on my Linux server

    In some online articles I have observed, tells that you can use below commands to validate the status of Hyper Threading
    # dmidecode | grep -i HTT
                    HTT (Multi-threading)
                    HTT (Multi-threading)

    Also below command can be used
    # cat /proc/cpuinfo | grep -o ht | uniq
    ht

    Please NOTE the above commands tells us that the server supports hyper threading but it has no information on the current status of hyper threading on that server.

    To check if hyper threading is enabled or not first of all you must know about the CPU model you are using, you may need to refer to the CPU vendor's documentation for this information

    Using the below command you can find the CPU vendor and model number using which you can easily get the CPU documentation from the vendor page.
    # grep "model name" proc/cpuinfo | sort -u
    model name      : Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz

    Next you must look out for below information from the CPU documentation, I found mine at Intel® Xeon® Processor E5 v3 Family
    Here look out for number of cores the CPU has i.e. no. of threads as it shows below
    # of Cores 8
    # of Threads 16

    So with this we know my CPU has total 16 logical CPUs if HT is not enabled and 32 logical CPUs if HT is enabled

    Now lets checking the real stats from the server, 'lscpu' and '/proc/cpuinfo' are the two tools which will help us get this information

    Below is my output of lscpu
    # lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                32
    On-line CPU(s) list:   0-31
    Thread(s) per core:    2
    Core(s) per socket:    8
    Socket(s):             2
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 63
    Model name:            Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
    Stepping:              2
    CPU MHz:               2600.000
    CPU max MHz:           2600.0000
    CPU min MHz:           1200.0000
    BogoMIPS:              5193.74
    Virtualization:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              256K
    L3 cache:              20480K
    NUMA node0 CPU(s):     0-31

    Here is my first HINT, it shows we have 2 sockets, 8 cores and 2 thread per core.
    That is unlikely and mostly in systems with disabled hyper threading we would get "1 thread per core"


    Check the total number of physical CPUs

    The following command will show how many active physical processors a system has
    # grep physical.id /proc/cpuinfo | sort -u | wc -l
    2


    Number of cores per CPU

    On a system with multi-core processors, the following command should report the number of CPU cores per physical processor (though in rare cases it might not).





    Example: If this number is 8 and physical CPUs is 2, then each of the 2 physical processors has 8 CPU cores, leading to a total of 16 cores.
    # grep cpu.cores /proc/cpuinfo | sort -u
    cpu cores       : 8

    We can validate the same using below command, using this we can check the number of cores per physical CPUs
    For the first CPU (0)
    # cat /proc/cpuinfo | egrep -E "^physical|core id"| xargs -l2 | sort -u | awk -F " " '{print $4}' | grep 0 | wc -l
    8

    For the second CPU (1)
    # cat /proc/cpuinfo | egrep -E "^physical|core id"| xargs -l2 | sort -u | awk -F " " '{print $4}' | grep 1 | wc -l
    8

    Again coming back to the calculation

    For this with 2 physical CPUs(sockets) and 8 cores we would expect 16 logical CPUs if hyper threading is not enabled
    # grep processor /proc/cpuinfo | wc -l
    32

    But here we have 32 CPUs so this clearly stats that hyper threading is enabled.

    Lets take an example from another of my server where HT is disabled
    # lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                16
    On-line CPU(s) list:   0-15
    Thread(s) per core:    1
    Core(s) per socket:    8
    Socket(s):             2
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 63
    Model name:            Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
    Stepping:              2
    CPU MHz:               2600.000
    CPU max MHz:           2600.0000
    CPU min MHz:           1200.0000
    BogoMIPS:              5193.67
    Virtualization:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              256K
    L3 cache:              20480K
    NUMA node0 CPU(s):     0-15
    Here as you see "Threads per core" is 1 so this gives us a HINT that there is a possibility that HT is disabled

    Check the no of cores
    # grep cpu.cores /proc/cpuinfo | sort -u
    cpu cores       : 8

    Here if we multiply the no of sockets (2) with no of cores (8) then we must have 16 cores if HT is not enabled
    # grep processor /proc/cpuinfo | wc -l
    16

    So we know now HT is disabled on this server.

    I hope the article was useful.


    Deepak Prasad

    Deepak Prasad is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?

    Become an author and be a part of our GoLinuxHub Team, Click here for more information
    How to check if Hyper Threading (HT) is enabled or disabled on my Linux server How to check if Hyper Threading (HT) is enabled or disabled on my Linux server Reviewed by Deepak Prasad on Saturday, January 20, 2018 Rating: 5

    No comments:

    Powered by Blogger.