Why are threads not constrained to the number of processors available on a system? If I only have 4
processors (cores) soon a system, can I really benefit from having more than 4 threads? Explain please.
When creating a thread using pthread_create, why does the function you pass take void * as its
single argument and return a void *? Why not a char * or int *?
Based on the above Question
A process is divided into many simple tasks called threads which needs to be executed.
A core is a hardware part which can process an instruction. More the number of cores, more instructions can be executed in parallel.
If one core can handle one thread at a time, the no. of threads should be a linear multiple of the no. of cores.
The number of threads to be divided is decided by the OS.
It will allow only appropriate amount of threads to be created
such that wait time for the threads are lesser.
I have tried my
best to resolve it.
If you have any Queries please comment here.
If you like my answer Please Upvote / Like it.
Thank you
Get Answers For Free
Most questions answered within 1 hours.