В выводе PS (1) в подобных OS X системах, что делает процессы, перечисленные в средних круглых скобках, и как я уничтожаю их?

username@yosemite ~ % ps wwwaux | grep java
username        48111   0.0  0.0        0      0   ??  ?E   11:54AM   0:00.00 (java)
username        91673   0.0  0.0  2432772    508 s006  R+    3:19PM   0:00.00 grep java
username        90809   0.0  0.0        0      0   ??  ?E   12:47PM   0:00.00 (java)

Время от времени я подвешу JVM как это. Что делает (java) средние списки процессов? Как я уничтожаю их? kill -9 48111 не делает ничего и AFAICT, списки остаются там, пока я не перезагружаю.

1
задан 10 August 2015 в 23:23
1 ответ

В случае сомнений обратитесь к странице руководства :)

$ man ps
/parenth

When printing using the command keyword, a process that has exited and
has a parent that has not yet waited for the process (in other words,
a zombie) is listed as ``<defunct>'', and a process which is blocked
while trying to exit is listed as ``<exiting>''.  If the arguments
cannot be located (usually because it has not been set, as is the case
of system processes and/or kernel threads) the command name is printed
within square brackets.  The process can change the arguments shown
with setproctitle(3).  Otherwise, ps makes an educated guess as to the
file name and arguments given when the process was created by
examining memory or the swap area.  The method is inherently somewhat
unreliable and in any event a process is entitled to destroy this
information.  The ucomm (accounting) keyword can, however, be depended
on. If the arguments are unavailable or do not agree with the ucomm
keyword, the value for the ucomm keyword is appended to the arguments
in parentheses.

Дополнительно:

KEYWORDS
  The following is a complete list of the available keywords and their meanings.
  Several of them have aliases (keywords which are synonyms).
  ...
  ucomm      name to be used for accounting

Похоже, что это процессы зомби, и вместо того, чтобы просто возвращать в качестве имени процесса он возвращает то, что было сохранено в какой-то учетной записи.

Что касается остановки этих процессов, перезагрузка может быть лучшим вариантом. Поскольку они потеряли свой исходный PPID и стали потомками PPID 1 (launchd). Вы можете попробовать отправить сигнал HUP на launchd, но не пытайтесь отправить ему сигнал SIGKILL или SIGTERM, иначе ваша система выйдет из строя.

Вы можете проверить PPID процессов зомби, используя ps -ef .

Примечание : наличие нескольких зомби-процессов ничего не должно повредить. На самом деле процесс больше не работает, он был остановлен и не использует никаких системных ресурсов, кроме записи в таблице процессов.

1
ответ дан 4 December 2019 в 00:02

Теги

Похожие вопросы