操作系统5种调度算法
The work
1 2 3 4 5
Arrival time
0 1 2 3 4
running time
complete time
The turnaround time(C-A)
19 1 6 2 12 8.0 2.06
Weighted turnaround time(T/R)
1.9 1.0 3.0 2.0 2.4
This is the flow chart of FCFS:
This is the flow chart of SPN:
This is the flow chart of RR:
This is the flow chart of :High response ratio priority scheduling algorithm
• 优点:算法的平均时间比短进程优先算法短; • 缺点:很难准确评估进程剩余时间,对长时间进程不公平;
The size of a time slice:
1. The system requirements for response time . 2. The number of processes in the ready queue .
例题:
进程 P1 P2 P3 P4 到达时间 0 5 10 15 服务时间 20 15 5 10
• 计算周转时间和带权周转时间?
Short Process Priority Scheduling Algorithm——邰再成
• What is a short process priority scheduling algorithm? • The basic idea is what? • Use this algorithm to do the topic? • What are the strengths and weaknesses of the it?
10 1 2 1 5
19 2 8 5 16
The average turnaround time: The weighted average turnaround time :
• Advantages:
•
For long, if wait long enough, priority is high also, also can get the CPU. To solve the short assignment priority algorithm, long assignment operation is not guaranteed. Is introduced into the algorithm.
三、The team member introduction algorithm.
Summary in operating system
The First of all, we need to know the following questions: 1、What is a scheduling algorithm? Operating system management of the limited resources of the system, when there are multiple processes (or multiple processes request) to use these resources, because of the limited resources, we must choose the process according to certain principles (request) to occupy resources. This is the scheduling. 2、What is the principle of scheduling algorithm? In the system perspective fairness: each process (regardless of priority) has the opportunity to be run; the larger the throughput. User perspective: timeliness: response speed should be fast; shorter turnaround time: should not allow users to wait too long. 3、What are the levels of scheduling? (1)High level Scheduling (3)Intermediate Scheduling (2)Low level Scheduling
• 高响应比优先调度算法既考虑作业的执行时间也考 虑作业的等待时间,综合了先来先服务和最短作业 优先两种算法的特点. • 响应比的计算: • 响应比=(等待时间+要求服务时间)/要求服务时 间=(W+S)/S
周转时间和带权周转时间
1、周转时间:系统从进入系统到完成的时间总量 2、带权周转时间:反应作业长短问题,周转时间越 大,作业越短。 3、带权周转时间计算:周转时间/服务时间
最短剩余时间调度——夏召可
• 剩余最短时间者优先: • 总是选择预期剩余时间最短的进程 • 目的: • 使将要结束的进程尽早结束,释放系统资源,让其他进程尽早执行;
进 程 A B
到达时间 0 2
服务时间 2 6
C
D
5
6
3
4
平均周转时间:[2+(11-2)+(8-5)+(15-10)]/4=4.75
• 1 as shown in the following table. First come first served scheduling algorithm, draw a schematic diagram of the scheduling and calculate the average turnaround time of the algorithm for the number of hours per unit time.
10 1 2
4
5
1
5
• Use an execution sequence diagrams describe RR (time = 1) algorithm to perform these operations, and calculate the turnaround time, average turnaround time of each job, weighted weighted and turnaround time, average turnaround time?
Notes:
• I/O process: let it into the highest priority queue, and the I/O response interaction. Usually perform a small time, requirements can be processed an I/O request data, and then transferred into blocking queue.
The group display section
First come first served scheduling algorithm——肖玉江
• First come first served (FCFS, Come First Serve First) is the most simple scheduling algorithm, according to the order of scheduling. According to the sequence of job submission or process into the ready state, dispatch CPU.
completely not considering the degree of urgency of homework.
• (2) to estimate the process execution time is difficult to predict.
Thank you everyone!
• Figure:
average turnaround time=(4+5.5+5.5)/3=5 hours.
• There is a user space 100K, and the provisions of the operation of the corresponding program into a continuous memory area, and can not be moved, job and process are using FCFS algorithm.
operation, running them to memory.
process
Time of arrival Service time (Ts)
A
0
B
2
C4D6E Nhomakorabea8
4
3
6
5
2
The average
SPN Completion time Turnaround time (Tr) Tr/Ts
4 7 20 12 14
3. The processing capacity of the system .
Example: if under the condition of single CPU has to perform the following operations:
The work
1 2 3
Running time