The role of the process control block PCB:
In order to describe and manage the operation of the process, a data structure is defined at the core of the OS---process control block
As part of the process entity, it records the messages required by the OS to describe the current state of the process and the running of the process.
Role: Make a program that cannot run independently in a multi-program environment to become a basic unit that can run independently, a program that can be executed concurrently with other processes.
1: As a sign of the basic unit of independent operation. The system is aware of the existence of processes through the PCB.
2: A way to achieve intermittent operation. When the program is running, the program is stopped and stopped, and it runs intermittently. When the program is handed over to the CPU, the scene must be kept. When the call is resumed, the site information of the interrupt program is retained in the PCB.
3: Provide the information needed for process scheduling:
4: Provide the information required for process scheduling; the status information of the process is provided in the PCB, and other information such as (the priority of the process, the waiting time of the process, and the execution time)
5: Realize synchronization with other processes and information: The process synchronization mechanism is used to achieve coordinated operation between processes. When the semaphore mechanism is adopted, each process is required to set corresponding semaphores that are synchronized with each other. In the PCB, there is also a process communication area or a communication queue pointer.
Information in the process control block
1: Process identifier: used to uniquely identify a process. A process usually has two types of identifiers: external and internal identifiers.
2: processor state: processor status information, also known as the processor context, when the process switches, the processor's state information must be saved in the corresponding PCB, in order to start from the breakpoint when the process is re-executed .
3: Process scheduling information: When the OS performs process scheduling, it must know the status of the process and the scheduling information of the process.
4: Process control information: including 1: program and data address, 2: process synchronization and communication mechanism, 3: resource grab list 4: connection pointer.