use strict;
use warnings;
use POSIX ":sys_wait_h";
our @IP = &getAllHostIP();
our $TOTAL_TASK = @IP; # assume we have 300 hosts
our $MAX_LIVE_PROC = 24; # Maximum number of subProcess allowed to co-exist
our @result_filename = ();
our $zombies = 0;
$SIG{CHLD} = sub { $zombies++ }; # handle message from kernel
our $handled_task = 1;
our $cur_live_proc = 1;
my $pid = fork();
unless ($pid) {
my $filename = &getUniqueFilename();
push @result_filename, $filename;
system "./checkHost $IP[$handled_task-1] $uid $psw $filename";
exit 0;
}
while ($cur_live_proc>0) {
if ($zombies>0) {
$zombies=0;
文章来源于领测软件测试网 https://www.ltesting.net/