在 linux 中,“top”命令中的所有值是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/307502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:45:00  来源:igfitidea点击:

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

linuxcommand-linetop-command

提问by Aaron Fi

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 running process (R = Running, S = Sleeping, etc...)

当您运行“top”并查看所有正在运行的进程时,我一直想知道一切究竟意味着什么。例如,一个正在运行的进程的所有各种单字母状态代码(R = 正在运行,S = 睡眠,等等...)

Where can I find this?

我在哪里可以找到这个?

采纳答案by CesarB

The man page says what the state codes are mapped to, but not what they actually mean. From the top man page:

手册页说明了状态代码映射到的内容,但没有说明它们的实际含义。从顶部手册页:

'D' = uninterruptible sleep
'R' = running
'S' = sleeping
'T' = traced or stopped
'Z' = zombie

'R' is the easiest; the process is ready to run, and will run whenever its turn to use the CPU comes.

'R' 是最简单的;该进程已准备好运行,并将在轮到使用 CPU 时运行。

'S' and 'D' are two sleep states, where the process is waiting for something to happen. The difference is that 'S' can be interrupted by a signal, while 'D' cannot (it is usually seen when the process is waiting for the disk).

'S' 和 'D' 是两个睡眠状态,进程正在等待某事发生。区别在于'S'可以被信号中断,而'D'不能(通常在进程等待磁盘时看到)。

'T' is a state where the process is stopped, usually via SIGSTOPor SIGTSTP. It can also be stopped by a debugger (ptrace). When you see that state, it usually is because you used Ctrl-Z to put a command on the background.

'T' 是进程停止的状态,通常通过SIGSTOPSIGTSTP。它也可以由调试器 ( ptrace)停止。当您看到该状态时,通常是因为您使用了 Ctrl-Z 将命令置于后台。

'Z' is a state where the process is dead (it has finished its execution), and the only thing left is the structure describing it on the kernel. It is waiting for its parent process to retrieve its exit code, and not much more. After its parent process is finished with it, it will disappear.

'Z' 是进程死亡的状态(它已完成执行),唯一剩下的是内核中描述它的结构。它正在等待其父进程检索其退出代码,仅此而已。在它的父进程完成它之后,它就会消失。

回答by SMB

You can use the command man top

你可以使用命令 man top