in reply to Re^2: Howto capture array/hash back after threaded process
in thread Howto capture array/hash back after threaded process

Those number of CPU we have is the one shown through this command right? $ cat /proc/cpuinfo

I don't use *nix, so you'll need get a response from one of the many here that do.

What happen if the number of process to be threaded is greater than the number of CPU we have?

If you have (say) 2 cpus and 3 cpu-bound functions running in threads, then they will complete more quickly, than running the same 3 functions one after the other as a single threaded process.

It may be quicker overall to only run two threads as the same time to avoid excessive task switching, but that it a fine tuning thing best left for when you see what performance you achieve doing the simple thing.

Will they be evenly distributed?

That is actually quite hard to answer accurately without knowing what the processes are doing; what else is running on the system; etc., but in most cases the answer will be: Yes.

Still can we benefit from the speedup?

Again, if you described what these threads will be doing you will get a more accurate and definitive answer, but under most OSs and circumstances: Yes.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.