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