当前位置: 首页>>技术问答>>正文


什么是<已停用>过程,为什么它不会被杀死?

, , ,

问题描述

chrome 浏览器没有响应,我试图杀死它,但没有消失的过程有<defunct>在它的权利,并没有被杀害:

process,kill,zombie,ubuntu

什么是<defunct>为什么它没有被杀死?

最佳解决办法

从您的输出中,我们看到”defunct”,这意味着该进程已完成其任务或已被损坏或终止,但其子进程仍在运行或这些父进程正在监视其子进程。为了杀死这种过程,kill -9 PID不起作用。你可以试着用这个命令杀死它们,但它会一次又一次地显示出来。

确定哪个是这个失效进程的父进程并杀死它。要知道这个运行命令:

ps -ef | grep defunct

UID          PID     PPID       C    STIME      TTY          TIME              CMD
1000       637      27872      0   Oct12      ?        00:00:04 [chrome] <defunct>
1000      1808      1777       0    Oct04     ?        00:00:00 [zeitgeist-datah] <defunct>

然后kill -9 637 27872,然后通过ps -ef | grep defunct验证已停用的进程。

次佳解决办法

Manual page ps(1) says

Processes marked <defunct> are dead processes (so-called “zombies”) that remain because their parent has not destroyed them properly. These processes will be destroyed by init(8) if the parent process exits.

你不能杀死它,因为它已经死了。唯一剩下的就是an entry in the process table

On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the parent process to read its child’s exit status.

除非有很多这样的过程,否则让这样的过程没有什么坏处。僵尸最终由其父母(通过调用wait(2))获得。如果原始父代在自己退出之前还没有收获,那么init进程(pid == 1)稍后会执行此操作。 Zombie Process只是:

A process that has terminated and that is deleted when its exit status has been reported to another process which is waiting for that process to terminate.

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/459.html,未经允许,请勿转载。