Results 1 to 2 of 2
Hi, please see the attachment for the program. sig_prg.JPG When i execute kill -2 <pid of sig> from the shell of another terminal the below message is printed "signal caught ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-07-2012 #1
- Join Date
- Dec 2011
Behaviour of the signal in linux
please see the attachment for the program.sig_prg.JPG
When i execute kill -2 <pid of sig> from the shell of another terminal the below message is printed
"signal caught with signum (%2): from process < pid of shell>"
When i press CTRL + C on the terminal where the sig is running the below message is printed
signal caught with signum (%2): from process 0
I read that signal are sent by the currently running process.
So in the second case was the swapper running at the time when we pressed CTRL + C OR
The signals are always handled by the swapper when we press CTRL + C on the same terminal where the program is running.
- 09-07-2012 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
The CTRL+C key press is caught by the kernel, which then signals the process. In such a case, it would be PID 0 (kernel). In the case where you send the signal from another process, the signal is handled by the kernel differently, and the pid of the requesting / sending task is inserted by the kernel into the info data.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!