Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Dell desktop running Windows 7 Professional. I think the processor is an Intel Core i7-2600

Recently a computer expert who specializes in Linux clusters was looking at my desktop PC and commented off-hand that my machine has 8 threads. He said that meant the machine has 4 cores: 2 threads per core. I had been unaware that the machine had more than one core.

Now that I know the machine apparently has four cores I am hoping to run maybe three models simultaneously, one model on each of three core.

Someone suggested that I "turn off the hyperthreading" so that I "can use the whole core per model". Otherwise, he wrote "it runs at half speed".

I run many models using Program R and the computer gentleman who was helping me pointed out that one of my R script files displayed a message saying it was using 7 of 8 threads. So, given that the R file was using 2 threads per core with three of the cores maybe turning off hyperthreading would not increase computation speed in my case?

If turning off hyperthreading would increase computation speed of the R scripts, how could I do that?

I searched the internet a little bit and found a discussion on the subject at this forum:

http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/disable-hyperthreading-when-windows-7-already/80dd6c15-76b7-4534-b691-3e3a37ffad75

One comment at that forum that concerns me is the claim that:

"The biggest problem for those who want to shut down HT, is that a lot of computer manufacturers (HP, Dell) don't allow the people who buy their computers the BIOS option to shut down HT. And since windows looks at the HT setting in BIOS to determine whether to handle HT, it's a case of being stuck in low gear, and no ability to shift up."

Since my computer is a Dell, perhaps I am not able to turn off hyper-threading.

I also found this post on Superuser:

Disable Hyperthreading in the Windows 7 registry

One answer there seemed particularly helpful, but complex, dealing with hexadecimals, and the computer in question was an HP. I do not know whether that matters.

There appear to be quite a few other posts here about hyperthreads, but the one immediately above comes closest to my situation of those I have read.

Sorry if this question is a duplicate. If I need to provide additional information or clarify my concerns I will gladly do so.

share|improve this question
    
Basically, you can just ignore this. HT will only be used when it's beneficial. If there are four or fewer threads running, each will get its own core. If there are more than four threads running, some of them will run slower, but they'll run for a greater fraction of a time. It's a net win, otherwise HT wouldn't exist. –  David Schwartz Nov 15 '12 at 2:09
    
@DavidSchwartz Depends on the application - I have a program limited to 8 cores that, if HT is on, selects 4 physical & 4 virtual cores on my 8-core PC and leaves half of the physical cores idle. In this scenario, turning off HT gave me a ~80% speedup. (sorry for thread necromancy) –  Simon W Oct 24 '13 at 9:03
    
@SimonWaldman I'm not sure what a "program limited to 8 cores" is. Normally, programs don't select cores, the OS scheduler does. It sounds like the program is just broken -- if it's going to select cores, it has to understand how to do it sanely. –  David Schwartz Oct 24 '13 at 15:35
    
@DavidSchwartz it's a program that will only use 8 cores unless you pay more for a license that allows more. I guess it might be more correct to say that it will only use 8 threads. –  Simon W Oct 24 '13 at 18:40
    
@SimonWaldman Odd. If it just uses 8 threads, the scheduler should schedule them, preferring cores that don't share execution resources to cores that do. You shouldn't have that problem unless your OS's scheduler doesn't understanding hyper-threading, your BIOS borks the CPU assignment order, or the program specifically chooses to bind to virtual cores in a dumb way. –  David Schwartz Oct 24 '13 at 18:45
show 1 more comment

1 Answer

up vote 2 down vote accepted

Why is there no option inthe BIOS?

I assume the reason why Dell and friends often do not add an option to disable this is because it rarely is a good idea. On average it will make your computer slower (or from a different point of view, it will make competitors computers relative faster).

Having said,that, lets look at some imaginary examples:

What does HT do?

1 core, no hyper-threading

  • 1 CPU bound process is running, and can run and maximum speed. Lets call this speed 1, or 100%
  • 2 CPU bound processes running. The CPU will have to switch between both. Effective speed on both processes is roughly halved. (The sum of both speeds is still equal to the first example.)
  • 3 CPU bound processes running. The CPU will have to switch between all three. Effective speed on both processes is roughly a a third. (The sum of both speeds is still the same ( 3 x 0.33 = 1 ).

2 cores, no hyper-threading

  • 1 CPU bound process *0 is running, and can run and maximum speed for that core. (speed 100%) (The other core is idle).
  • 2 CPU bound processes running. Both can run at maximum speed for their core. (speed 200%)
  • 3 CPU bound processes running. Usually you get 3 tasks running at about 2/3rd efficiency. (The sum of the speeds is still '2'. Roughly 2 because you loose a bit due to extra overhead and cache misses). (speed 200%, or maybe 190%)

Now cores with hyper-threading . These act as two cores, but not two complete cores. What Intel defines as hyper-threading has changed a bit over time, but usually it comes down to this. A CPU fetches data from memory and computes. If it does not need the memory bus then a second part of the CPU can do limited work. Since not all hardware is duplicated you do not get two full cores. However with limited extra hardware (10%?) you gain on average 30% speed. *1

1 core, with - 1 CPU bound process is running, and can run and maximum speed. (100%) - 2 CPU bound processes running. The CPU will have to switch between both. However it has some extra hardware. Net speed will be about 30% faster (say speed 133% for a single core)

Etc.

So much for the introduction to HT.

Are these fictional %'s real?

No. First of all you will loose efficiency due to overhead. (10 tasks on one CPU will not run slower than just one task with no context switches and all of the cache for its data).

Secondly I totally ignored turbo boost since that would complicate the explanation.

What did my friend possibly mean to say?

Lets look at your 4 core 8 treads CPU like this:
Core 1, CPU 1 (real)
Core 1, CPU 2 (with HT)
Core 2, CPU 3 (real)
Core 2, CPU 4 (with HT)
Core 3, CPU 5 (real)
Core 3, CPU 6 (with HT)
Core 4, CPU 7 (real)
Core 4, CPU 8 (with HT)

If I run two tasks I do not want both of them on CPU1 and CPU2 (since they share an actual core) and the nett result is near half of the possible speed. This might be what your friend meant.

While true I think that you do not need to worry. The windows scheduler is smart enough to allocate processes first to CPUs 1,3,5,7 and only then to 2,4,6,8.



*0 A CPU bound process is a process which is limited by the CPU. If a process is waiting for diskIO and the CPU is idle then you get totally different results.

*1 Please take those numbers with a grain of salt. They are not precise. They will vary per CPU generation and even per CPU model. They will vary per program. And what Intel calls hyper-threading has changed since early CPU generations. However they do give a rough idea.

share|improve this answer
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.