In linux, what do all the values in the “top” command mean?

后端 未结 3 399
天涯浪人
天涯浪人 2021-01-31 01:57

When you run \"top\" and see all running processes, I\'ve always wanted to know just what everything actually means. e.g. all the various single-letter state codes for a runnin

3条回答
  •  粉色の甜心
    2021-01-31 02:12

    Programs like top and ps takes these values from the kernel itself. You can find its definitions in the source code here:

    https://github.com/torvalds/linux/blob/3950e975431bc914f7e81b8f2a2dbdf2064acb0f/fs/proc/array.c#L129-L143

    static const char * const task_state_array[] = {
    
        /* states in TASK_REPORT: */
        "R (running)",      /* 0x00 */
        "S (sleeping)",     /* 0x01 */
        "D (disk sleep)",   /* 0x02 */
        "T (stopped)",      /* 0x04 */
        "t (tracing stop)", /* 0x08 */
        "X (dead)",     /* 0x10 */
        "Z (zombie)",       /* 0x20 */
        "P (parked)",       /* 0x40 */
    
        /* states beyond TASK_REPORT: */
        "I (idle)",     /* 0x80 */
    };
    

    For more info see this question: https://unix.stackexchange.com/q/462098/79648

提交回复
热议问题