[Trilug-ontopic] perl and threads
gwbrown1 at gmail.com
Sun Mar 13 19:22:18 EDT 2011
I don't know if anyone cares but I tried both examples using time to see how
much, well, time both took to run and these are the results (again I don't
think this says much, and I'm not sure what it does say if anything, but I
found it interesting all the same):
On Sun, Mar 13, 2011 at 5:33 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
> I found a good example using both threads and forks to accomplish a basic
> script that I thought I'd pass along.
> On Fri, Mar 11, 2011 at 12:11 PM, Michael Peters <mpeters at plusthree.com>wrote:
>> On 03/11/2011 10:00 AM, Brian Weaver wrote:
>> I don't know about using threads, but if you want multiple instances with
>>> each working on a single device then why not use a master-child process
>>> model? Have the master fork off N children and maintain a link using
>>> anonymous pipes, unix sockets, or some other IPC mechanism. The master can
>>> inform each child on what system to query and then receive a status back
>>> from the child when it's done.
>> I agree that you should use processes instead of threads. Threads are ok
>> in Perl but processes are better and since processes are COW in Linux you
>> end up having about the same amount of overhead.
>> But instead of writing your own from scratch, I'd look to CPAN (Perl's
>> biggest weapon) to find something to handle all of the gory bits for you. I
>> like Parallel::ForkManager
>> Michael Peters
>> Plus Three, LP
>> Trilug-ontopic mailing list
>> Trilug-ontopic at trilug.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Trilug-ontopic