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.

I use a i5-2410M processor, which is setup to do hyperthreading by default on my laptop. Considering that this is a 2-core processor, this means it can do 4 threads at a time. This also means that single-threaded applications only use a maximum of 25% of processing power, and I would rather have them max at 50% instead. Will disabling hyperthreading have adverse effects (this is a development machine and runs a desktop)? Am I even reading top properly?

share|improve this question

1 Answer 1

With hyper threading with single threaded applications, if you have two of them running you'll see a boost in speed. Hyperthreading means that the CPU starts processing a second thread (wether two threads from a multi-threaded application or two single threaded applications) before the first thread finishes whatever it was doing. Disabling this effectively means that you've cut your CPU capacity in half (but not really, HT will boost by about 30%, but I'm talking about what top tells you), which is why a thread would now show as 50% in top rather than 25%.

Some more explanation:

This doesn't mean, however, that the vast majority of today's applications won't see gains from Hyper-Threading. Even single-threaded apps can reap performance benefits from Hyper-Threading, as long as more than one app is running at the same time (in other words, multitasking). While one application is sending its streams (threads) to one logical processor, a second application is simultaneously sending its streams to the second logical processor. However, if you run only one single-threaded application, you won't see performance gains with Hyper-Threading. In fact, because of the overhead associated with managing the two logical processors of Hyper-Threading, it's even possible to see some performance degradation when running only a single-threaded app.

With a booted UNIX system you're running at least the kernel, init and a shell. You're always multitasking. In all practical ways HT will always benefit you.

share|improve this answer
    
I'm not clear on your explanation, so lemme try again: will a single-threaded app run faster if hyperthreading is enabled? –  Tshepang Aug 12 '11 at 19:43
2  
No. It will take the same amount of time on CPU to finish its task. But with HT on, a second single threaded task it will begin executing sooner. For example, assume you have two single-threaded tasks that each take 1 second of CPU time to complete. with HT off the real time for both tasks to start & finish will be 2 seconds. With HT on the real time both tasks will be 1.5 seconds but they each spent 1 second on CPU. –  bahamat Aug 12 '11 at 20:42

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.