(Tetedeiench) wrote in message news:< om>...
> Will the hyperthreading cause threads to overlap and cause my thread
> to be slowed down a bit, which will reduce its effectiveness ?
Simple answer: yes. See more details below.
> I was writing a program which is testing the CPU stability. I was
> developing it way before hyperthreading was introduced.
>
> And now that hyperthreading is there and my testing program is almost
> done, I encounter a problem.
>
> I cannot spawn two threads at the same time running my test. My test
> is single-threaded.
>
> As my test runs fine in P4B without hyperthreading ( and every CPU
> before this one), I was wondering :
>
> Does hyperthreading interfere with the execution of one thread ?
The HT feature basically takes advantage of idle time in the P4's
instruction pipeline to execute more than one thread at a time.
However, if the first thread has no idle time in its pipeline, then
the second thread (which automatically has lower priority) will not
get a chance to run. This would be especially true if you're just
copying the same function with no idle time and spawning it in two
threads. The first instance of the function would hog all the CPU
time, and the second will get none. If the first function had some
idle time (such as waiting for some kind of i/o) then the second
function would get a chance to execute. If your function is basically
CPU-bound with little or no i/o, then HT might be a problem for you.
Yousuf Khan