Home > Software design >  Does a process whose parent has died normally continues execution?
Does a process whose parent has died normally continues execution?

Time:10-17

I know that a child process whose parent has died becomes a zombie process but when that happens, does it continue execution normally ?

What I have read so far seems to suggest that yes but I have not found confirmation and my programming ventures seems to suggest otherwise.

CodePudding user response:

Whether a child's parent has exited has no effect on whether it continues running. Assuming the child has access to the resources that it needs, it will continue to run normally.

This is important when writing a daemon, since typically the started process forks twice, and it is the grandchild that ultimately runs as a service.

Note that there are some reasons a child may end up exiting abnormally due to a parent exiting. For example, if the parent is an interactive shell and it exits, the terminal may disappear, and as a result the child may receive a SIGHUP. However, in that case, the reason the child will have exited is because it received a signal it didn't handle, and if it had set up a suitable handler, it would have continued running.

  • Related