Antwort: RE: fork didn't work
Hi, just a little search at search.cpan.org helps http://cpan.uwinnipeg.ca/module/Proc::Background::Win32 Best regards Manfred Beilfuss "Jutu Subramanian, Srinivasan (Cognizant)" An: "Roger Keane" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Gesendet von: Kopie: [EMAIL PROTECTED]Thema: RE: fork didn't work eState.com 03.11.2004 08:24 Hi, Thanks for your information. Can I have sample code and where to get the ppd to install the Proc::background perl modules If you know, Kindly tell me. regards Srinivas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Roger Keane Sent: Tuesday, November 02, 2004 9:08 PM To: [EMAIL PROTECTED] Subject: Re: fork didn't work Jutu Subramanian, Srinivasan (Cognizant) wrote: > > Hi, > I need to execute a perl application from one perl application. > I should do with fork and exec. The execution of another one perl application is the independent > to the parent process.So, I don't want to use wind32::CreateProcess. Using fork() in Perl on Windows means using threads. If you are creating another process anyway, use system() or Proc::Background. You should create new background processes with fork() on Unix platforms. You should create new background processes with Win32::CreateProcess() on Windows platforms. Proc::Background does that for you. > If I use the fork and exec, Need to do the process of Reaping dead children. Proc::Background is able to reap finished child process. Proc::Background is able to return the status of the finished child process. Proc::Background is able to wait for child process to finish. Proc::Background is able to kill the child process. Proc::Background is able to check that the child process is still alive. > >This method is also wait for the forked process to complete its work. So, the next parent > process continues only after the child process exits. > It overcomes the fork limitation of compiled in limit of 64 active threads. > > The output for the sample code is given below. > PARENT PROCESS=1 > filter.pl called with parameter 1 > PARENT PROCESS=2 > filter.pl called with parameter 2 > PARENT PROCESS=3 > filter.pl called with parameter 3 > > Actually, Firt perl program(parent) is not to wait for the another perl program(child) completes. > Parent process keeps on running 24 hours. So, Child process getting accumulated in the process table. > If we harvesting the dead children by the method of Reaping dead children, We would be getting the > result as mentioned above. It is similar to the usage of wait at the parent process. Is it comfortable > to use the reaping dead children. Kindly advice me on this and revert back for any clarifications. Proc::Background allows you to create and manage multiple background processes concurrently. If you do not need to manage multiple background processes concurrently, use system(). If you only need to manage multiple background processes concurrently on Windows and want to learn more about the Win32 API use Win32::CreateProcess. If you need your code to run on both Unix and Win32 systems, use Proc::Background. If you do not want to learn about the Win32 API, or want a simpler API than Win32::CreateProcess, use Proc::Background. > regards > Srinivas > hope that helps, rgr ___ Perl-Win32-Users mailing list [
RE: fork didn't work
Hi, Thanks for your information. Can I have sample code and where to get the ppd to install the Proc::background perl modules If you know, Kindly tell me. regards Srinivas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Roger Keane Sent: Tuesday, November 02, 2004 9:08 PM To: [EMAIL PROTECTED] Subject: Re: fork didn't work Jutu Subramanian, Srinivasan (Cognizant) wrote: > > Hi, > I need to execute a perl application from one perl application. > I should do with fork and exec. The execution of another one perl application is > the independent > to the parent process.So, I don't want to use wind32::CreateProcess. Using fork() in Perl on Windows means using threads. If you are creating another process anyway, use system() or Proc::Background. You should create new background processes with fork() on Unix platforms. You should create new background processes with Win32::CreateProcess() on Windows platforms. Proc::Background does that for you. > If I use the fork and exec, Need to do the process of Reaping dead children. Proc::Background is able to reap finished child process. Proc::Background is able to return the status of the finished child process. Proc::Background is able to wait for child process to finish. Proc::Background is able to kill the child process. Proc::Background is able to check that the child process is still alive. > >This method is also wait for the forked process to complete its work. > So, the next parent > process continues only after the child process exits. > It overcomes the fork limitation of compiled in limit of 64 active threads. > > The output for the sample code is given below. > PARENT PROCESS=1 > filter.pl called with parameter 1 > PARENT PROCESS=2 > filter.pl called with parameter 2 > PARENT PROCESS=3 > filter.pl called with parameter 3 > > Actually, Firt perl program(parent) is not to wait for the another perl > program(child) completes. > Parent process keeps on running 24 hours. So, Child process getting accumulated in > the process table. > If we harvesting the dead children by the method of Reaping dead children, We would > be getting the > result as mentioned above. It is similar to the usage of wait at the parent > process. Is it comfortable > to use the reaping dead children. Kindly advice me on this and revert back for any > clarifications. Proc::Background allows you to create and manage multiple background processes concurrently. If you do not need to manage multiple background processes concurrently, use system(). If you only need to manage multiple background processes concurrently on Windows and want to learn more about the Win32 API use Win32::CreateProcess. If you need your code to run on both Unix and Win32 systems, use Proc::Background. If you do not want to learn about the Win32 API, or want a simpler API than Win32::CreateProcess, use Proc::Background. > regards > Srinivas > hope that helps, rgr ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: fork didn't work
Jutu Subramanian, Srinivasan (Cognizant) wrote: > > Hi, > I need to execute a perl application from one perl application. > I should do with fork and exec. The execution of another one perl application is the independent > to the parent process.So, I don't want to use wind32::CreateProcess. Using fork() in Perl on Windows means using threads. If you are creating another process anyway, use system() or Proc::Background. You should create new background processes with fork() on Unix platforms. You should create new background processes with Win32::CreateProcess() on Windows platforms. Proc::Background does that for you. > If I use the fork and exec, Need to do the process of Reaping dead children. Proc::Background is able to reap finished child process. Proc::Background is able to return the status of the finished child process. Proc::Background is able to wait for child process to finish. Proc::Background is able to kill the child process. Proc::Background is able to check that the child process is still alive. > >This method is also wait for the forked process to complete its work. So, the next parent > process continues only after the child process exits. > It overcomes the fork limitation of compiled in limit of 64 active threads. > > The output for the sample code is given below. > PARENT PROCESS=1 > filter.pl called with parameter 1 > PARENT PROCESS=2 > filter.pl called with parameter 2 > PARENT PROCESS=3 > filter.pl called with parameter 3 > > Actually, Firt perl program(parent) is not to wait for the another perl program(child) completes. > Parent process keeps on running 24 hours. So, Child process getting accumulated in the process table. > If we harvesting the dead children by the method of Reaping dead children, We would be getting the > result as mentioned above. It is similar to the usage of wait at the parent process. Is it comfortable > to use the reaping dead children. Kindly advice me on this and revert back for any clarifications. Proc::Background allows you to create and manage multiple background processes concurrently. If you do not need to manage multiple background processes concurrently, use system(). If you only need to manage multiple background processes concurrently on Windows and want to learn more about the Win32 API use Win32::CreateProcess. If you need your code to run on both Unix and Win32 systems, use Proc::Background. If you do not want to learn about the Win32 API, or want a simpler API than Win32::CreateProcess, use Proc::Background. > regards > Srinivas > hope that helps, rgr ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: fork didn't work
Hi, I need to execute a perl application from one perl application. I should do with fork and exec. The execution of another one perl application is the independent to the parent process.So, I don't want to use wind32::CreateProcess. If I use the fork and exec, Need to do the process of Reaping dead children. This method is also wait for the forked process to complete its work. So, the next parent process continues only after the child process exits. It overcomes the fork limitation of compiled in limit of 64 active threads. The output for the sample code is given below. PARENT PROCESS=1 filter.pl called with parameter 1 PARENT PROCESS=2 filter.pl called with parameter 2 PARENT PROCESS=3 filter.pl called with parameter 3 Actually, Firt perl program(parent) is not to wait for the another perl program(child) completes. Parent process keeps on running 24 hours. So, Child process getting accumulated in the process table. If we harvesting the dead children by the method of Reaping dead children, We would be getting the result as mentioned above. It is similar to the usage of wait at the parent process. Is it comfortable to use the reaping dead children. Kindly advice me on this and revert back for any clarifications. regards Srinivas -Original Message- From: Roger Keane [mailto:[EMAIL PROTECTED] Sent: Friday, October 29, 2004 11:47 PM To: Jutu Subramanian, Srinivasan (Cognizant) Subject: Re: fork didn't work Jutu Subramanian, Srinivasan (Cognizant) wrote: > Hai, > > The following code having, compiled in limit of 64 active threads. > I need to modify the following code as not caring about the exit status of dead > children with $SIG{CHLD}. > However, do check the status of the dead children and log any that exited > abnormally and I need to run > more than the compiled limit of 64 active threads. Any idea how to modify the code? > Yes - do not use fork(). Use the Proc::Background module: http://search.cpan.org/~bzajac/Proc-Background-1.08/ which provides a nice platform independent wrapper around Win32::CreateProcess (and fork) and does everything you need. rgr This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: fork didn't work
Hai, The following code having, compiled in limit of 64 active threads. I need to modify the following code as not caring about the exit status of dead children with $SIG{CHLD}. However, do check the status of the dead children and log any that exited abnormally and I need to run more than the compiled limit of 64 active threads. Any idea how to modify the code? regards Srinivasan.JS VNET:46609 start code sub execFile { #Argument as Log file with location my($logfile)[EMAIL PROTECTED]; #child process is created with fork. my $newpid = fork(); #If the fork not successfull if ( not defined $newpid ) { # if return value of fork() is undef, something went wrong &Logger::logEvent("fork didn't work: $!"); die "fork didn't work: $!\n"; } elsif ( $newpid == 0 ) { # if return value is 0, this is the child process &Logger::logEvent("Executing the filter.pl file"); exec "perl.exe D:/called.pl"; } }#end of execFile end code -Original Message- From: Michael G. Jung [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 6:33 PM To: Jutu Subramanian, Srinivasan (Cognizant) Subject: RE: fork didn't work I'm not a Win32 expert so I haven't copied the list. Have you though tried setting the CREATE_NEW_PROCESS_GROUP flag? I believe this will make your spawned process independent of the parent process - in that if the parent dies the child will still run. Good luck. --mikej > -Original Message- > From: Jutu Subramanian, Srinivasan (Cognizant) > [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 27, 2004 8:26 AM > To: Michael G. Jung; [EMAIL PROTECTED] > Subject: RE: fork didn't work > > > > Hi., > If I try with fork, Eventhough parent process is not there, > Child process is created and child process runs the secondary > application. I hope It is not possible instead of fork using > Win32::Process::Create. Create makes the another process and > it is dead when the parent process dead. Is there any other > way to handle the child process should be running though > parent is dead. Thanks in advance. > > regards > Srinivas > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Michael Jung > Sent: Tuesday, October 26, 2004 5:47 PM > To: [EMAIL PROTECTED] > Subject: RE: fork didn't work > > > I understand that each fork under activestate runs as a thread and I > understnat that there is a compiled in limit of 64 active threads. > > Why don't you use Win32::Process::Create instead or fork? > > Hope this helps. > > --mikej > Michael Jung > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of > Jutu Subramanian, Srinivasan (Cognizant) > Sent: Tuesday, October 26, 2004 7:56 AM > To: [EMAIL PROTECTED] > Subject: fork didn't work > > > Hi , > > If I execute the following program, It executes fine till the loop 64. > fork didn't work at the 65th loop and exit. > Error thrown: fork didn't work: 65=Resource temporarily unavailable > Perl version : 5.6 > OS: windows 2000 SP4 > May I know the reason and how to handle this? > > > start > program- > use Win32::Process; > use Cwd; > for(my $i=1;$i<=100;$i++) > { > &execFile("$i"); > } > sub execFile > { > my $FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl"; > > my($logfile)[EMAIL PROTECTED]; > > #child process is created with fork. > my $newpid = fork(); > > if( $newpid == 0 ) > { > exec "perl.exe $FILTERFILEPATH $logfile"; > } > else > { > print("PARENT PROCESS=$logfile\n"); > } > }#end of execFile > end > program- > > regards > Srinivas > This e-mail and any files transmitted with it are for the > sole use of the > intended recipient(s) and may contain confidential and privileged > information. > If you are not the intended recipient, please contact the > sender by reply > e-mail and destroy all copies of the original message. > Any unauthorized review, use, disclosure, dissemination, forwarding, > printing or copying of this email or any action taken in > reliance on this > e-mail is strictly > prohibited and may be unlawful. > > Visit us at http://www.cognizant.com > > ___ > Perl-Win32-Users mail
RE: fork didn't work
Hi., If I try with fork, Eventhough parent process is not there, Child process is created and child process runs the secondary application. I hope It is not possible instead of fork using Win32::Process::Create. Create makes the another process and it is dead when the parent process dead. Is there any other way to handle the child process should be running though parent is dead. Thanks in advance. regards Srinivas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Michael Jung Sent: Tuesday, October 26, 2004 5:47 PM To: [EMAIL PROTECTED] Subject: RE: fork didn't work I understand that each fork under activestate runs as a thread and I understnat that there is a compiled in limit of 64 active threads. Why don't you use Win32::Process::Create instead or fork? Hope this helps. --mikej Michael Jung -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jutu Subramanian, Srinivasan (Cognizant) Sent: Tuesday, October 26, 2004 7:56 AM To: [EMAIL PROTECTED] Subject: fork didn't work Hi , If I execute the following program, It executes fine till the loop 64. fork didn't work at the 65th loop and exit. Error thrown: fork didn't work: 65=Resource temporarily unavailable Perl version : 5.6 OS: windows 2000 SP4 May I know the reason and how to handle this? start program- use Win32::Process; use Cwd; for(my $i=1;$i<=100;$i++) { &execFile("$i"); } sub execFile { my $FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl"; my($logfile)[EMAIL PROTECTED]; #child process is created with fork. my $newpid = fork(); if( $newpid == 0 ) { exec "perl.exe $FILTERFILEPATH $logfile"; } else { print("PARENT PROCESS=$logfile\n"); } }#end of execFile end program- regards Srinivas This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: fork didn't work
Title: Message If anybody know to sort out the problem for the following exception "run out of memory". It is throwing for the scenario, 1. Whenever my tool call another perl script using fork and exec. 2. Whenever to read the CRC value for the the invalid compressed data to inflate feed file used in the zip file. If it is sortable, Please let me know. ERROR: The instruction at "0x023b1c53" referenced memory at "0x0002". The memory could not be "read". Click on OK to terminate the program Click on CANCEL to debug the program. script :Perl script version 5.6 OS:windows OS 2000 Service pack 4 regards Srinivas -Original Message-From: Michael G. Jung [mailto:[EMAIL PROTECTED]Sent: Tuesday, October 26, 2004 5:45 PMTo: Jutu Subramanian, Srinivasan (Cognizant); [EMAIL PROTECTED]Subject: RE: fork didn't work Each fork under activestate runs as a thread. There is a compiled in limit of 64 active threads. Why don’t you use Win32::Process::Create instead or fork? Hope this helps. --mikejMichael Jung -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jutu Subramanian, Srinivasan (Cognizant)Sent: Tuesday, October 26, 2004 7:56 AMTo: [EMAIL PROTECTED]Subject: fork didn't work Hi , If I execute the following program, It executes fine till the loop 64. fork didn't work at the 65th loop and exit. Error thrown: fork didn't work: 65=Resource temporarily unavailable Perl version : 5.6 OS : windows 2000 SP4 May I know the reason and how to handle this? start program- use Win32::Process;use Cwd;for(my $i=1;$i<=100;$i++){ &execFile("$i");} sub execFile{ my $FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl"; my($logfile)[EMAIL PROTECTED]; #child process is created with fork. my $newpid = fork(); if( $newpid == 0 ) { exec "perl.exe $FILTERFILEPATH $logfile"; } else { print("PARENT PROCESS=$logfile\n"); }}#end of execFileend program- regards Srinivas This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.Visit us at http://www.cognizant.com This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: fork didn't work
I understand that each fork under activestate runs as a thread and I understnat that there is a compiled in limit of 64 active threads. Why dont you use Win32::Process::Create instead or fork? Hope this helps. --mikej Michael Jung -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jutu Subramanian, Srinivasan (Cognizant) Sent: Tuesday, October 26, 2004 7:56 AM To: [EMAIL PROTECTED] Subject: fork didn't work Hi , If I execute the following program, It executes fine till the loop 64. fork didn't work at the 65th loop and exit. Error thrown: fork didn't work: 65=Resource temporarily unavailable Perl version : 5.6 OS: windows 2000 SP4 May I know the reason and how to handle this? start program- use Win32::Process; use Cwd; for(my $i=1;$i<=100;$i++) { &execFile("$i"); } sub execFile { my $FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl"; my($logfile)[EMAIL PROTECTED]; #child process is created with fork. my $newpid = fork(); if( $newpid == 0 ) { exec "perl.exe $FILTERFILEPATH $logfile"; } else { print("PARENT PROCESS=$logfile\n"); } }#end of execFile end program- regards Srinivas This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
fork didn't work
Title: IIS cgi's process ID (B (B (BHi , (B (BIf (BI execute the following program, It executes fine till the loop 64. (Bfork didn't work at the 65th loop and exit. (BError (Bthrown: fork didn't work: 65=Resource temporarily (Bunavailable Perl version : 5.6 (BOS (B: windows 2000 SP4 (BMay I know the (Breason and how to handle this? (B (B (Bstart (Bprogram- use Win32::Process;use Cwd;for(my (B$i=1;$i<=100;$i++){ &execFile("$i");} (Bsub (BexecFile{ my (B$FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl"; (Bmy($logfile)[EMAIL PROTECTED]; #child process is (Bcreated with fork. my $newpid = (Bfork(); if( $newpid == 0 (B) { exec (B"perl.exe $FILTERFILEPATH $logfile"; (B} else (B{ print("PARENT (BPROCESS=$logfile\n"); }}#end of execFileend (Bprogram- (B (Bregards (BSrinivas (B (BThis e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. (BIf you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. (BAny unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly (Bprohibited and may be unlawful. (B (B Visit us at http://www.cognizant.com (B___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs