Process is under Linux
basic unit of resource management, each process has its own independent running space. Each process has a separate process Control block (PCB) to manage each process resource.
The resources of the process are divided into two parts:
Kernel-space process resources and user-space process resources . Among them, kernel space process resources refers to: PCB related information, i.e. process PID, PPID, UID, etc., including the process control block itself, open File table entries and so on. In short, it is the resources that the kernel can access through the PCB. The user-space process resource refers to the process's code snippet, data segment, heap, stack, and the memory space of a library that can share access. These resources are released voluntarily when the process exits.
status of the process
User-level processes have the following statuses in Linux 2.6:
Ready/Running status、
interruptible Wait、
Non-disruptive wait、
Zombie State、
Stop State。
Task_running: A ready state that is running or in readiness means that the process is requesting all resources except the CPU. Task_interruptible: Waiting for a queue, waiting to wake up, can be interrupted to wake. Task_uninterruptible: Waiting for the team to wake up, but not be interrupted. Task_zombie: The process resource user space is freed, but the PCB in the kernel is not released, waiting for the parent process to recycle. Task_stopped: The process is paused by an external program and continues execution when it is allowed again.
Kernel-level process state, two types: task_traced, Task_dead
All the processes in Linux are switched on and off in the above state. The scheduling algorithm determines what state the process is in.
Basic properties of a process
the basic properties of a process include: Process number PID, parent process number PPID, process group number Pgid
The process number is a positive integer that the system maintains to uniquely identify a process, and the process number cannot be modified at the user level. Parent Process Number: In addition to the INIT process, any other process is created by another process. The process that is created is called a child process, and the current process is called the parent process. The parent process could not be modified at the user level. Process group number: Each process has its own process group number. A process group is a collection of one or more processes that are associated with the same job and can receive various signals from the same terminal. The process group number can be modified at the user level. Each process group has a leader process, and the process number of the leader process is the process group number. Leader process exits, the process group is still there, as long as the process group has a process, the process group still exists.
session : A session is a collection of one or more process groups.
Control TerminalSession and control terminal has the following features: 1, a session can have a control terminal, established in the control Terminal Connection session first process is called the control process. 2, a few process groups in a session can be divided into a foreground process and several background processes, if a session has a control terminal, then it has a foreground process. 3, whenever the terminal type interrupt key \ Exit key, will send the interrupt signal \ Exit signal to the foreground process.
Linux process environment and process properties