in reply to Re: Split process->check ->and run Parallel
in thread Split process->check ->and run Parallel

checking for the existence of file 'output.txt' independently by the parent process may not be the right idea and there is no guarantee that it is generated by the child process.

There is a possibility that once p1 forks p2 and execs that; p2 can be signaled to terminate and any other process p3 can create a dummy file 'output.txt'; in this case, p1 will assume that everything ran well and output.txt is available.

Also, there is one more problem with this approach - lets say output.txt is properly generated by child process p2 and 'if its in the process of being generated' ( file size being 1 GB ) - the moment parent process 'p1' sees the file it will assume its a successful completion and continue with its work and there is no guarantee that p2 will run to completion in creating the full file of size 1 GB ( this is just an example )

so, its better that the child process signal the parent process after completion of its work or chunk of its work as per the requirements.
  • Comment on Re^2: Split process->check ->and run Parallel