There are processes that run on every Linux operating system instance. These processes can include sshd, sshd and cron jobs. Every application that requires to be run invokes a procedure. These processes often create other processes. There is a hierarchy of process. This is illustrated by login. Your shell is a process. It is created by a parent program.
We won’t go into detail about parent processes. However, when you run new processes or applications, the parent process is your shell process. Log out will clear out all child processes.
It is normal for processes to be running 100% of all the time when introduced to them. CPU is consumed by a process that is running. If all of the processes were running at the same speed, it would be very difficult to run multiple processes at once. There are many states that consume CPU. Some use it more than others, and some consume very little CPU.
What are the 5 Linux Process States (or Linux Process States)?
There are five Linux process states. They are as follows: running & runnable, interruptable_sleep, uninterruptable_sleep, stopped, and zombie. Each of these states exists for a clearly defined reason. Understanding these states can help you troubleshoot issues such as resource exhaustion and out of control process generation. This understanding is even more critical when it comes to how to terminate or kill processes. Each process state may require a different technique.
Linux Server AdministrationRelated training from SPOTO
Start trainingHow to find the Process State
The top command is the easiest way to determine the state of a process. This command lists all the running processes, and includes a few columns default. The state is typically represented by one character in the “S” column. You can also use the ps command. This will list the processes that are based on the criteria passed it with flags. It can accept a variety of flags depending on what information you are looking at. The most common is “ps au”
You can always refer to the man page to find your distribution and command, but these are the most common mappings from character to state.
‘D’ = UNINTERRUPTABLE_SLEEP
‘R’ = RUNNING AND RUNNABLE
‘S’ = INTERRRUPTABLE_SLEEP
T = STOPPER
ZOMBIE = ‘Z’
RUNNING AND RUNNABLE Process State
Although running and runnable are often grouped together, there are some minor differences. This distinction is not important because it indicates that the process is either in the queue to run or is currently running. Running is a process that is currently running and has been allocated to a CPU/CPU core/thread. This will impact CPU utilization metrics in terms real-time usage.
The difference between running and runnable refers to a process that is ready and waiting to be run but the CPU is not available to schedule it. It is therefore queued up to run. This is more common in virtual machines because physical CPUs are under-provisioned. Virtual CPUs may have a bit more latency or be ready for use. This can also happen in the real world if there are too many processes running and not enough CPU time.
INTERRRUPTABLE_SLEEP State
It will reach a point in the process of running that it is waiting for data. This could be input from the terminal, such as asking the user for input. Other times, the process could be a web server that is idle and waiting for a query.
While it waits, a well-coded application enters the INTERRUPTABLE_SLEEP status. A process can be easily terminated in this state. This allows the process to be in a process state while it waits for input. It also allows other processes to take over CPU time. It would be a waste CPU to cyc