#!/opt/coolstack/bin/perl use strict; use threads ('yield', 'stack_size' => 64*4096, 'exit' => 'threads_only', 'stringify'); my $nloaders = 64; #--------------------------------------------------------------- my @thrs_loaders; for(1..$nloaders){ print "START LOAD $_ \n"; my ($thr) = threads->create(\&load, $_); push @thrs_loaders ,$thr; } $_->join for @thrs_loaders; print "STOP: " . localtime() . "\n"; exit; #------------------------------------------------------------------------------ sub load{ my $id = shift; my $tmp; for(1..7235617){ int( rand (10)); } print "$id>LOAD EXIT\n"; } #### #------------------------------------------------------------------------------ sub load{ my $id = shift; my $tmp; for(1..7235617){ for(1..100000){ $tmp = $_; } int( rand (10)); } print "$id>LOAD EXIT\n"; }