[英]set of signal handlers in user space and kernel space processes
I am a newbie to linux.. 我是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? 只是想知道内核如何根据进程运行的区域(用户空间或内核空间)不同地发送信号?
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." 当人们在UNIX上下文中说“内核线程”时,通常只表示“线程”,而不是“内核空间进程”。 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. 如今,大多数人使用内核线程,尤其是因为POSIX线程标准从2.6开始就已成为Linux内核的一部分。
To answer your question, signals are always addressed to a PID (well, unless you use pthread_kill for inter-thread signaling). 为了回答您的问题,信号始终被寻址到PID(嗯,除非您将pthread_kill用于线程间信号传输)。 With POSIX threads, all the threads of a process share a single PID. 使用POSIX线程,进程的所有线程共享一个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. 实际上,您应该做的是使用pthread_sigmask明确指出哪些线程处理哪些信号。 In Linux the root thread is the default. 在Linux中,根线程是默认线程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.