Fundamentals of Computer Operating System (3) --- Five-state Model of Process Management

introduction

This article is the third article, the five-state model of process management . A process has multiple states in the operating system. This article is about understanding the multiple states of a process in the operating system.

1. The five states of the process

  • Creation status
  • Ready state
  • Blocking state
  • Execution status
  • Termination state

2. What is the process doing when it is in these five states

(1) Ready state

  • When the process is allocated all necessary resources except the CPU , it is in the ready state
  • As long as you get the right to use the CPU, you can run it immediately
  • All other resources are ready, only the state of CPU resources is the ready state.
    Other resources include process control block (PCB), memory, stack space, heap space, etc.

In the operating system, we know that multiple programs can run concurrently. At this time, there may be multiple processes in the ready state. These processes are usually arranged in a queue. This queue is called the ready queue . In the ready queue, there are Multiple ready processes
image

(2) Execution status

  • The process has the right to use the CPU, and its program is executing, which is called the execution state
  • In a single processor (a CPU has only one core), only one process can be in execution at a certain time

(3) Blocked state

Process due to some reasons, such as: other devices are not ready and can not continue to execute, thus giving up the state of the CPU, it is called blocking state

For example, if a process wants to request a printer, but the process cannot receive a response because the printer is being occupied, it will be in a blocked state. When multiple processes request printers at the same time, they will also be in a blocking state. At this time, there is also the concept of blocking queues .

(4) Creation status

There are two steps to creating a state:

a. Assign PCB

b, insert the ready queue

When the process is created, the state where the PCB is owned but other resources are not yet ready is called the creation state

(5) Termination status

The termination state is also divided into two steps:

a, system cleanup

b. Return the PCB

The state where the process ends and the PCB is cleaned or returned by the system is called the termination state

3. Switch between the three states of ready, blocking and execution

When the process is scheduled , it will change from the ready state to the execution state. When a process is scheduled, the CPU resources will be obtained. When the CPU resources of the process in the execution state are exhausted, it will switch Return to the ready state and insert it into the ready queue. The CPU resource used up here refers to the time allocated to a certain process to execute the CPU.

When an IO request occurs in a process in the execution state, it may become blocked (the previous example is about requesting a printer). When the IO is completed, it will switch from the blocking state to the ready state
image

It is the core competitiveness of a technical person to find the constant in the rapidly changing technology. Unity of knowledge and action, combining theory with practice
image

Guess you like

Origin blog.csdn.net/self_realian/article/details/106971318