PS命令解释为什么会出现一些旧的进程?

PS命令解释为什么会出现一些旧的进程?

根据我对 Linux 上的 Linux ps 命令的理解,它应该显示“当前进程”。我运行了这个命令ps aux --sort -rss

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     12019  0.0  2.5 224036 105992 ?       Ss   04:13   0:06 /usr/local/cpanel/3rdparty/perl/528/bin/perl -T -w /usr/local/cpanel/3rdparty/bin/spamd --max-spare=
root     12237  0.0  2.4 225184 103664 ?       S    04:26   0:03 spamd child
root     12238  0.0  2.4 224036 102128 ?       S    04:26   0:00 spamd child
root     12239  0.0  2.4 224036 102124 ?       S    04:26   0:00 spamd child
mysql     1592  0.2  1.3 1586436 57104 ?       Sl   Aug29   1:56 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user
named     1056  0.0  0.9 1924092 41828 ?       Ssl  Aug29   0:00 /usr/sbin/named -u named
root      1380  0.0  0.8 902416 37480 ?        Ssl  Aug29   0:19 PM2 v3.5.1: God Daemon (/root/.pm2)         
root      5032  0.0  0.8 2037540 35732 ?       Sl   Aug29   0:01 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root      9778  0.0  0.8 2037500 35708 ?       Sl   02:57   0:01 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root     18725  0.0  0.8 2037500 35680 ?       Sl   08:09   0:00 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root      7577  0.0  0.8 2037460 35676 ?       Sl   01:46   0:01 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root      9740  0.0  0.8 2037500 35676 ?       Sl   02:54   0:01 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root     13955  0.0  0.8 2037500 35672 ?       Sl   05:23   0:00 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root      3342  0.0  0.8 2037460 35664 ?       Sl   Aug29   0:01 phantomjs /home/ogdi/public_html/preview/productpreview/node-webshot/lib/webshot.phantom.js {
root     18186  0.0  0.8 2037500 35664 ?       Sl   07:51   0:00 phantomjs /home/ogdi/public_html/preview/productpreview/node-

这只是其中的一部分。Phantom 进程出现了很多次,但据说时间大约为 1 秒,而且几乎没有任何内存。该进程还活着吗?

答案1

所有这些进程都是“活着的”。它们是系统上的活跃进程。

STAT您可以通过查看列并检查手册页中表格中列出的代码来确定进程的状态ps

PROCESS STATE CODES
       Here are the different values that the s, stat and state output
       specifiers (header "STAT" or "S") will display to describe the state of
       a process:

               D    uninterruptible sleep (usually IO)
               I    Idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an event to complete)
               T    stopped by job control signal
               t    stopped by debugger during the tracing
               W    paging (not valid since the 2.6.xx kernel)
               X    dead (should never be seen)
               Z    defunct ("zombie") process, terminated but not reaped by
                    its parent

       For BSD formats and when the stat keyword is used, additional
       characters may be displayed:

               <    high-priority (not nice to other users)
               N    low-priority (nice to other users)
               L    has pages locked into memory (for real-time and custom IO)
               s    is a session leader
               l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads
                    do)
               +    is in the foreground process group

相关内容