Roedy Green wrote:
[...]
Hyperthreading is a defence. If you have many hardware threads
running in the same CPU, when one thread blocks to fetch from RAM, the
other threads can keep going and keep multiple adders, instruction
decoders etc chugging.
Actually, hyperthreading and even, in some architectures, multi-core
CPUs can actually make things worse.
I've read claims that Intel has improved things with the Nehalem
architecture. But the shared-cache design of early hyperthreaded
processors could easily cause na?ve multi-threading implementations to
perform _much_ worse than a single-threaded implementation. That's
because having multiple threads all with the same entry point caused
those threads to often operate with a stack layout identical to each
other, which in turned caused aliasing in the cache.
The two threads running simultaneously on the same CPU, sharing a cache,
would spend most of their time alternately trashing the other thread's
cached stack data and waiting for their own stack data to be brought
back in to the cache from system RAM after the other thread trashed it.
Hyperthreading is far from a panacea, and I would not call it even a
defense. Specifically _because_ of how caching is so critical to
performance today, hyperthreading can cause huge performance problems on
certain CPUs, and even when it's used properly doesn't produce nearly as
big a benefit as actual multiple CPU cores would.
SMT capability is obviously not as fast as full cores.
thing.