do I get half the CPU speed for a single thread if HT is turned on?

1

If I have a single 2.6GHz core for example would it mean that with hyperthreading I have only 1.3GHz for a single thread that my app have or is it on demand only if I will use (lets say my app is the only thing that runs on the computer... for the sake of the case no os runs)

single thread single core no HT: thread runs on 2.6GHz single thread single core with HT: thread runs on 1.3GHz?

if its not half the speed assuming I have only a single thread running how much degradation is it with HT on? 10%? else?

Jas

Posted 2014-09-09T16:00:39.267

Reputation: 580

Question was closed 2014-09-17T08:24:27.207

2No; All Hyperthreading is the ability for a single core to handle two seperate threads at once. Please do some more research on the subject before asking any follow up questions. – Ramhound – 2014-09-09T16:16:08.860

Answers

1

No, it does not mean that. Every task can run on a single thread at full core speed. When one of these gets blocked (e.g. while waiting for relative slow IO from the main memory) another thread can run at the full core speed.

Note that with a single core, dual thread setup you can only use some of the resources in one thread at the same time. E.g. if you have two threads wanting to run and both need to read data from main memory then only one thread can do that. The other will have to wait. If you have two threads and one is doing something purely on-die (e.g. using the ALU) while the other is reading from main memory then both can run at the same time.

Think of it as having a shop with two employees but only one cash register. If both need to access the cash register then one will have to wait (do nothing). Or with luck only one needs to access the cash register and the other is busy talking to the next customer while the first person operates the register. (Thus doing two things simultaneously).

if it is not half the speed assuming I have only a single thread running how much degradation is it with HT on? 10%? else?

It depends on per program. The worst live case I heard is a 30% total slowdown*2 (as in actually slower with HT turned on). The best theoretical case is nearly a 100% gain. In practice, it seems to average about 30% speed gain over using no HT.


*2: The 30% slowdown was in actual production code of a web spider. But worse things are possible. E.g. a database only allowed two threads on a 2 core, 4 thread CPU and a scheduler who schedules both threads persistently on the same physical core.

10-09-2014: Added two links with relevant information:
Wikipedia's: Hyper-threading
Wikipedia: Simultaneous multithreading

Hennes

Posted 2014-09-09T16:00:39.267

Reputation: 60 739

I get that you're trying to simplify things, but simplifications that actually include false statements are, IMO, not acceptable. For example, the toll booth analogy implies strongly that either one thread or the other makes forward progress, which is untrue. The two threads use different execution units in the core, so both make progress at the same time. – David Schwartz – 2014-09-09T16:25:38.613

True. I should come up with a better analogy. Thinks Maybe the first person counting money (e.g. using an ALU) while the second person is busy with a second car. Still not great though. Maybe I should either scratch that part or significantly expand it. – Hennes – 2014-09-09T16:30:06.257

Maybe a shop with two employees but only one cash register? – David Schwartz – 2014-09-09T16:32:22.393

3

No, clock speeds just don't work that way. The execution units in the core run at the same speed regardless of which thread they're operating on behalf of or whether the physical core has HT enabled or disabled.

David Schwartz

Posted 2014-09-09T16:00:39.267

Reputation: 58 310