S
Stuart Kendrick
has anyone developed any tricks for spawning lots of threads?
i'm using perl 5.8.5, making use of threads ... i'd like to spawn
several hundred at a time (i've written them to go off and perform
tasks which take a long time ... like perform nessus scans of every
active IP address on a subnet ... )
more often than not, the master thread crumps with a Segmentation
Fault, after spawning ... a few dozen. rather unpredictable, actually
-- sometimes, the whole routine succeeds, spawning several hundred
threads and running them just fine. sometimes, it crumps after
spawning a few ... sometimes after spawning a few dozen ... i don't
see a rhythym yet to the behavior.
i've found that inserting a delay ("sleep 10;" for example) between
spawning events generally increases the number of threads i can launch
before the Segementation Fault occurs. has anyone developed any other
tricks? i realize that threading is new in Perl ... but i find it so
useful, that i'm using it already, despite this wart, in a variety of
applications.
#!/usr/bin/perl
use strict;
use warnings;
use threads;
use threads::shared;
use Thread::Running qw(running);
[...]
--sk
stuart kendrick
fhcrc
i'm using perl 5.8.5, making use of threads ... i'd like to spawn
several hundred at a time (i've written them to go off and perform
tasks which take a long time ... like perform nessus scans of every
active IP address on a subnet ... )
more often than not, the master thread crumps with a Segmentation
Fault, after spawning ... a few dozen. rather unpredictable, actually
-- sometimes, the whole routine succeeds, spawning several hundred
threads and running them just fine. sometimes, it crumps after
spawning a few ... sometimes after spawning a few dozen ... i don't
see a rhythym yet to the behavior.
i've found that inserting a delay ("sleep 10;" for example) between
spawning events generally increases the number of threads i can launch
before the Segementation Fault occurs. has anyone developed any other
tricks? i realize that threading is new in Perl ... but i find it so
useful, that i'm using it already, despite this wart, in a variety of
applications.
#!/usr/bin/perl
use strict;
use warnings;
use threads;
use threads::shared;
use Thread::Running qw(running);
[...]
--sk
stuart kendrick
fhcrc