zoukankan      html  css  js  c++  java
  • ps命令输出字段的含义

    【整理】ps命令输出字段的含义

    Linux中的ps命令,用于查看进程状态信息。

    其输出内容有很多列,每一列中又有很多字母或符号表示很多种不同意思。

    先贴个例子:

    MTLG>ps
      PID  Uid        VSZ  Stat     Command
        1 root        132    S         /sbin/init
        2 root                  RWN   [ksoftirqd/0]
        3 root                  SW<    [events/0]
        4 root                  SW<    [khelper]
        5 root                  SW<    [kthread]
        6 root                  SW<    [kblockd/0]
        7 root                  SW     [pdflush]
        8 root                  SW     [pdflush]
        9 root                  SW<   [kswapd0]
       10 root                  SW<  [aio/0]
       11 root                  SW    [mtdblockd]
       12 root                  SW<  [bfin-spi-master]
       13 root                  SW<  [rd_silabs_wq]
       14 root                  DW<  [wr_silabs_wq]
       15 root                  SWN  [jffs2_gcd_mtd3]
       22 root        396    S        /bin/sh /root/focus.profile
       23 root         32     S       /bin/watchdogd -f -k 1 -w 5
       30 root                  SW<  [IR_State_Machin]
       50 root      11606  S      /root/focusapp
       51 root      11606  S      /root/focusapp
       52 root      11606  S      /root/focusapp
      143 root      11606 S      /root/focusapp
      144 root        384   S      sh -c ps < /dev/silabstty0 > /dev/silabstty0 2>&1
      145 root        516   R      ps

    具体含义为:

    字 段          含义

    USER            进程所有者的用户名

    PID                进程号

    %CPU           进程自最近一次刷新以来所占用的CPU时间和总时间的百分比

    %MEM          进程使用内存的百分比

    VSZ              进程使用的虚拟内存大小,以K为单位

    RSS              驻留空间的大小。显示当前常驻内存的程序的K字节数。

    TTY              进程相关的终端

    STAT            进程状态,用下面的代码中的一个给出: 
                         D    不可中断     Uninterruptible sleep (usually IO)
                         R    正在运行,或在队列中的进程
                         S    处于休眠状态
                         T    停止或被追踪
                         Z    僵尸进程
                         W    进入内存交换(从内核2.6开始无效)
                         X    死掉的进程
                         <    高优先级
                         N    低优先级
                         L    有些页被锁进内存
                         s    包含子进程
                         +    位于后台的进程组;
                         l    多线程,克隆线程

    TIME            进程使用的总CPU时间

    COMMAND  被执行的命令行

    NI                 进程的优先级值,较小的数字意味着占用较少的CPU时间

    PRI               进程优先级。

    PPID             父进程ID

    WCHAN        进程等待的内核事件名

    其中关于状态信息的英文解释:

    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)
    R    Running or runnable (on run queue)
    S    Interruptible sleep (waiting for an event to complete)
    T    Stopped, either by a job control signal or because it is being traced.
    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

    来自:http://www.crifan.com/order_the_meaning_of_the_ps_command_output_fields/

  • 相关阅读:
    AES密码算法详解(转自https://www.cnblogs.com/luop/p/4334160.html)
    快速排序和插入排序——我的代码
    北京大学1001ACM——高精度类型题总结
    C语言数组不知道输入几个整数以及输入一直到为0
    C语言并查集例子——图问题巧用parent[]数组
    C语言快速判断素数——不超时
    C语言如何才能使用bool类型
    C语言两个特别大的整数类型相加超出范围使用两个技巧
    C语言存30位数字长的十进制方法
    dockerfile相关命令
  • 原文地址:https://www.cnblogs.com/bastard/p/2852282.html
Copyright © 2011-2022 走看看