What is PCB
In order to describe the operation of the control process, the data structure of the management and control information of the process in the system is called Process Control block, which is part of the process entity and is the most important recorded data structure in the operating system. It is the most important data structure of process management and control, each process has a PCB, when the process is created, the PCB is built, accompany the process to run the process, until the process is undone and undone.
What does the PCB usually contain?
1. Program ID (PID, process handle): It is unique, and a process must correspond to a PID. PID is usually the shaping number
2. Feature Information: General sub-system processes, user processes, or kernel processes, etc.
3. Process status: Running, ready, blocking, indicating the current running status of the process
4. Priority: Indicates the priority size to get CPU control
5. Communication information: the communication relationship between processes reflects, as the operating system will provide communication channels
6. On-Site protected areas: for the protection of blocking processes
7. Resource requirements, distribution control information
8. Process entity information, indicating the program path and name, whether the process data is in physical memory or in the swap partition (paging)
9. Other Information: Work unit, work area, document information, etc.
Some of the information below.
1. Process identifier Information
Each process must have a unique identifier, which can be a string or a number. The UNIX system is an integer number. Assigned by the system when the process is created. The process identifier is used to uniquely identify a process. A process typically has the following two identifiers.
The external identifier. Provided by the creator, usually consisting of letters, numbers, often user (process) access to the process used. External identifiers are easy to remember, such as: calculation process, printing process, sending process, receiving process, etc.
Internal identifier: Set for ease of use by the system. In all the OSes, each process is given a unique integer, as an internal identifier. It is usually a symbol of a process, and in order to describe the family relationship of a process, you should also set the parent process identifier and the child process identifier. You can also set a user identifier to indicate which user owns the process.
2. Processor status information
Describes the current state of the process. For ease of management, the system is designed to compose a queue of processes of the same state, such as a ready process queue, while waiting for a process to compose multiple wait queues based on waiting events, such as waiting for a printer queue, waiting, and so on. Processor status information is mainly composed of the contents of the various registers of the processor.
Universal Register : Also known as the user Visual register, can be accessed by the user program for staging information.
Instruction Register : Stores the address of the next instruction to be accessed.
Program status Word PSW: which contains status information. (Condition code, execution mode, interrupt screen mark, etc.)
User stack pointers: Each user process has one or several system stacks associated with it, which are used to store procedures and system invocation parameters and call addresses. The stack pointer points to the stack top of the stack.
3. Process scheduling Information
Some information about process scheduling and process swapping is also stored in the PCB.
(1) Process status. Indicates the current state of the process as a basis for process scheduling and swapping.
(2) Process priority. An integer used to describe the priority level of a process using a processor, and a high-priority process takes precedence over the processor.
(3) Additional information required for process scheduling. (The total amount of time the process has waited for the CPU, the sum of the time the process has been executed)
(4) event. This is the event that the process waits for when it transitions from execution state to blocking state. (Blocking reason)
Process context: is a static description of the process execution activity throughout the process. This includes the values of the various registers associated with the execution of the process in the computer system, the machine instruction code set, the data set, and various stack values and the PCB structure that the program segments have been compiled. Can be combined by a certain level of execution, such as user-level context, system-level context, and so on.
The only sign that a process exists: during the entire life cycle of a process, the system always controls the process through the PCB, i.e., the system is aware of the existence of the process based on the PCB of the process and not on anything else, so that thePCB is the only sign of the process's existence [
This article from the "Learning Record" blog, reproduced please contact the author!
The structure of the PCB under Linux