杀 - 它杀进程的时候了? [英] kill - does it kill the process right away?

查看:130
本文介绍了杀 - 它杀进程的时候了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么呢究竟怎么办?

我有创造100(作为一个例子)子父进程处理此起彼伏。在任何孩子的作业结束时,我杀了以孩子杀死(pid_of_child,SIGKILL),我不能看到,在 PS 输出。但是,如果出现错误与父进程以父进程和我退出退出(1)(此时只有1个孩子是在那里 - 我可以检查THT在 PS ),在这一点上我看到了很多&LT的;倒闭> 工艺,其 PPID 是父进程的 PID

I have a parent process which is creating 100 (as an example) child processes one after another. At the end of any child's job, I kill the child with kill(pid_of_child, SIGKILL) and I cannot see that in ps output. But if something goes wrong with the parent process and I exit from the parent process with exit(1) (at this point only 1 child is there - I can check tht in ps), at that point I see a lot of <defunct> processes whose ppid is pid of parent process.

这怎么可能?没有杀不了完全的子进程?

How is that possible? did kill not kill the child processes entirely?

推荐答案

不杀的任何的。它发出信号到目标进程。 SIGKILL 只是一个信号。现在, SIGKILL 标准动作 - 唯一的动作,实际上,因为 SIGKILL 无法处理或忽视通过一个过程 - 是退出,这是事实。

kill doesn't kill anything. It sends signals to the target process. SIGKILL is just a signal. Now, the standard action for SIGKILL -- the only action, actually, since SIGKILL can't be handled or ignored by a process -- is to exit, that's true.

在&LT;&倒闭GT;过程是一个孩子说一直没有的收获的,这意味着父母也没有叫等待()来获取孩子的退出状态。直到父电话等待(),已不存在(或僵尸)过程中会流连。

The "<defunct>" process is a child that hasn't been reaped, meaning that the parent hasn't called wait() to retrieve the exit status of the child. Until the parent calls wait(), the defunct (or "zombie") process will hang around.

这篇关于杀 - 它杀进程的时候了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆