Process concept: A process is an independent and schedulable task. Is a process of executing a program.
The program is static, and it is an ordered set of commands stored on the disk. There is no execution concept. The process is dynamic.
It is the process of program execution, including creation, scheduling, and extinction. It is the sum of various resources for program execution and the smallest unit of resource management.
Processes include: body segment + User Data Segment + System Data Segment (Process Control Block PCB ).
Process classification:
1. interactive process: it is controlled by Shell and can be run at the front-end or in the background.
-PS-Ef | grep A. Out
./A. Out & run in the background
2. batch processing process:
Does not belong to a terminal. It is submitted to a queue for sequential execution.
3. daemon:
Run in the background, start running at Linux Startup, and end at system shutdown
Process status:
Running status: the status of the instance that is running or preparing to run (the CPU allocates time slice only)
Wait state: Also known as sleep state (not occupying the CPU, CPU not processing, waiting for resources), divided into can be interrupted and can not be interrupted, waiting for can not be interrupted is not killed.
Stop State: GDB can set breakpoints, kill-20, CTRL + Z to stop the process.
Dead state: Also known as zombie state, a terminated process, but still occupies a task_struct structure in the process Vector Array.
Fork () function to create sub-process
If the parent process ends, process 1 will adopt the child process.
If the child process ends before the parent process ends, the child process becomes a zombie process and must use wait () to receive the zombie process.