Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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...)

Where can I find this?

like image 283
Aaron Fi Avatar asked Nov 21 '08 01:11

Aaron Fi


People also ask

What does top command mean in Linux?

The top (table of processes) command shows a real-time view of running processes in Linux and displays kernel-managed tasks. The command also provides a system information summary that shows resource utilization, including CPU and memory usage. In this tutorial, you will learn to use the top command in Linux.

What are the 3 values in the top command refer to?

average load on the system (load average: 0.02, 0.12, 0.07) the 3 values refer to the last minute, five minutes and 15 minutes.

What is the meaning of top command?

top command is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel.


2 Answers

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.

'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).

'T' is a state where the process is stopped, usually via SIGSTOP or 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.

'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.

like image 154
CesarB Avatar answered Nov 08 '22 04:11

CesarB


You can use the command man top to look up the states:

D = uninterruptible sleep I = idle R = running S = sleeping T = stopped by job control signal t = stopped by debugger during trace Z = zombie 
like image 31
SMB Avatar answered Nov 08 '22 04:11

SMB