#The operating system manages processes through the process control block (PCB).
Process Control Block (PCB) (a special data structure set up by the system to manage the process. It is used to record the external characteristics of the process and describe the movement change process of the process. The system uses PCB to control and Management process, so PCB is the only sign that the system perceives the existence of a process. There is a one-to-one correspondence between the process and the PCB)
The control and management mechanisms of the process are different in different operating systems, and the amount of information in the PCB varies. Different, usually the PCB should contain the following information:
1. Process identifier name: Each process must have a unique identifier, which can be a string or a number.
2. Current status of the process status: Describes the current status of the process. For the convenience of management, when the system is designed, processes in the same status will be formed into a queue, such as the ready process queue. Waiting processes will form multiple waiting queues based on the events they are waiting for, such as waiting for printer queues and waiting for disk I/O completion queues. etc.
3. The corresponding program and data addresses of the process in order to connect the PCB with its programs and data.
4. Process resource list. List the resource records owned except CPU, such as owned I/O devices, open file list, etc.
5. Process priority priority: The priority of a process reflects the urgency of the process and is usually specified by the user and set by the system.
6. CPU on-site protection zone cpustatus: When the process cannot continue to occupy the CPU for some reason (such as waiting for a printer), the CPU is released. At this time, the various status information of the CPU must be protected for future use. Get the processor again to restore various states of the CPU and continue running.
7. Process synchronization and communication mechanism is used to realize the semaphores required for mutual exclusion, synchronization and communication between processes.
8. The link word of the PCB in the queue where the process is located. According to the current state of the process, the corresponding PCB of the process joins different queues. The PCB link word indicates the first address of the PCB of the next process in the queue where the process is located.
9. Other information related to the process. Such as process accounting information, CPU time occupied by the process, etc.
The above is the detailed content of How does the operating system manage processes?. For more information, please follow other related articles on the PHP Chinese website!