Shell/Bash: what causes a defunct process on the linux system and how can you avoid it? Example

By

Shell/Bash Example: This is the "what causes a defunct process on the linux system and how can you avoid it?" Example. compiled from many sources on the internet by SimpleTutorials.org

What causes a defunct process on the Linux system and how can you avoid it?

When you create a process, it sticks around until its parent reaps it. 
(If its parent exits first, it will get auto-reaped.) A process can reap
its children using wait or waitpid. It can also cause it's children to 
be automatically reaped by using local $SIG{CHLD} = 'IGNORE'; before 
creating the child.


* Summary: This "what causes a defunct process on the linux system and how can you avoid it?" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others