Back in the real world, It seems that you have re-invented the "diruse" program that comes with the Win2k resource kit.
To test if it is worth converting to multi-tasking, you could run multiple copies of your program, or multiple copies of "diruse", and see if it takes less total time than running serially.
Here is a small program to get you started on multi-threading.
use strict; use threads; my @MyThread; my $threadcount = 15; for (0..($threadcount-1)){ $MyThread[$_]=threads->new(\&s,$_,10+$_); }; if ($ARGV[0] eq 'a'){ foreach (@MyThread){ print qq(Return check via thread array from ) . $_->join() . qq(\n +); } }else{ foreach (threads->list()){ print qq(Return check via threads list from ) . $_->join() . qq(\n +); } } ####################### sub s{ my $a=shift; sleep($threadcount-$a); print qq(In sub s param=$a\n); return shift() }
In reply to Re: Getting a script to do 2 process simultaneously.
by NetWallah
in thread Getting a script to do 2 process simultaneously.
by blackadder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |