Whenever we open a terminal, kernel creates a process(bash-terminal using fork+exec) and it's parent process is "init". But this "mate-terminal" becomes parent and creates another process "terminal" which is visualised by user.
Just wanted to know what sort of file descriptors,memory etc are shared between the "init"(pid=1,ppid=0), "mate-terminal"(pid=200 and ppid=1) and "terminal"(pid=201 and ppid=200).
I know about the process stack and which segments are shared but unable to clearly visualise in this practical scenario.
Please help me in understanding the memory sematics of the process..
Any help is welcome..
Nothing is shared between init and its terminal children, nor between the first terminal and its terminal child.
This is because, although fork() will make both processes (father and child) to share some objects, exec() family functions completely replaces the current process image with a new process image.
This means that all references to previous objects, such as shared file descriptors from the father, are forgotten.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With