我有一个关于内核线程之间信号传播的查询。 这种情况是这样的:被阻止的系统调用不会让SIGKILL终止进程
从用户空间应用程序进行系统调用,内核在系统调用中创建一个线程(让它命名为thread1)。
现在在thread1中,内核在while循环中循环并且被阻塞。主线程也在while循环中循环。 如果我做了一个“杀-9 <“用户应用PID>”,该应用程序不能正常退出。即使/ proc入口仍然存在。 虽然在/ proc // FD文件夹为空。
如果我把下面的主线程的while循环,它正确地并退出捕捉信号。如果我把在线程1的只有下面的while循环,主线程仍然不会退出。
if (signal_pending(current)) {
return;
}
能否请你建议,在这种情况下内核应该如何处理kill -9信号?在SIGKILL之后,进程的状态变成Zombie。
该系统调用以下实现:
thread1 = kthread_create(thread_fn, NULL, "thread1");
if (thread1) {
wake_up_process(thread1);
}
printk(KERN_NOTICE "Main thread: current:%s\n", current->comm);
while(1) {
DELAY_SEC(1)
的thread_fn是:
int thread_fn(void* data)
{
while(1) {
DELAY_SEC(1)
}
}
问候,
索尼卡
你如何创建一个僵尸程序呢? – alk 2013-05-02 10:39:20