Learn about processes in linux

When working with operating systems, we always come across the phrase process or process. So what is progress? This article will explain for you and at the same time help you distinguish different types of processes.


1. Process


Processes are simply understood as a program running in the operating system. A process can be divided into one or more sub-processes.



2. Classify the process



2.1. Init process


The Init process is the first process that is started after you have selected the operating system in the boot loader. In the process tree, the init process is the parent of other processes. Init process has the following characteristics:



  • PID = 1

  • Cannot kill init process



2.2. Parents process - Child process


In the linux operating system processes are classified into parents process and child process. A process when executing the fork () command to create a new process is called the parents process. The newly created process is called a child process.


image

A parents process can have many child processes but a child process has only one parents process. When looking at the information of a process, in addition to PID (Processes ID) we need to pay attention to PPID (Parent Processes ID). It will give us information about the parents process of that process:


ps -ef



2.3. Orphan process - Zombie Process


When the parents process - child process is active, there will be some special cases. At that time, Orphan process - Zombie Process will be formed.


When a parents process is disabled before the child process is turned off, that child process becomes an orphan process. At this point the init process becomes the parent of orphan processes and executes them.


When a child process is terminated, all state of the child process is notified by the parents process call to wait (). So the kernel will wait for parents process to return wait () before shutting down the child process. However, for some reason, the parents process cannot return wait (), then the child process becomes a zombie process. When in this state, the process will almost completely free up memory, only storing some information such as PID, amount of intact used, ... on the process list.


Although completely freeing memory, the zombie process is not terminated. So if the zombie process is large, it will hold a large number of PIDs. If the PID is full, no new processes will be created. Zombie processes will only be terminated if their parents process is killed.


To find the zombie process we type check the status of the process by the following command:


ps -lA | grep '^. Z'


2.4 Daemon Process


A Daemon Process is a background process. It will always be in active state and will be triggered by a certain condition or statement. In Unix, daemons often end with "d" such as httpd, sshd, crond, mysqld, etc.










































About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://www.nguyendiep.com/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment