Learning about what orphans are
Understanding what orphans are in a Linux system is just as crucial as understanding zombies. This will give you a deeper understanding of the entire system and how processes get inherited by
An orphan is a child whose parent has died. However, as we have learned in this chapter, every process needs a parent process. So, even orphans need a parent process. To solve this dilemma, every orphan gets inherited by
systemd, which is the first process on the system—PID
In this recipe, we'll write a small program that forks, thus creating a child process. The parent process will then exit, leaving the child as an orphan.
Everything you need for this recipe is listed in the Technical requirements section of this chapter.
How to do it…
In this recipe, we will write a short program that creates an orphan process that will be inherited by
systemd. Let's get started:
- Write the following code...