1. What is the process
Popular, the process is running program
From the operating system point of view, the process is the operating system for the description of the process.
This can concrete process description is called the process control block of the PCB , the description of the structure under Linux called struct task_struct
The basic process is the execution entity program, but also the basic unit of the system allocation and scheduling of resources.
2. The information contained in the main process
Task_struct operating system can run the program, because it contains task_struct:
Memory pointer, identifier pid , file status information, process status , contextual data, program counter, process priority ...
Memory pointer: after running a program and data loaded into the location in memory
Identifier pid: uniquely identifies each process in the system
Contextual data: when process execution status and resource
Program Counter: the switching position stored program
3. The status of the process
Run : possession CPU, and runs on the CPU
Ready: already have operating conditions, but because there is no free CPU, but is temporarily unable to run
Obstruction: waiting for an event can not be run temporarily
4. The process of special status
1. zombie process: The process is a zombie state
How to produce zombie process? What is the harm? How to avoid?
The child before the parent process to exit, in order to save and exit reasons, and therefore the subroutine resources are not fully released, the operating system checks to the child process exits, notifies the parent process at this time, this time the parent can get the child process exits reasons, allowing the operator release system resources, resources that case the child will only be fully released.
If the parent did not care for this notice, which means the parent is not allowed to release the child operating system resources, then this time the child will be in a dead state to become a zombie process.
Hazard: The resource leak
Avoid: Process waiting
Resolution: The parent process to exit the (zombie child process because the nature of reason is to save and exit the reasons to the parent process to see, however, withdrew from the parent process, meaning that there will be no zombie child processes exist, so the operating system directly released. )
2. orphaned: parent before the child process exits, the child process becomes orphaned. (In the background)
Orphan process is not without a parent, but the parent becomes init process, means that after the child process exits, by the init process to handle the matter behind it, and init process will allow direct release of the operating system resources, it will not become a zombie process.
3. daemon: Special orphaned. (Running in the background, and is now completely out of the terminal and the session)
5. Process Priority
Process priority determines the process gets priority CPU resources .
Priority actually is an array, the smaller the value, the higher the priority.
Why should there be a priority: to make the operating system run more reasonable.
How to set the priority: the priority can not be set directly, but can be provided by further setting the value of the priority nice value
the PRI the NI + = the PRI the NI ranges: -20 to 19 set command: renice - n-ni_val - P PID nice - n ni_val. / main
6. Process Scheduling
CPU scheduling is the basic function of the operating system, if the CPU is idle, the operating system will choose the ready queue of higher priority program execution
7. Process Features
Competitive : Because the processes on the operating system are always competing for resources, and therefore competitive process between
independence : In order to make the operation a process does not affect another process, you need to have independence between processes
in parallel : CPU resources a sufficient number of cases, multiple processes can run
concurrently : not enough CPU resources, the switch is scheduled to run multiple processes