Some interesting questions

Hello All,

I have some questions;

1) process1 | process2,

A)now if I kill process2 what happens to process1?
B) if I kill process1 what happens to process2?

2) Why kill -9 is a strong kill? If possible I would like to know what happens internally.

3) What a pipe actually do, in terms of file descriptor?

Any help, any links is appreciated.

Thank you

You might want to look at the rules and note number 6.

Then post what these questions have to do in real life situation you are facing.

RTM,

Thank you for your reply. I am aware of the fact that "No homework/classwork questions". I am writing some IPC code, and I am facing some difficulties. For example, for my 1st question , i am confused about, when I kill process2, process1 remains there, and when I kill process1, process2 remains there 9isnt this weird??), and thats why i posted the question in a simple manner. Also for rest of th questions, same thing, I know that, stromg kill is called as strong coz, it cannot be caught by the process, and in turn process gets terminated, but I wanted to find what actually happens "internally".

I hope i have cleared that those are not homework/classwork questions.

Thank you

For some of this, it's not clear what you want. For many signals, the default action is to terminate the process. This means the kernel kills it pretty much as if the process had called exit(). Some signals can be "caught". This means that a function runs instead. Well behaved processes catch signals and clean up temp files, release resources, etc. But a process cannot catch 9. 9 will instantly kill a process (if it's killable).

A pipe, you write data on one side and read the data from the other side. What else do you want here?

process1 | process2
Kill either process and nothing at all happens to the other process. However the pipe is broken. If process1 dies, the next time that process2 tries a read from the pipe, it will get eof. Many programs will decide to exit at this point. If process2 dies, process1 will get a SIGPIPE on the next write. The default action for SIGPIPE is exit. But a program can catch or ignore the signal. Both mechanisms depend on data flowing across the pipe.