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
//this will store the output to the file 'processes'
//parse from the file whatever u need.