Reputation: 2244
I am a newbie to linux..
Do the "user space processes" and "kernel space processes(kernel threads)" share the same set of signal. handlers.Just wanted to how kernel sends signals differently depending on the region(user space or kernel space)where the process is running?
Upvotes: 1
Views: 244
Reputation: 88
I think there may be some confusion here. When people say "kernel thread" in the context of UNIX, they generally just mean "thread," not "kernel space process." In the past there were two approaches to threading: libraries that implemented the concept without any assistance from the kernel, which is called user threads; and those that mainly just wrap system calls provided by the kernel specifically for multithreading, called kernel threads. These days mostly people use kernel threads, especially because the POSIX threads standard has been part of the Linux kernel since 2.6.
To answer your question, signals are always addressed to a PID (well, unless you use pthread_kill for inter-thread signaling). With POSIX threads, all the threads of a process share a single PID. But only one thread can actually be interrupted. So each thread has as part of its thread-local storage a signal mask. In practice what you are supposed to do is use pthread_sigmask to say explicitly which threads handle which signals. In Linux the root thread is the default.
Upvotes: 1