Each process has a non-negative integer representing a unique process ID.
A process is a data structure variable, how many processes there are, and how many PCBs there are.
The IDs of several typical processes and their types and capabilities:
ID Process name Chinese name type function
0 Swapper Exchange Process system process it is a part of the kernel, does not execute the program on disk, is the dispatch process.
1 init init process The user process never stops, starts the system, reads the system initialization file.
Some of the commonly used process identifiers:
PID Current Process ID
Ppid Current parent Process ID
UID Actual user ID
Euid Valid User ID
GID Actual Group ID
Egid Valid Group ID
Process Status:
Operational status: Note This does not mean that the process must be running, it indicates that the process is either running or running in the queue.
Sleep state (sleep can be interrupted): The process is waiting for the event to complete.
Disk hibernation (non-disruptive sleep): processes in this state typically wait for the end of the IO.
Paused state: The process can be paused through sigstop and the process will continue to run through Sigcont.
Zombie State: A dead process occurs when the process exits and the parent process (using the wait () system call) does not read the return code of the child process exit. The zombie process remains in the process table with a terminating state and waits for the parent process to read the exit status code.
Dead state: Is the state returned by the Do_exit () function in the kernel.
Process priority:
Process CPU resource allocation refers to the priority of the process, the priority of the process has priority enforcement rights.
To understand the priority of a process you must master two important identifiers:
PRI: Represents the priority that a process can be executed, and the smaller the value, the sooner it is executed.
NI: Represents the nice value of the current process.
The relationship between these two identifiers is: PRI (new) =pri (old) + Nice, and when the nice value is negative, the priority value of the process will be smaller, that is, its priority will be higher, the faster it is executed. Be aware that the nice value of the process is not the priority of the process, but the nice value modifies the priority of the process.
Process creation:
Fork (): The parent process copies its own environment variable table to the child process when it calls fork to create the child process, and the environment variable defines the running environment of the process.
The parent process of the process created at the terminal is the Bash,fork function that creates the child process of the current process, with two return values that return 0 and the PID of the child process, respectively.
Child processes and parent processes cannot share data (where they are stored) and can share code.
Execve (): Using Execve () to create a new process, the system call destroys all memory segments to rebuild a new memory segment and requires an executable file or script as a parameter.
Fork (), the process created by Execve () is a child process that runs the process.
Orphan process: A parent process exits, and one or more of its child processes are still running, then these child processes become orphans. The orphan process will be adopted by the INIT process (process number 1) and the Init process completes the state collection for them.
This article is from the "Hah-yn" blog, make sure to keep this source http://hah11yn.blog.51cto.com/10879860/1794703
Linux Process Control