当前位置:网站首页>Several states of the process
Several states of the process
2022-07-25 00:36:00 【Hua Weiyun】
What are the process scheduling strategies ?
First come, first served : Non preemptive scheduling algorithm , Schedule in the order requested . It's good for long work , But it's not good for short work , Because the short job must wait for the previous long job to finish execution , And long assignments take a long time , Cause short work waiting time is too long . in addition , Yes I/O Intensive processes are also bad , Because this process goes on every time I/O After the operation, we have to queue up again .
Short job preferred : Non preemptive scheduling algorithm , Schedule in the order with the shortest estimated run time . Long work may starve to death , In the state of waiting for the completion of the short job . Because if there are short assignments coming all the time , So long jobs can never be scheduled .
The shortest remaining time is preferred : Preemptive version of the shortest job first , Schedule in the order of the remaining run time . When a new assignment arrives , Its entire run time is compared to the remaining time of the current process . If the new process takes less time , Suspend the current process , Run a new process . Otherwise new processes wait .
Time slice rotation : Press all ready processes FCFS The principle of being in a line , Every time when scheduling , hold CPU Time allocated to the team leader process , The process can execute a time slice . When the time slice is used up , Clock interrupt by timer , The scheduler stops the execution of the process , And send it to the end of the ready queue , At the same time, continue to put CPU The process of allocating time to the team leader .
The efficiency of the time slice rotation algorithm has a lot to do with the size of the time slice : Because process switching needs to save process information and load new process information , If the time slice is too small , Will cause the process to switch too often , Too much time will be spent on process switching . And if the time slice is too long , Then real time can't be guaranteed .
Priority scheduling : Assign a priority to each process , Schedule by priority . To prevent low priority processes from never waiting to be scheduled , You can increase the priority of the wait process over time .
What are the states of the process ?
There is a total of 5 States , They are to create 、 be ready 、 function ( perform )、 End 、 Blocking .
The running state is that the process is CPU Up operation . In a single processor environment , At most one process is running at any one time .
Ready state means that the process is ready to run , That is, the process obtains the division of CPU All the resources you need , Once you get it CPU You can run .
A blocking state is when a process is waiting for an event to stop running , For example, waiting for a resource to be available or waiting for I/O complete . Even if CPU Free , The process can't run either .
Running state → Blocking state : It's often due to waiting for peripherals , Waiting for the allocation of resources such as main memory or waiting for manual intervention . Blocking state → The ready state : The condition of waiting has been met , Just assign it to the processor and run . Running state → The ready state : It's not for your own reasons , Instead, the process in running state gives up the processor for external reasons , Now it's ready . For example, the time slice runs out , Or a higher priority process to preempt the processor . The ready state → Running state : The system selects a process in the ready queue to occupy the processor according to a certain policy , At this point, it becomes the running state .
边栏推荐
- LeetCode_ 392_ Judgement subsequence
- C language force buckle the flipped number of question 7. Violence Act
- [mindspore] [mode] spontaneous_ The difference between mode and graph mode
- Is qiniu Business School reliable? Is it safe to open Huatai account recommended by the lecturer
- EF core :自引用的组织结构树
- px rem em
- Digital signal processing synthesis matlab design of dual tone multi frequency dialing system
- Pain and happiness -nio programming
- Current events on July 20
- paddlepaddle论文系列之Alexnet详解(附源码)
猜你喜欢

paddlepaddle论文系列之Alexnet详解(附源码)

Oracle is not null cannot filter null values

How to use measurement data to drive the improvement of code review

UART

Implement a avatar looping control

Principle of data proxy

Kubernetes application design guide

Multi merchant mall system function disassembly Lecture 14 - platform side member level

Vscode installation and configuration

C language: deep analysis function stack frame
随机推荐
[LeetCode周赛复盘] 第 83 场双周赛20220723
Internal network mapping port to external network
Fast development board for Godson solid state drive startup (burning system to solid state) - partition
[acwing周赛复盘] 第 61 场周赛20220723
MySQL common basic commands
Basic functions of tea
1. Smoke test
7.24 party notice
Implement a avatar looping control
[leetcode weekly replay] 303rd weekly 20220724
How to use measurement data to drive the improvement of code review
Educational events
EF core: self referencing organizational structure tree
[mindspore] [mode] spontaneous_ The difference between mode and graph mode
The use of Multimeter in circuit analysis experiment of Shandong University
Heavy forecast! Analysys, together with Microsoft and the Central University of Finance and economics, talks about the digital economy
Grafana connection tdengine reports an error 535
Heap and stack in embedded development
[LeetCode周赛复盘] 第 303 场周赛20220724
第三章 内核开发