Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have 8 CPUs and I want to maximize it. If I use forks, it doesn't seem to use the other CPUs. But if I use 8 programs, then the CPUs are all being used.

So, my question is why can't fork use the other CPUs? Because I would like to use only one program to controls all the sub-processes.

Replies are listed 'Best First'.
Re: Maximum all CPU usage
by BrowserUk (Patriarch) on Sep 03, 2010 at 00:12 UTC
    why can't fork use the other CPUs?

    It can and does. If your code isn't, it is a limitation of your program; or perhaps your environment (affinity). If you show us the code, you'll probably get an explanation.

Re: Maximum all CPU usage
by Marshall (Canon) on Sep 02, 2010 at 23:36 UTC
    what kind of O/S and Perl version are you using? This should work even with threads. Is there some short section of code that you could show that demo's the problem.
Re: Maximum all CPU usage
by Anonymous Monk on Sep 03, 2010 at 00:03 UTC
    I'm using Ubuntu 10.04 and Perl 5.10.1.