The init-system for Linux went through several iterations. The article Initializing and Managing Services in Linux: Past, Present and Future explains it quite well.

In this example we'll see how can we see the process ID and parent process ID of a forked process in Perl, and what happens if the parent process exits before the forked process.