0

I have been learning for an exam and try to understand hyperthreading.

Lets suppose we have a physical core with hyperthreading, Thread A and B. Let's also suppose thread A has fully occupied the physical core. Is there a chance to switch to Thread B duo to HT and if so can that have an bad impact at Thread A or B besides the case they want to use the same recourse.

I know, that if both want to use the same recourse like same ALU, one of then has to wait for the other, but is there another scenario where HT is nonsense because of having fully occupied the physical core.

The reason why we use HT in the first place is that the physical core is in some use cases not fully occupied, thus not efficiently used

Thanks in advance

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • 1
    Right, HT doesn't help for code that literally never stalls and can sustain the max front-end bandwidth of 4 to 6 instructions per clock cycle. (And in practice, competition for L1d and L2 cache can lead to slowdowns even in real-world code, especially high-performance computing. Also some algorithms that don't scale perfectly to more threads.) But "switch to" is the wrong description: both logical cores are running at once, alternating in the front-end but with uops in flight in the back-end from both logical cores. – Peter Cordes Jul 27 '23 at 18:30
  • https://www.phoronix.com/review/amd-epyc-9754-smt benchmarked SMT enabled vs. disabled for various workloads on AMD EPYC 9754 "Bergamo" (128 physical Zen4c cores; versions of the cores with smaller caches for higher density.) – Peter Cordes Jul 27 '23 at 18:34
  • Also related: [Does the running of a second thread on an hyperthreaded CPU introduce extra overhead throughout the pipeline?](https://stackoverflow.com/q/57872223) – Peter Cordes Jul 27 '23 at 20:27

0 Answers0