I am trying to help a user at AskUbuntu with the following question,
I am running a process in bash with
&appended i.e in background mode. The process has a
while(1)i.e it will run forever. My bash is parent and my process becomes the child. I want to learn how Kernel handles the child when parent is terminated.
- If I exit the terminal (using
exitcommand from the terminal),
/lib/systemd/systemd --userbecomes the parent process of the child
- If I kill the terminal process (using
kill) from another terminal, same result as above
- If I close the terminal using cross icon, child process gets terminated too
How is closing different from killing/exiting?
I have written an answer, but feel that I do not really understand what is happening, and I think that several of you who help here at Unix & Linux know better than I and can explain what is happening.
So please help us understand, by chipping in and write an answer (replacing my attempt at AskUbuntu).