1
votes

Since single CPU could only execute one instruction at a time. Basically, what Multi-threaded CPU does is switch back and forth between multiple threads within single core. Since single-threaded & singl-core CPU could do multitasking by context switch between processes, why does Multi-threaded CPU matter?

1
This question is not appropriate for SO. HT is just a next-level ILP -- instead of extracting parallelism between instructions from a single thread, it's between multiple threads. - Cory Nelson
Why does Burger King hire more than one cashier during peak times? Couldn't you just have one cashier running from register to register? - David Schwartz
First, superscalar processors can execute multiple instructions in parallel. Second, even in a scalar processor, a single thread of execution will experience stalls from hazards. Third, software context switches are much slower than the hardware equivalent, so tend only to be used for the very long stalls associated with I/O. - Paul A. Clayton

1 Answers

1
votes

You're mixing up quite a few things here ... First of all : hardware-threads have next to nothing in common with software-threads. As far as i know, there can only be n hardware-threads on a CPU whereas n is the amount of real or virtual CPU-cores (an ALU, for example)

Context switching is done to allow the illusion of parallelism on one single core. Now : since there are no CPUs without several cores anymore, every CPU supports MT which effectively enables somewhat real parallelism - multiple calculations can be done at the same time yet the result has to be pipelined.

Modern CPUs even simulate additional cores - thats possible because there is a time-gap between result-delivery and command-dispatch, AFAIR - this can be used for additional calculations ... thats called hyperthreading and can boost your performance a bit.