Corpyright © Shenzhen SunSoar Electronic CO.,LTD    粤ICP备05071209  Powered by 300.cn

News Details

PCB process

Date:
2019/11/09 15:40
Page view

PCB process

 

To describe the operation of the control process, the data structure of the management and control information that stores the process in the system is called the PCB Process Control Block, which is part of the process entity and is the most important recordable data structure in the operating system. It is the most important data structure for process management and control. Each process has a PCB. When the process is created, the PCB is built, and the whole process of the process is run, and the process is undone until the process is undone.

Process management block Process Control Block operating system, programming describes the data structure of the system

table of Contents

.1 Introduction

.2 composition

.3 role

.4 contains information

.5 characteristics of the process

.6 status of a process and its conversion

Introduction

The PCB records all the information needed by the operating system to describe the current state of the process and to control the operation of the process. The role of the PCB is to make a program (including data) that cannot run independently in a multi-program environment, become a basic unit that can run independently, and a process that can be executed concurrently with other processes. In other words, the OS controls and manages the concurrent execution process according to the PCB. For example, when the OS wants to schedule a process to execute, it needs to check its current state and priority from the PCB of the process; after scheduling to a process, set the process to recover according to the processor state information stored in the PCB. Run the scene, and find the program and data according to the memory starting point of the program and data in the PCB; the process needs to be synchronized with the process, when communicating, or accessing the file. Access to the PCB; when the process is suspended for some reason, the processor environment of the breakpoint must be saved in the PCB. It can be seen that during the entire life of the process, the system always controls the process through the PCB, that is, the system senses the existence of the process according to the PCB of the process rather than anything else. So, PCB is the only sign of the existence of the process.

composition

The PCB process control block is a static description of the process. It consists of a PCB, a program segment, and a data structure set for the block to operate.

In Unix or Unix-like systems, a process consists of a process control block, a program executed by a process, data used by the process, and a work area used by the process. The process control block is the most important part.

The process control block is used to describe the current state of the process, and the data structure of its own characteristics. It is the most critical part of the process. It contains the process information and control information, which is a reflection of the centralized characteristics of the process. The basis for identification and control.

PCB generally includes:

1. Program ID (PID, process handle): It is unique, and a process must correspond to a PID. PID is generally an integer number

2. Characteristic information: general system processes, user processes, or kernel processes, etc.

3. Process status: running, ready, blocked, indicating the current running status of the process

4. Priority: indicates the priority of obtaining CPU control

5. Communication information: reflection of the communication relationship between processes, because the operating system will provide a communication channel

6. On-site protection zone: the process of protecting the blockage

7. Resource requirements, allocation control information

8. Process entity information indicating the program path and name, whether the process data is in physical memory or in a swap partition (paged)

9. Other information: work unit, work area, document information, etc. [1]

effect

1 Process Control Block: The function of the process control block is to make a program (including data) that cannot run independently in a multi-program environment, become a basic unit that can run independently, and a process that can be executed concurrently with other processes.

2 Block: It is the program code segment in the process that can be executed by the process scheduler on the CPU.

3 Data segment: The data segment of a process, which can be the raw data processed by the process corresponding to the process, or the intermediate or final data generated after the program is executed [1].

Contains information

The control and management mechanisms of processes in different operating systems are different, and the information in the PCB is somewhat different. Usually the PCB should contain the following information.

1, process identifier information

Each process must have a unique identifier, either a string or a number. In UNIX systems is an integer. Assigned by the system when the process is created. The process identifier is used to uniquely identify a process. A process usually has the following two identifiers.

External identifier. Provided by the creator, usually composed of letters and numbers, often used by users (processes) to access the process. External identifiers are easy to remember, such as: calculation process, print process, send process, receive process, and so on.

Internal identifier: set to facilitate system use. In all OSs, each process is given a unique integer as an internal identifier. It is usually a symbol of a process. 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

Describe the current state of the process. For the convenience of management, the system design will form a queue of the same state process, such as the ready process queue, waiting for the process to form a plurality of waiting queues according to the waiting events, such as waiting for the printer queue, waiting, and so on. The processor status information is mainly composed of the contents of the various registers of the processor.

General purpose register. Also known as user visual registers, they can be accessed by user programs for temporary storage of information.

Instruction register. Store the address of the next instruction to be accessed.

Program status word PSW. It contains status information. (condition code, execution mode, interrupt mask flag, etc.)

User stack pointer. Each user process has one or several associated system stacks that store process and system call parameters and call addresses. The stack pointer points to the top of the stack.

3. Process scheduling information

Some information related to process scheduling and process swapping is also stored in the PCB.

(1) Process status. Indicates the current state of the process as the basis for process scheduling and swapping.

(2) Process priority. An integer used to describe the priority level of the process using the processor, and the process with the highest priority takes precedence over the processor.

(3) Other information required for process scheduling. (The sum of the time the process has waited for the CPU, the sum of the time the process has been executed)

(4) Events. This is the event that the process waits for the transition from the execution state to the blocking state. (cause of blocking)

Process context:

Is a static description of the entire process of the process execution activities. It includes the values of various registers in the computer system related to the execution of the process, the set of machine instruction codes formed by the program segments after compilation, the data set, and various stack values and PCB structures. Can be combined according to a certain level of execution, such as user-level context, system-level context, and so on.

The only sign of the existence of the process:

Throughout the life cycle of the process, the system always controls the process through the PCB, that is, the system senses the existence of the process according to the PCB of the process rather than anything else, so the PCB is the process. The only sign [1].

Process characteristics

Dynamic

2. Concurrency

3. Independence

A process entity is a basic unit that can run independently, and is also the basic unit for independent acquisition of resources and independent scheduling in the system. There is no process for establishing a process and cannot be run as an independent unit.

Asynchronous

5. Structural characteristics

From the structural point of view, the process consists of three parts: program segment, data segment and PCB [1].

The state of the process and its transformation

1, the three basic states of the process

(1) Ready state (Ready)

Once the process has been allocated all the necessary resources except the CPU, it can be executed as soon as the processor is re-acquired.

(2) Execution state (running state)

Refers to the state in which the process has been executed by the processor.

(3) Blocking state (waiting state)

The state at which a process is suspended due to an event (such as requesting I/O, requesting buffer space, etc.). Sometimes called the "waiting" state or the "sleeping" state.

2, process state transition

1 ready → execution: scheduling

2 Execution → Wait: Wait for an event to occur while sleeping

3 Wait → Ready: wake up due to waiting events

4 Execution → Ready: The time slice runs out or a high priority occurs.

Ready state→execution state

A process in the ready state, when the process scheduler allocates a handler for it, the process changes from the ready state to the execution state, and the process being executed is also called the current process.

Execution status → blocking status

The process being executed cannot be executed due to an event. For example, if a process requests access to a critical resource and the resource is being accessed by another process, the process requesting the resource will transition from the execution state to the blocking state.

Execution status → ready status

The process being executed, if the event is interrupted or interrupted, the process transitions from the execution state to the ready state. (In the time-sharing system, the time slice is used up; in the preemptive scheduling mode, the priority is high to seize the processor)

Execution status → termination status

When a process is completed or an event occurs, such as an address out of bounds, an illegal instruction, etc. in the program, and the exception is ended, the process will be changed from the execution state to the termination state [1].

Search