日期:2014-05-16  浏览次数:20554 次

内核线程僵死如何解决?
按照http://www.scs.ch/~frey/linux/kernelthreads.html的例子创建了5个内核线程,但是在关闭线程时,线程僵死。

在用户态可以用父进程wait解决,但是在内核里面如何避免僵死的内核线程?

root             1614     0.0     0.0           0         0   ?                 Z         10:34       0:00   [example   thread   <defunct> ]
root             1615     0.0     0.0           0         0   ?                 Z         10:34       0:00   [example   thread   <defunct> ]
root             1616     0.0     0.0           0         0   ?                 Z         10:34       0:00   [example   thread   <defunct> ]
root             1617     0.0     0.0           0         0   ?                 Z         10:34       0:00   [example   thread   <defunct> ]
root             1618     0.0     0.0           0         0   ?                 Z         10:34       0:00   [example   thread   <defunct> ]
root             2664     0.0     0.4     6792     352   ?                 S         12:03       0:00   /usr/sbin/sshd
root             2666     0.0     1.0     4340     808   pts/2         S         12:04       0:00   -bash
root             2711     0.0     3.6     8140   2900   pts/2         S         13:48       0:00   vim   kernel/signal.c
root             2725     0.0     0.0           0         0   ?                 Z         13:55       0:00   [example   thread   <defunct> ]
root             2726     0.0     0.0           0         0   ?                 Z         13:55       0:00   [example   thread   <defunct> ]
root             2727     0.0     0.0           0         0   ?                 Z         13:55       0:00   [example   thread   <defunct> ]
root     &nbs