Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to find out if hyperthreading is enabled within the BSD kernel of a given machine without watching the boot up sequence?

share|improve this question
    
This may help you. –  Prince John Wesley Jul 1 '11 at 4:23
add comment

2 Answers

up vote 0 down vote accepted

There does not appear to be a way using sysctls to determine if a system has hyperthreading enabled or not. hw.ncpu will just inform the kernel how many CPUs are available which will include cores, hyperthreads, and individual processors.

Also, the link from Prince John Wesley is from 2006 and no longer appear relevant.

As much as I hate grepping dmesg, you can do the following (on FreeBSD 8.x):

dmesg | grep SMT

Hyperthreaded systems should return a result. Not hyperthreaded systems should not.

share|improve this answer
add comment

You can determine this by looking at the output of sysctl hw.ncpu. If it is 1, you have no hyperthreading.

share|improve this answer
    
But if it's >1, it could mean multiple cores, not necessarily hyperthreading. –  Gilles Jun 30 '11 at 23:41
    
So 0 means HT is enabled? –  Mark D Jul 2 '11 at 19:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.