CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of...
-
Upload
roland-carpenter -
Category
Documents
-
view
212 -
download
0
Transcript of CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of...
![Page 1: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/1.jpg)
CIS250
OPERATING SYSTEMS
![Page 2: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/2.jpg)
Chapter 6 - CPU SchedulingBasic Concepts
• The objective of multi-programming is have a program running at all times
• Maximize CPU utilization
• A process executes until it has to wait for something: O/S takes the CPU away and gives it to another process
• CPU scheduler is central to O/S design
![Page 3: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/3.jpg)
CPU-I/O Burst Cycle
• Process CPU, wait…
• Last instruction, terminate, CPU
• > short CPU bursts
• < long CPU bursts
![Page 4: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/4.jpg)
CPU Scheduler
• Short-term scheduler - when the CPU is idle, a process is selected
![Page 5: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/5.jpg)
Preemptive Scheduling
• The process scheduler interrupts a process and transfers the CPU to another process– switch from run to ready– switch from wait to ready
![Page 6: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/6.jpg)
Non-Preemptive
• No interrupts; once a process has the CPU, it runs until there is an I/O interrupt or the process terminates
• No choice; the process keeps CPU until it releases it– process switches from running to wait– process terminates
• No timer is required
![Page 7: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/7.jpg)
Dispatcher
• Gives the control of the CPU to a selected process:– switch context– switch to user mode– jump to a location in the user program and
restart
• Should be fast; the time to stop one process and start another is called dispatch latency
![Page 8: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/8.jpg)
Scheduling Criteria
• Algorithms are used to schedule the CPU time
• Consider the properties for each algorithm– CPU utilization– throughput– turnaround time– waiting time– response time
![Page 9: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/9.jpg)
Scheduling Criteria
• CPU Utilization - keep the CPU busy as much as possible; utilize as close to 100%; realistic - 40-90%
• Throughput - the number of processes that complete in a given time; a measurement of the amount of work being done– 10 processes per second
![Page 10: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/10.jpg)
Scheduling Criteria
• Turnaround Time - how long it takes for a process to run; subtract time of completion from submission start time– wait states are included in this time
• Waiting Time - total amount of time a process spends in the ready queue
• Response Time - amount of time it takes to get a response
![Page 11: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/11.jpg)
• Maximize CPU and throughput
• Minimize turnaround, wait and response time
![Page 12: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/12.jpg)
Scheduling Algorithms
• A method for deciding which process in the ready queue should be allocated the CPU
![Page 13: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/13.jpg)
Scheduling Algorithms
• First-Come, First-Served - non-preemptive; the first process to request the CPU, gets it– uses FIFO queue: PCB is linked to the tail of
the queue; the head gets allocated CPU
• Shortest-Job-First - shortest CPU burst first; if there is a tie, uses FIFO
![Page 14: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/14.jpg)
Scheduling Algorithms
• Priority
• Round-Robin
![Page 15: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/15.jpg)
Scheduling Algorithms
• Multilevel Queue
• Multilevel Feedback Queue
![Page 16: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/16.jpg)
Other Scheduling Models
• Multi-Processor Scheduling
• Real-Time Scheduling
![Page 17: CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.](https://reader036.fdocuments.in/reader036/viewer/2022072006/56649f4c5503460f94c6cd41/html5/thumbnails/17.jpg)
Algorithm Evaluation
• Deterministic modeling
• Queuing models
• Simulations
• Implementation