[Operating System] Concept of Process and Its Scheduling Algorithm

1. Process

(1) The concept of process:

      A process is the foundation of the operating system structure; is an executing program; an instance of a running program in a computer; an entity that can be assigned to and executed by a processor; displayed by a single sequential execution, a current state and a set of The unit of activity described by the associated system resource. After the computer application is run, it is equivalent to putting the application into the container. You can add other things to the container (such as: variable data required by the application at runtime, DLL files that need to be referenced, etc.), When the application is run twice, the contents of the container will not be drained, the system will find a new process container to hold it. In order to deeply describe the nature of the dynamic execution process of a program, the concept of "Process" is introduced.

(2) The composition of the process:

           Code segment, data segment, process control block (PCB)

(3) The essential difference between a process and a program:

           Processes are dynamic, while programs are static.

(4) The three states of the process and the transitions between them:

            Running state, ready state, blocked state

2. Process scheduling

(1) Three-level scheduling of the processor:

High-Level Scheduling : (High-Level Scheduling) is also known as job scheduling, which decides to transfer backup jobs into memory to run;

Low- level scheduling : (Low-Level Scheduling), also known as process scheduling, it decides to obtain a CPU from a process in the ready queue;

Intermediate-level scheduling : (Intermediate-Level Scheduling) is also known as introduction in virtual memory , and process swapping is performed in the swap area of ​​memory and external memory .

 
 

(2) Process scheduling algorithm:

First in first out algorithm (FIFO algorithm)

The algorithm always assigns the processor to the process that enters the ready queue first. Once a process gets a processor, it will continue to execute until the process is completed or blocked, and the processor is released.

It can be seen that the service quality of the FIFO algorithm is poor, and it is easy to cause dissatisfaction of the job users. It is often used as an auxiliary scheduling algorithm.

short process priority

Shortest CPU runtime priority scheduling algorithm (SCBF--Shortest CPU Burst First)

The algorithm selects the next "shortest CPU execution time" process from the ready queue and assigns a processor to it.

Although this algorithm can achieve better scheduling performance, it is difficult to accurately know the next CPU execution period, and can only be predicted based on the execution history of each process.

Time Slice Round Robin Scheduling

The first several algorithms are mainly used in batch operating systems and cannot be used as the main scheduling algorithm in time-sharing systems. In time-sharing systems, time slice rotation method is used.

Simple round-robin method: The system queues all ready processes according to FIFO rules, and assigns processors to processes in the queue at certain time intervals. In this way, all processes in the ready queue can get a time slice of the processor to run.

Multi-level queue method: Divide all processes in the system into several categories, and each category is one level.

Multi-level feedback queue

The multi-level feedback queue method is to set up multiple ready queues in the system, and give each queue different priorities






Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324817387&siteId=291194637