[Trilug-ontopic] perl and threads

Greg Brown gwbrown1 at gmail.com
Tue Mar 15 16:11:06 EDT 2011

Thanks everyone!  I got my script to work and thanks to
Parallel::ThreadManager I am able to easily control the max number of
threads, etc.

TriLug rocks!


On Sun, Mar 13, 2011 at 7:22 PM, Greg Brown <gwbrown1 at gmail.com> wrote:

> 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):
> Forks:
> real 0m10.011s
> user 0m0.007s
> sys 0m0.011s
> Threads:
> real 0m10.024s
> user 0m0.022s
> sys 0m0.008s
> 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.
>> https://wiki.bc.net/atl-conf/pages/viewpage.action?pageId=20548191
>> Greg
>> 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
>>> http://www.trilug.org/mailman/listinfo/trilug-ontopic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.trilug.org/pipermail/trilug-ontopic/attachments/20110315/1f3bab2e/attachment.htm>

More information about the Trilug-ontopic mailing list