What is a process? In Linux, every time an event is triggered, a process is generated. There are many processes in the system. How does the system identify different processes? Like our people, the first person has an ID card number to identify each person, and the process is the same. Each process has an ID number, called a PID. We know that every process has a unique PID. What is a process? A process is an internal space that contains multiple threads. A process is like a proxy. We call system data through a process to manage computers. A process contains 1.P.
What is a process?
In Linux, every time an event is triggered, a process is generated. There are many processes in the system and how the system recognizes them.
What about different processes? Like our people, the first person has an ID card number to identify each person, and the process is the same. Each process has an ID number, called a PID. We know that every process has a unique PID. What is a process?
A process is an internal space that contains multiple threads. Processes are like proxies. We call system data through processes to manage computers. processes include
1. PID
2. Code segment or instruction
3. Variables
4. library files
5. files to be operated
Processes are all in the middle. You can use ls/proc to check the memory. All in this field are named after numbers.
. The PID number ranges from 1 to 32767.
Among them, 1 belongs to the INIT process, which enables Linux to start up and initialize Linux.
All other processes are derived from init, directly or indirectly.
We know that the kernel has the following features:
1. Internal Management
2. Process Management
3. Hardware Management
4. cpu Management
5. File System Management
Therefore, processes are managed by the kernel.
In order for the cpu to execute different processes, the cpu is divided into different cpu time slice for executing different processes.
In the memory, there are processes in the queue, the first execution of the process with a higher priority, the first execution of the same first, and the different time slices, so the process has a higher priority, the priority of a process is expressed by the nice value.
The larger the nice value, the lower the priority. The smaller the nice value, the higher the priority of the process. The nice value ranges from-20 to 19.
Process category:
1. User process or terminal-related process
2. daemon or terminal-independent processes
Process status
The process has different statuses, which are represented by the following letters:
D: inaccessible sleep (usually I/O files)
R: running or waiting for running (there is data available, only waiting for CPU time)
S: resumable sleep
T: stop, indicating that the task is stopped and not executed.
W: paging, indicating that it is no longer used
X: dead: The dead process has been cleared from the memory, so it is invisible in the memory.
Z: the zombie process cannot be cleared.
Process Priority
The process priority is represented by the nice value. The nice value ranges from-20 to 19. The larger the value, the smaller the priority.
Run the ps aux command to view the processes in the system. The STAT line represents the state of the process. You can see that the letters following the process status usually have modifiers, such as <, N, L, s, l, +, the modifiers are as follows:
<, Indicating a high priority
N, indicating a low priority
L. It can only be run in physical memory
S, indicating sleep
L, indicating Multithreading
+ Indicates that