On Thu, 17 Feb 2005, Eduardo Vázquez Rodríguez wrote:

> Is there a possible way of executing a Perl Script so that it uses not 
> only one Solaris Processor?

Distributing work across processors is the OS's job, isn't it?

That said, if you write your code in such a way that the work is 
fragmented -- use threads, use a fork/exec approach, etc -- then you 
increase the liklihood that the operating system will balance the work 
across all available processors. 

However, whether or not this actually happens in practice is entirely up 
to the the host operating system and the behavior of its job scheduling 
subsystem. If it decides that your processes &/or threads are important 
enough, it will balance accordingly, but if there's other activity going 
on on the same machine, it might or might not distribute your load.

It *may* be possible to force load distribution, but it's probably not 
going to be reliable or portable. Poking around on search.cpan.org, I 
don't see anything obviously helpful -- lots of modules for querying the 
state of a running system, but I don't see anything that suggests that 
it could control how the system handles processes or threads. 

If you want this badly enough, Sun may provide APIs that allow such a 
thing from C that could be wrapped into a Perl/XS module, but I don't 
know nearly enough about Solaris (or XS) to help out there. 

But anyway, that's the pessimistic angle. You may be perfectly happy 
with the results if you write your code to use either forking or 
threads, and just accept however the system decides to balance things. 
You may find that this alone gives you all the boost you need, so it's 
certainly worth pursuing. 

 

-- 
Chris Devers
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to