Fork rule #7

All of this neatly brings us to our next rule of fork.

Fork rule #7: The parent process must wait (block) upon the termination (death) of every child, directly or indirectly.

The fact is that, just like the malloc-free, the fork-wait go together. There will be situations in real-world projects where it might look impossible for us to force the parent process to block on the wait after the fork; we shall address how these seemingly difficult situations can be easily addressed (that's why we refer to an indirect method as well; hint: it's to do with signaling, the topic of the next chapter).

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.