linux线程被杀死会牵连其他线程吗
问: linux轻量级线程被杀死会牵连其他线程吗 ? 答案:如果这里的杀死是指kill -9的话,则会杀死整个进程,自然也会终结同一个进程内的所有线程。linux的线程是用轻量级进程(lwp, lightweight process)实现的,同一个进程内的所有轻量级进程有共同的PID和不同的LWP-ID. 即使你只kill -9 某个LWP-ID,会导致整个进程被杀死。 引用 POSIX-compliant multithreaded applications are best handled by kernels that support "thread groups ." In Linux a thread group is basically a set of lightweight processes that implement a multithreaded application and act as a whole with regards to some system calls such as getpid( …