Skip to content

[processes] init should adopt orphans #22

Description

@ZackyGameDev

Most latest addition as of writing this has been the wait() syscall. It allows for a parent to reap the child from the Process Table. Clearing the child process from memory and freeing up space it was occupying in the process table.

However if the parent process terminates before reaping the child by wait(), it causes the child to become un-reapable. Since according to our design, only the parent of the process can reap the child. So if parent is no more, there is no process that can reap the process. It becomes an orphan process. This can cause a memory leak where orphans can fill up the process table leaving no space for new processes to spawn.

Common standard solution in Linux and other standard operating systems is for the orphan process to be reparented, and made the child of the init process (the user process that runs first in the OS). Where the init process is continually calling wait() syscall in an infinite loop, reaping any children that terminate.

The same feature needs to be implemented to the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions