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.
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
initprocess (the user process that runs first in the OS). Where theinitprocess is continually callingwait()syscall in an infinite loop, reaping any children that terminate.The same feature needs to be implemented to the project.