How to record the order in which the child processes finish

Reply

Join Date: Sep 2009
Posts: 3
Reputation: magicor is an unknown quantity at this point 
Solved Threads: 0
magicor magicor is offline Offline
Newbie Poster

How to record the order in which the child processes finish

 
-1
  #1
Sep 28th, 2009
In my code, the parent process does not need to wait these children processes. And I need to know which child process finishes first to do rest of the code.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 538
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 86
Murtan Murtan is offline Offline
Posting Pro

Re: How to record the order in which the child processes finish

 
0
  #2
Sep 30th, 2009
If the parent process doesn't have to wait, why does it care who finishes first.

If at least one child process needs to finish, then you have to wait.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 341
Reputation: dkalita will become famous soon enough dkalita will become famous soon enough 
Solved Threads: 49
dkalita's Avatar
dkalita dkalita is offline Offline
Posting Whiz

Re: How to record the order in which the child processes finish

 
0
  #3
Oct 1st, 2009
Originally Posted by magicor View Post
In my code, the parent process does not need to wait these children processes. And I need to know which child process finishes first to do rest of the code.

In the parent process u already have the child process id's.
U can repeatedly use the 'ps' command to ckeck which processes are running. Whenever u get one process missing break the loop and continue. And now u have the process id which just finished.

I dont know how to check the status of the processes in other way (there must be some).
u can do

system("ps>processes");
//this will store the output to the file 'processes'
//parse from the file whatever u need.

Hope thats of some help
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 341
Reputation: dkalita will become famous soon enough dkalita will become famous soon enough 
Solved Threads: 49
dkalita's Avatar
dkalita dkalita is offline Offline
Posting Whiz

Re: How to record the order in which the child processes finish

 
0
  #4
Oct 1st, 2009
also check the manual of the function

waitpid(.......)

type
man waitpid
in linux shell.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC