pstree 输出的含义

pstree 输出的含义
-bash-3.2$ pstree 27108
Script.sh---java---15*[{java}]

这在这里意味着什么,以及在命令上下文中为&15*定义的任何含义?[]{}

答案1

它就在man页面中:

   pstree shows running processes as a tree. The tree is rooted at either pid or init
   if pid is omitted. If a user name is specified, all process trees rooted  at  pro-
   cesses owned by that user are shown.

   pstree  visually  merges identical branches by putting them in square brackets and
   prefixing them with the repetition count, e.g.

       init-+-getty
            |-getty
            |-getty
            ‘-getty

   becomes

       init---4*[getty]

   Child threads of a process are found under the parent process and are  shown  with
   the process name in curly braces, e.g.

       icecast2---13*[{icecast2}]

在您的情况下,进程 27108 是由脚本启动的Script.sh。创建Script.sh了一个java进程,该进程又产生了 15 个 java 线程。

Aps -eLf | grep java | wc -l应该返回给您一个大约 15 的计数。

答案2

man pstree:

  pstree visually merges identical branches by putting them in square brackets and prefixing them with the repetition count, e.g.

       init-+-getty
            |-getty
            |-getty
            `-getty

   becomes

       init---4*[getty]

   Child threads of a process are found under the parent process and are shown with the process name in curly braces, e.g.

       icecast2---13*[{icecast2}]

所以,进程15的线程java

相关内容