# runs smoothly use threads; use strict; my @pool = map { threads->create(\&mysub) } 1 .. 50; $_->join for (@pool); sub mysub { print "spawned " . threads->tid . "\n"; for (1 .. 100) { `sleep 1`; } } __END__ # after the first threads have been spawned, it starts slowing down use threads; use strict; my @pool = map { threads->create(\&mysub) } 1 .. 50; $_->join for (@pool); sub mysub { print "spawned " . threads->tid . "\n"; for (1 .. 100) { `sleep 0.0001`; } } __END__