5 cpu scheduling 1
play

5 CPU Scheduling (1) - PowerPoint PPT Presentation

. . March 26, 2014 March 26, 2014 . . . . . . . . . . . 1 / 61 5 CPU Scheduling (1) ( )


  1. . . March 26, 2014 March 26, 2014 . . . . . . . . . . . 1 / 61 操作系统原理与设计 第 5 章 CPU Scheduling (1) 陈香兰 中国科学技术大学计算机学院 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  2. . . March 26, 2014 for a particular system. To discuss evaluation crieria for selecting a CPU-scheduling algorithm To describe various CPU-scheduling algorithms. To introduce CPU scheduling. . . . . . . . . Chapter Objectives . . . . . 2 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  3. . 6 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . .. OS examples . . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 4 .. . .. . . . . . . Scheduling Algorithms . 1 Basic Concepts . .. 2 Scheduling Criteria . .. 3 3 / 61 提纲—— CPU scheduling (1) 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  4. . . March 26, 2014 Maximum CPU utilization . . . . . . . . Objective of multiprogramming . CPU scheduling is the basis of multiprogrammed OSes . Almost all computer resources are scheduled before use. Scheduling is a fundamental OS function . . . . . Basic Concepts . . . . . . . 4 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  5. . .. .. 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . 6 . OS examples . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . Scheduling Algorithms 3 1 . . . . Outline . . . .. .. Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher . .. 2 Scheduling Criteria . 5 / 61 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  6. . . March 26, 2014 + CPU execution = n (CPU execution + I/O wait) Process execution Begin and end with a CPU burst I/O Bursts Alternating Sequence of CPU And of CPU execution and I/O wait Process execution consists of a cycle CPU-I/O Burst Cycle A property of process : Basic Concepts: CPU-I/O Burst Cycle . . . . 6 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  7. . . . . . . CPU burst distribution Histogram of CPU-burst Times March 26, 2014 7 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  8. . .. .. 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . 6 . OS examples . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . Scheduling Algorithms 3 1 . . . . Outline . . . .. .. Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher . .. 2 Scheduling Criteria . 8 / 61 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  9. . . March 26, 2014 an unordered linked list? a tree? a priority queue? a FIFO Queue? Ready Queue could be: execute and allocates the CPU to the process selects a process from the processes in memory that are ready to CPU scheduler (Short-term Scheduler) CPU Scheduler . . . . 9 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  10. . .. .. 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . 6 . OS examples . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . Scheduling Algorithms 3 1 . . . . Outline . . . .. .. Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher . .. 2 Scheduling Criteria . 10 / 61 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  11. . . March 26, 2014 For 2 & 3, schedule? VS. not schedule? For 1 & 4, must schedule; Terminates 4 . . . Switches from waiting to ready 3 . . . Switches from running to ready state 2 . . . . . Preemptive Scheduling I CPU scheduling decisions may take place when a process: . . . 1 Switches from running to waiting state . . 11 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  12. . . March 26, 2014 If one process is preempted while it is updating the data. . . . . . . . . Two processes sharing data . usually needs a hardware timer, synchronization overhead Mac OS X . . . . Preemptive Scheduling II The scheduling scheme: Windows 3.x before Mac OS X Windows 95 & ... 12 / 61 nonpreemptive( 非抢占式 ) : only 1 & 4 otherwise preemptive( 抢占式 ) data is in an inconsistent( 不一致 ) state 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  13. . . March 26, 2014 synchronization overhead with shared data. needs special HW, for example, a timer. . . . . . . . . COST for preemption . Preemptive Scheduling III . . . . 13 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  14. . . March 26, 2014 some synchronization mechnisms disable interrupt new mechnisms are needed, such as Interrupt affected code VS normal kernel code ? preemptive kernel VS. nonpreemptive kernel ? . . . . . . . some activities that changes important kernel data? What happens if the process is preempted in the middle of Preemption of the OS kernel . . . . 14 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  15. . .. .. 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . 6 . OS examples . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . Scheduling Algorithms 3 1 . . . . Outline . . . .. .. Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher . .. 2 Scheduling Criteria . 15 / 61 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  16. . switching context March 26, 2014 SHOULD be as fast as possible process and start another running program jumping to the proper location in the user program to restart that . switching to user mode selected by the short-term scheduler ; this involves: Dispatcher module gives control of the CPU to the process Dispatcher . . . . 16 / 61 Dispatch latency – time it takes for the dispatcher to stop one 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  17. . interrupt March 26, 2014 execution process real-time dispatch latency available process made . processing 17 / 61 . response interval response to event event . Dispatch latency . . ✛ ✲ ✛ ✲ ✛ ✲ ✛ ✲ ✛ conflicts ✲✛ dispatch ✲ 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  18. . 6 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . .. OS examples . . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . .. Scheduling Algorithms .. . . . . Outline . . 3 . 1 Basic Concepts . .. 2 Scheduling Criteria Scheduling Criteria . .. 18 / 61 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  19. . . . . . . Scheduling Criteria I possible March 26, 2014 19 / 61 CPU utilization ( CPU 利用率)– keep the CPU as busy as conceptually: 0 % ∼ 100 % ; in a real system: 40 % ∼ 90 % 4 核 8 线程编译 Linux 内核时的 CPU 利用率情况( 0 ˜ 7, 总) 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  20. . for short transactions : may be 10 processes per second March 26, 2014 for time-sharing environment submit ted until the first response is produced, not output ready queue ready queue , executing on the CPU, and doing I/O . = the periods spent waiting to get into memory , waiting in the from the time of submission of a process to the time of completion . particular process for long processes : may be 1 process per hour different from one process set to another process set execution per time unit Scheduling Criteria II . . . . 20 / 61 Throughput (吞吐率)– # of processes that complete their Turnaround time ( 周转时间 ) – amount of time to execute a Waiting time – amount of time a process has been waiting in the Response time – amount of time it takes from when a request was 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  21. . . March 26, 2014 different from system to system. . . . . . . . Stability? Average? response time waiting time turnaround time Minimize? throughput CPU utilization Maximize? Optimization Criteria . . . . 21 / 61 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

  22. . .. .. 4 Multiple-Processor Scheduling . .. 5 Real-Time Scheduling . 6 . OS examples . .. 7 Algorithm Evaluation . .. 8 March 26, 2014 . 22 / 61 Priority Scheduling Basic Concepts . . . . Outline . . . .. 1 . .. 2 Scheduling Criteria . .. 3 Scheduling Algorithms FCFS Scheduling SJF Scheduling Round Robin( 时间片轮转 ) Scheduling Multilevel Queue (多级队列) Scheduling Multilevel Feedback Queue (多级反馈队列) Scheduling 小结和作业 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend