Reputation: 14970
When a user program is interrupted with ^C, is the default signal handler run in user mode or in kernel mode?
If in kernel mode, which kernel subsystem invokes the default signal handler?
I could not find any reference in docs and manpages of sigaction. I was asked this question in an interview.
Upvotes: 1
Views: 247
Reputation: 206679
User-level code always runs in user mode. Including the signal handlers if they have been set by that process (or its environment - C library setup routines for instance).
If there is no user-mode signal handler registered for given signal, and it is not ignored (or not ignorable/trappable as SIGKILL and SIGSTOP), the actions related to that signal (termination, core dump, suspend, resume) can be carried out entirely kernel side.
The signal delivery is mostly handled by the process scheduler subsystem in the kernel.
Upvotes: 2
Reputation: 72745
I came across this that indicates that the handlers reside and run in user mode. There are some details in slide 8.
Upvotes: 0