How more than one thread runs on a processor core

I wanted to know how a multi-threaded multiprocessor program executes on the processor core. For example, my program has 12 threads and I am running it on an intel core-i5 machine. It has four processors. Will there be 3 threads in each core? I got confused because I saw programs with 30 threads running on a 4 core computer.

thank

+3


source to share


3 answers


Each core will be able to execute one thread at a time. So if there are 30 threads and 4 cores, 26 threads will wait for the context to switch to execution. Something like, thread 1-4 runs for 200ms and then 5-8 runs for 200ms, etc.



+3


source


The kernel is responsible for looping threads. The more cores you have, the more threads you can run simultaneously. Each core can only execute one command at a time, however its so fast it seems like you are using multiple threads at the same time. Intel Processors

supports Hyper Threading , allowing a single core to support multiple threads by operating system

doubling the number of logical cores per physical core. For example, a Core i3 that is only dual-core can actually serve two threads per core, i.e. A total of four threads can run simultaneously. However, even ifCore i5 processors

are four cores, since they do not support Hyper-Threading (with the exception of the i5-661), the number of threads they can serve simultaneously is approximately equal to their number Core i3

. p>



+6


source


The processor core is capable of executing one thread at a time. A quad core runs 4 threads at the same time. Not all user-space threads run at the same time, kernel threads also run to schedule the next thread or perform some other kernel tasks.

0


source







All Articles