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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.