当前位置:网站首页>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 .
边栏推荐
- Regular expression learning
- 3. Pressure test
- Does opengauss support using Sqlalchemy connections?
- Notes on topic brushing (XXII) -- Dynamic Planning: basic ideas and topics
- Wechat applet development learning 5 (custom components)
- Managing databases in a hybrid cloud: eight key considerations
- Verification of Kirchhoff's law and Multisim Simulation (engineering documents attached)
- ===、==、Object. Is basic package type
- [mindspore] [training warning] warning when executing training code
- The use of Multimeter in circuit analysis experiment of Shandong University
猜你喜欢

Why do I have to clean up data?

QT learning - using database singleton to complete login matching + registration function

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

Notes on topic brushing (XXII) -- Dynamic Planning: basic ideas and topics

The font changes with the change of the form

What is the function of transdata operator and whether it can optimize performance

2. Load test

Branch and loop statements in C language learning

Pain and happiness -nio programming

Internal network mapping port to external network
随机推荐
2022 Henan Mengxin League game (2): Henan University of technology d-pair
[Bert] transformer/bert/attention interview questions and answers
1. Smoke test
Simple use of mongodb database
What can testers do when there is an online bug?
Codeworks round 650 (Div. 3) ABCD solution
启牛商学院靠谱吗?讲课老师推荐开华泰账户安全吗
===、==、Object. Is basic package type
BGP machine room and BGP
Uncaught typeerror: cannot read properties of null (reading 'append') solution
Mobile terminal touch event
Lambda&Stream
Install K6 test tool
LeetCode_ 6124_ The first letter that appears twice
Advanced function of postman
EF core :自引用的组织结构树
Principle of data proxy
在混合云中管理数据库:八个关键注意事项
2022 Henan Mengxin League game 2: Henan University of technology K - Rice
Heavy forecast! Analysys, together with Microsoft and the Central University of Finance and economics, talks about the digital economy