Home>Article>Operation and Maintenance> What does linux ppid mean?

What does linux ppid mean?

青灯夜游
青灯夜游 Original
2022-04-12 17:31:32 11086browse

In Linux, ppid refers to the PID of the parent process, that is, the process ID number of the parent process. When a process is created, the process that created it is called the parent process, and the child process uses the PPID to indicate who is its parent process; you can execute the "ps -ef | grep process name" command to view it, and the third column of the output result It is the ppid value.

What does linux ppid mean?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

A process contains multiple attribute parameters. By using the ps command, we can view detailed information about the process in the current system, for example:

[root@localhost ~]# ps -le F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIMECMD 4 S 0 1 0 0 80 0 - 718 - ? 00:00:02 init 1 S 0 2 0 0 80 0 - 0 - ? 00:00:00 kthreadd …省略部分输出…

You can see that each process contains F , S, UID, PID and other attributes. These attribute parameters determine the order in which processes are processed, the resources that can be accessed, etc., and are very important to both system administrators and programmers.

The following article will introduce to you common attribute parameters such as UID, PID, PPID.

UID (real user ID)

UID The abbreviation of User Identification. After a UID user registers, the system will automatically give you a UID value. It means to give this user a number.

Only the creator of the process and the root user have the right to operate the process, so it is very necessary to record the creator (that is, the owner) of a process. The UID of a process is the user ID number of its creator, which is used to identify the owner of the process.

EUID (Effective User ID)

In addition to UID, Linux also saves an "effective user ID number" for the process, called EUID. This special UID number is used to determine a process's access rights to certain resources and files. In most cases, the UID and EUID of a process are the same, except for the famous setuid program.

So, what is a setuid program? We talked about the passwd command earlier. This command allows users to modify their login password. But have readers considered this issue? The password is stored in the /etc/shadow file. This file is not readable by ordinary users. So why can users change their passwords by modifying the shadow file?

This is the beauty of setuid. By giving passwd the permissions of the file owner (that is, root) during the execution phase, the user can temporarily have the ability to modify the shadow file (of course, this ability is limited) of). Therefore, passwd is a typical setuid program, whose UID is the user ID currently executing this command, and EUID is the ID of the root user (that is, 0).

PID (Process ID number)

The system assigns each user an ID number (UID) that identifies their identity. Similarly, a process also has such an ID number, which is called PID (Process Identification).

You must know that using ID to determine the process is very beneficial, because for computers, it is always more convenient to recognize numbers than to recognize a string of characters. Linux does not need to understand those that are very "useful" to humans. Meaning" of the process name.

Not only does Linux itself use PID to determine the process, but it also requires users to provide the corresponding PID number when managing the process. In fact, almost all process management tools accept PID numbers instead of process names.

PPID (PID of parent process)

In Linux, all processes must be created by another process (except when the system boots, which is created autonomously by the kernel) and those processes installed). When a process is created, the process that created it is called the parent process, and the process is called the child process.

The child process uses PPID to indicate who is its "father". It is easy to understand that PPID refers to the PID of its parent process.

Note that in the above description, the word "create" is used many times. This is for convenience of expression and understanding. In fact, in Linux, processes cannot be created "out of thin air" , In other words, Linux does not provide a system call to allow applications to "create" a process. Applications can only spawn new processes by cloning themselves.

Explanation:

PID and PPID are both non-zero integers.

PID is unique, and a PID only identifies one process.

Another new process created by one process is called a child process. Conversely, the process that creates the child process is called the parent process.

For an ordinary user process, its parent process is the Shell that executes it. For Linux, the Shell is bash.

Linux method to view the PID and PPID of the process

What does linux ppid mean?

#Example: View the PID number of the nginx process,ps -ef | grep nginx

What does linux ppid mean?

After execution, the PID and PPID number of the process can be returned

What does linux ppid mean?

Command uses extension to force end a process

What does linux ppid mean?

Example, forcefully end the nginx process

What does linux ppid mean?

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What does linux ppid mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn