Sign in with
Sign up | Sign in
Your question
Solved

Hyperthreading question

Last response: in CPUs
Share
a b à CPUs
January 13, 2013 3:41:38 AM

Alright. Does hyperthreading affect single thread performance? for example: if i'm running a single thread program, (program 1) on core 1 using 100% of it and then i get another program (program 2) running on that cores hyperthread at 100% load. does this mean now that program 1 is only running half as fast because it's splitting the CPU horsepower with program 2? or would it be running just as fast as if it were running on it's own different core? tell me what you think. hopefully IntelEnthusiast can help me out with this one and explain it to me. thanks guys, it's been bothering my forever.
a b à CPUs
January 13, 2013 4:04:09 AM

http://en.wikipedia.org/wiki/Hyper_threading
For each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible. The main function of hyper-threading is to decrease the number of dependent instructions on the pipeline. It takes advantage of superscalar architecture (multiple instructions operating on separate data in parallel). They appear to the OS as two processors, thus the OS can schedule two processes at once. In addition two or more processes can use the same resources. If one process fails then the resources can be readily re-allocated.

Hyper-threading works by duplicating certain sections of the processor—those that store the architectural state—but not duplicating the main execution resources. This allows a hyper-threading processor to appear as the usual "physical" processor and an extra "logical" processor to the host operating system (legacy operating systems see two "physical" processors), allowing the operating system to schedule two threads or processes simultaneously and appropriately. When execution resources would not be used by the current task in a processor without hyper-threading, and especially when the processor is stalled, a hyper-threading equipped processor can use those execution resources to execute another scheduled task. (The processor may stall due to a cache miss, branch misprediction, or data dependency.)
This technology is transparent to operating systems and programs. The minimum that is required to take advantage of hyper-threading is symmetric multiprocessing (SMP) support in the operating system, as the logical processors appear as standard separate processors.

m
0
l
January 13, 2013 4:15:08 AM

nice answer from groundrat, thanks :) 
m
0
l
Related resources
a b à CPUs
January 13, 2013 6:03:21 AM

awesome. thanks. but, to keep it nice and simple, if i'm playing a single threaded game that's maxing out 1 thread on the core, would any other load from background tasks slow down my game? say the second thread is at 5% load. that means the game is really only getting 95% and the other background program is getting 5%. am i correct?
m
0
l

Best solution

a b à CPUs
January 13, 2013 6:44:03 AM

The answer is "it depends". HT abstracts your single physical core as two independent cores, this is to allow usage of unused resources inside a CPU. A CPU's resources isn't percentage based, there is no such thing as 20/50/100 "percent" usage, we only use that term due to how easy it is to understand. 1 SB core has three ALU's that do integer math which happens to be the vast majority of a CPU's workload. x86 ISA is a very serial ISA, mechanically it's hard to execute more then one instruction at a time inside code, hence a special vector co-processor exists within the CPU (SSE/AVX) to handle vector instructions. Knowing this you can see the problem, having 3 ALU's worth of processor resources to handle one x86 stream isn't very efficient, that stream is unlikely to ever utilize more then one of them, branch-prediction and super scalar preprocessing enables the CPU to attempt to utilize the other two ALU's to do work. HT is a more direct method allowing a second x86 instruction steam to execute on unused ALU's.

So could HT slow down single threaded processing? Theoretically possible yet highly unlikely. You would have to be running some incredibly efficient code to actually utilize all of a processor's resources.
Share
a b à CPUs
January 13, 2013 6:50:25 AM

Okay. I got it now. Thanks for clearing it up. Now I can sleep at night and think about something else in the shower. :lol:  :D 
m
0
l
a b à CPUs
January 13, 2013 6:50:36 AM

Best answer selected by marshal11.
m
0
l
!