In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge of what the concept of ppid is in linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
In linux, ppid refers to the PID of the parent process, which 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 PPID to indicate who its parent is; you can view it by executing the "ps-ef | grep process name" command, and the third column of the output is the ppid value.
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, such as:
[root@localhost] # ps-leF S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIMECMD4 S 0 1000 800 -? 00:00:02 init1 S 02 00 800-0 -? 00:00:00 kthreadd... Omit part of the output.
As you can see, each process contains attributes such as F, S, UID, PID, and so on. These attribute parameters determine the order in which the process is processed, the resources that can be accessed, and so on, which are very important to system administrators and programmers.
The following article will introduce some common attribute parameters such as UID, PID, PPID and so on.
UID (real user ID)
Abbreviation for UID user identification (User Identification). After UID users sign up, 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 on the process, so it is 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 (valid user ID)
In addition to UID, Linux keeps a "valid user ID number" for the process, which is called EUID. This special UID number is used to determine the process's access to certain resources and files. In most cases, the UID and EUID of the process are the same, except for the famous setuid program.
So, what is a setuid program? I talked about the passwd command, which allows users to change their login password. But has the reader considered that the password is saved in the / etc/shadow file, which is not readable to the average user, so why can users change their password by modifying the shadow file?
This is the beauty of setuid, by giving passwd file owner (that is, root) permissions at run time, giving users the ability to temporarily modify shadow files (which is limited, of course). Therefore, passwd is a typical setuid program, whose UID is the current user ID who executes this command, and EUID is the ID (that is, 0) of the root user.
PID (ID number of the process)
Each user is assigned an ID number (UID) to identify him or her. Similarly, processes have such an ID number, which is called PID (Process Identification).
You know, the method of determining processes with ID is very beneficial, because it is always much more convenient for computers to know numbers than to know a string of characters, and there is no need for Linux to understand process names that are very "meaningful" to humans.
Linux not only uses PID to determine the process, but also requires the user to provide the corresponding PID number when managing the process. In fact, almost all process management tools accept the PID number, not the process name.
PPID (PID of the parent process)
In Linux, all processes must be created by another process (except those that are independently created and installed by the kernel when the system boots). When a process is created, the process that created it is called the parent process, and the process is called the child process accordingly.
It is easy to understand that a child process uses PPID to indicate who its "father" is, and PPID refers to the PID of its parent process.
Note that in the above description, the word "create" is used many times for convenience of expression and understanding. In fact, processes cannot be created "out of thin air" in Linux. In other words, Linux does not provide a system call for applications to "create" a process. Applications can only generate new processes by cloning themselves.
Description:
Both PID and PPID are non-zero integers.
PID is unique, and a PID identifies only one process.
Another new process created by one process is called a child process. On the contrary, 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, and for Linux, Shell is bash.
Linux's method of viewing the PID and PPID of a process
Example: view the PID number of the nginx process, ps-ef | grep nginx
After execution, you can return the PID and PPID numbers of the process
Command uses extensions to force the end of a process
Example to force an end to the nginx process
These are all the contents of the article "what is the concept of ppid in linux". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.