《操作系统》课程教学资源(PPT课件)第六章 CPU Scheduling

Module 6: CPU Scheduling Basic Concepts(基本概念) ° Scheduling criteria(调度准则) ° Scheduling Algorithms(调度算法) Multiple- Processor Scheduling(多处理器调度) ° Real-Time Scheduling(实时调度) ° Algorithm Evaluation(算法评估) Applied Operating System Concepts Silberschatz, Galvin, and Gagne @1999
6.1 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Module 6: CPU Scheduling • Basic Concepts (基本概念) • Scheduling Criteria (调度准则) • Scheduling Algorithms (调度算法) • Multiple-Processor Scheduling (多处理器调度) • Real-Time Scheduling (实时调度) • Algorithm Evaluation (算法评估)

Basic Concepts Maximum CPU utilization obtained with multiprogramming (通过多道程序设计得到cPU的最高利用率) CPU-1l0 Burst Cycle- Process execution consists of a cycle of CPU execution and l/o wait (cPU-/O脉冲周期-进程的执行包括进程在cPU上执行和等待Ⅳo) CPU burst distribution (cPU脉冲的分布) Applied Operating System Concepts 62 Silberschatz, Galvin, and Gagne @1999
6.2 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Basic Concepts • Maximum CPU utilization obtained with multiprogramming (通过多道程序设计得到CPU的最高利用率) • CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait. (CPU-I/O脉冲周期- 进程的执行包括进程在CPU上执行和等待I/O) • CPU burst distribution (CPU脉冲的分布)

Alternating Sequence of CPU And l/o Bursts load store add store d from file CPU burst wait for I/O 1/O burst store increment index CPU burst write to file air for 1/ load store add store read from file CPU burst wait for 1/O v/o burst Applied Operating System Concepts 6.3 Silberschatz, Galvin, and Gagne @1999
6.3 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Alternating Sequence of CPU And I/O Bursts

Histogram of CPU-burst Times 160 140 120 8100 000 burst duration(milliseconds) Applied Operating System Concepts 6.4 Silberschatz, Galvin, and Gagne @1999
6.4 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Histogram of CPU-burst Times

CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the cpu to one of them.(选择内存 中的就绪进程,并分配cPU给其中之一) CPU scheduling decisions may take place when a process (cPU调度可能发生在当一个进程): 1. Switches from running to waiting state(从运行转到等待) 2 Switches from running to ready state(从运行转到就绪) 3 Switches from waiting to ready(从等待转到就绪) 4. Terminates(终止运行) Scheduling under1and4 is nonpreemptive(发生在1、4两 种情况下的调度称为非抢占式调度) All other scheduling is preemptive(其他情况下发生的调度称 为抢占式调度) Applied Operating System Concepts 6.5 Silberschatz, Galvin, and Gagne @1999
6.5 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts CPU Scheduler • Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them.(选择内存 中的就绪进程,并分配CPU给其中之一) • CPU scheduling decisions may take place when a process (CPU调度可能发生在当一个进程): 1. Switches from running to waiting state(从运行转到等待). 2. Switches from running to ready state(从运行转到就绪). 3. Switches from waiting to ready(从等待转到就绪). 4. Terminates(终止运行). • Scheduling under 1 and 4 is nonpreemptive (发生在1、4两 种情况下的调度称为非抢占式调度). • All other scheduling is preemptive (其他情况下发生的调度称 为抢占式调度)

Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves(进程调 度模块负责将对cPU的控制权转交给由cPU调度程序,包括): switching context(切换上下文) switching to user mode(切换到用户态) jumping to the proper location in the user program to restart that program(跳转到用户程序的适当位置并重新运 行之) Dispatch latency-time it takes for the dispatcher to stop one process and start another running(调度时间一调度程序 终止一个进程的运行并启动另一个进程运行所花的时间) Applied Operating System Concepts 6 Silberschatz, Galvin, and Gagne @1999
6.6 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Dispatcher • Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves(进程调 度模块负责将对CPU的控制权转交给由CPU调度程序,包括): – switching context(切换上下文) – switching to user mode(切换到用户态) – jumping to the proper location in the user program to restart that program(跳转到用户程序的适当位置并重新运 行之) • Dispatch latency – time it takes for the dispatcher to stop one process and start another running(调度时间 – 调度程序 终止一个进程的运行并启动另一个进程运行所花的时间)

Scheduling Criteria CPU utilization- keep the CPU as busy as possible (CPU利用率一使cPU尽可能的忙碌) Throughput- the number of processes that complete their execution per time unit(吞吐量一单位时间内运行完的进程数 Turnaround time- the interval from submission to completion(周转时间一进程从提交到运行结束的全部时间 Waiting time- amount of time a process has been waiting in the ready queue(等待时间一进程在就绪队列中等待调度的时间 片总和) Response time -amount of time it takes from when a request was submitted until the first response is produced not output( for time-sharing environment)(响应时间一从进 程提出请求到首次被响应[面而不是输出结果]的时间段[在分时系统 环境下]) Applied Operating System Concepts 67 Silberschatz, Galvin, and Gagne @1999
6.7 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Scheduling Criteria • CPU utilization – keep the CPU as busy as possible (CPU利用率 – 使CPU尽可能的忙碌) • Throughput – the number of processes that complete their execution per time unit(吞吐量– 单位时间内运行完的进程数 ) • Turnaround time – the interval from submission to completion (周转时间– 进程从提交到运行结束的全部时间 ) • Waiting time – amount of time a process has been waiting in the ready queue(等待时间 – 进程在就绪队列中等待调度的时间 片总和 ) • Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)(响应时间 – 从进 程提出请求到 首次被响应[而不是输出结果]的时间段[在分时系统 环境下] )

Optimization Criteria ● Max cpu util| ization (最大的cPU利用率) ° Max throughput (最大的吞吐量) o Min turnaround time (最短的周转时间) ° Min waiting time (最短的等待时间) e Min response time (最短的响应时间) Applied Operating System Concepts 6.8 Silberschatz, Galvin, and Gagne @1999
6.8 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Optimization Criteria • Max CPU utilization (最大的CPU利用率) • Max throughput (最大的吞吐量) • Min turnaround time (最短的周转时间) • Min waiting time (最短的等待时间) • Min response time (最短的响应时间)

First-Come, First-served (FCFS)Scheduling ° EXample Process Burst time 24 3 3 Suppose that the processes arrive in the order(假定进程到达顺一 序如下):P1,P2,P3 The Gantt Chart for the schedule is(该调度的 Gantt图为): 24 27 30 ° Waiting time(等待时间)forP1=0;P2=24;P3=27 · Average waiting time(平均等待时间):(0+24+27)/3=17 Applied Operating System Concepts 6.9 Silberschatz, Galvin, and Gagne @1999
6.9 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts First-Come, First-Served (FCFS) Scheduling • Example: Process Burst Time P1 24 P2 3 P3 3 • Suppose that the processes arrive in the order(假定进程到达顺 序如下): P1 , P2 , P3 The Gantt Chart for the schedule is(该调度的Gantt图为): • Waiting time(等待时间) for P1 = 0; P2 = 24; P3 = 27 • Average waiting time(平均等待时间): (0 + 24 + 27)/3 = 17 P1 P2 P3 0 24 27 30

FCFS Scheduling(Cont Suppose that the processes arrive in the order(假定进程到达顺序 如下)P2,P3,P1 The gantt chart for the schedule is(该调度的Gant图为) 0 3 6 30 ° Waiting time(等待时间)forP1=6;P2=0.P3= ° Average waiting time(平均等待时间):(6+0+3)/3=3 Much better than previous case(比前例好得多) Convoy effect short process behind long process (此种结果产生是由于长进程先于短进程到达) Applied Operating System Concepts 6.10 Silberschatz, Galvin, and Gagne @1999
6.10 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts FCFS Scheduling (Cont.) Suppose that the processes arrive in the order (假定进程到达顺序 如下) P2 , P3 , P1 . • The Gantt chart for the schedule is (该调度的Gantt图为) : • Waiting time (等待时间) for P1 = 6; P2 = 0; P3 = 3 • Average waiting time (平均等待时间) : (6 + 0 + 3)/3 = 3 • Much better than previous case(比前例好得多). • Convoy effect short process behind long process (此种结果产生是由于长进程先于短进程到达) P2 P3 P1 0 3 6 30
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《操作系统》课程教学资源(PPT课件)第八章 Deadlocks(死锁).ppt
- 《操作系统》课程教学资源(PPT课件)第五章 Threads线程.ppt
- 《操作系统》课程教学资源(PPT课件)第二章 Computer-System Structures 计算机系统结构.ppt
- 《操作系统》课程教学资源(PPT课件)第九章 Memory Management.ppt
- 《操作系统》课程教学资源(PPT课件)第三章 Operating-System Structures 操作系统结构.ppt
- 《操作系统》课程教学资源(PPT课件)第七章 Process Synchronization.ppt
- 《操作系统》课程教学资源(PPT课件)第一章 Introduction 引论.ppt
- 《操作系统》课程教学资源(PPT课件)Applied Operating System Concepts(AOSC)介绍.ppt
- 国防科技大学:《复杂网络可靠性研究》 概述讲解.ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)第九章 图象分析(数学形态学图像处理、遥感信息处理).ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)第九章 图象分析(分割、描绘).ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)第八章 三维图像处理技术.ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)预测编码、变换编码、静态图象的一些主要数据文件压缩方式、图象编码的国际标准.ppt
- 《数字图象处理》 第七章(7-5) 算术编码.ppt
- 《数字图象处理》 第七章(7-4) 统计编码.ppt
- 《数字图象处理》 第七章 图象编码.ppt
- 《数字图象处理》 第六章 图象复原.ppt
- 《数字图象处理》 第五章(5-7) 图像几何处理.ppt
- 《数字图象处理》 第五章(5-4) 图像尖锐化处理.ppt
- 《数字图象处理》 第五章(5-1) 图像增强.ppt
- 《操作系统》课程教学资源(PPT课件)第十一章 File-System Interface(文件系统接口).ppt
- 《操作系统》课程教学资源(PPT课件)第十三章 Secondary-Storage 二级存储.ppt
- 《操作系统》课程教学资源(PPT课件)第十九章 Security(安全).ppt
- 《操作系统》课程教学资源(PPT课件)第十二章 I/O Systems(I/O系统).ppt
- 《操作系统》课程教学资源(PPT课件)第十八章 Protection(保护).ppt
- 《操作系统》课程教学资源(PPT课件)第十章 Virtual Memory.ppt
- 《操作系统》课程教学资源(PPT课件)第四章 Processes 进程.ppt
- 《实用网络技术》 第四章(4-1) 网络技术基础.ppt
- 《实用网络技术》 第四章(4-2) 同轴电缆.ppt
- 《实用网络技术》 第四章(4-3) 地球同步卫星.ppt
- 《实用网络技术》 第四章(4-4).ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)内容导航(崔雅娟).ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第一章 程序设计概述.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第七章 指针.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第三章 语句及控制结构.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第九章 文件.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第二章 数据类型、运算符与表达式.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第五章 预处理命令.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第八章 结构及其它.ppt
- 北京语言文化大学:《C语言程序设计导论》课程教学资源(PPT课件)第六章 数组.ppt