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

Posted Jun 26, 20202 min read

introduction

This article is the third one, Five-State Model of Process Management. Processes have multiple states in the operating system. This article is to understand the multiple states of processes in the operating system.

1. The five states of the process

  • Creation status
  • Ready status
  • Blocking status
  • Execution Status
  • Termination status

2. What are the processes doing when they are in these five states

(1) Ready state

  • When the process is allocated to all necessary resources except CPU, it is in a ready state
  • As long as you get the right to use the CPU, you can run it immediately
  • 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 ready queue. There are multiple ready processes in the ready queue
image

(2) Execution status

  • The process obtains the right to use the CPU, and its program is being executed, called execution status
  • In single processor(a CPU with only one core), only one process can be executed at a time**

(3) Blocking state

The process is unable to continue execution due to some reason, such as:other devices are not ready, so the state of the CPU is abandoned, which is called blocking state

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

(4) Create state

There are two steps to create a state:

a. Distribution PCB

b. Insert ready queue

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

(5) Termination state

The termination state is also divided into two steps:

a. System cleanup

b. Return the PCB

The state where the process ends and the system cleans or returns the PCB is called termination state

3. Switch between three states:ready, blocked, and executed

When the process of process scheduling occurs, it will change from the ready state to the execution state. When the process scheduling of a certain process occurs, it will obtain the CPU resources. When the execution state of the process has run out of CPU resources, It will switch back to the ready state and insert it into the ready queue. Here, running out of CPU resources means that the time allocated for a certain process to execute the CPU has run out

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

It is the core competence of a technical person to look for constants in rapidly changing technologies. Combining knowledge and action, combining theory with practice
image