Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
Advertisements

Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chap 5 Process Scheduling. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CPU Scheduling CS 3100 CPU Scheduling1. Objectives To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various.
Chapter 3: CPU Scheduling
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
Chapter 5-CPU Scheduling
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Job scheduling Queue discipline.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Basic Concepts Maximum CPU utilization.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Scheduler What is the job of.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
Peng Lu. CPU Scheduling 1. Basic Concepts 2. Scheduling Criteria 3. Scheduling Algorithms 4. Multiple-Processor Scheduling 5. Real-Time Scheduling 2.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 5: CPU Scheduling Basic.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU Scheduling G.Anuradha Reference : Galvin. CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5a: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Presentation transcript:

Chapter 6 Scheduling

Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other program should execute if waiting for I/O

Preemptive Scheduling Takes place under the following conditions –I/O request or other request –interrupt –completion of I/O –termination Non-preemptive scheduling –scheduling takes place only on conditions 1 and 4 Preemptive scheduling –scheduling takes place on conditions 2 and/or 3

Preemptive Scheduling Can cause problems in critical sections –Either in user space –or in system space Disable interrupts for critical code sections

Dispatcher Module in OS that gives control of the CPU to the process selected by the short- term scheduler Involves –Switching context –Switching to user mode –jumping to the proper address to restart execution

Scheduling Criteria CPU utilization –should range from 40% to 90% Throughput –measured in processes per second Turnaround time –sum of periods spent from request to end waiting time –sum of the periods spent waiting in the ready queue response time – amount of time it takes to start responding –(not the time to output that response) –minimum variance

Scheduling Algorithms First-come first served Shortest-job-firstpriorityround-robin multilevel queue multilevel feedback queue

First-come first served Consider a set of processes that arrive in the given order. The CPU-burst time is given for each process. –p1: 24 ms –p2: 3 ms –p3: 3 ms P1P2P Gantt chart

Shortest-Job-First Processes: –p1: 24 ms –p2: 3 ms –p3: 3 ms P1P2P Gantt chart

Shortest-job first Provably optimal scheduling algorithm But… need to know the length of the next job. Can be estimated by computing the exponential average

Shortest job first Can be preemptive or non-preemptive –preemptive SJF is sometimes called shortest remaining time first scheduling What is Gantt chart for the following? –Process: arrival time: burst time –p1:0:8 –p2:1:4 –p3:2:9 –p4:3:5

Priority Scheduling Go from high priority to low priority Consider: –Process: arrival: time: priority –p1:0:10:3 –p2:1:1:1 –p3:2:2:4 –p4:4:1:5 –p5:6:5:2 What does Gantt chart look like? How do we prevent starvation?

Round-Robin Scheduling Designed especially for time-sharing systems. FCFS with preemption time quantum –amount of time a process will run before preemption –usually from ms Circular ready queue Consider –time quantum of 4ms –Process:time –p1:24 –p2:3 –p3:3 What is average waiting time? What happens if time quantum is too small?

Round-Robin Scheduling Consider –P1: 6 –p2: 3 –P3: 1 –P4: 7 What happens to turn-around time as the time-quantum changes? Good rule of thumb: 80% of processes should be smaller than time-quantum

Multi-level Queue Scheduling Divides processes into different groups –background –foreground Each queue has its own scheduling algorithm (like round robin) Must also have a scheduling algorithm between queues –fixed-priority preemptive scheduling –time slice various queues

Multi-level Feedback Queue Scheduling Allows a process to move between queues purpose is to separate processes with different CPU-burst time characteristics High burst-time processes are moved into lower priority queues. Why? Algorithm –Processes are added to first queue. –if a process doesn’t complete in required time for that queue, it is placed at the tail of the next queue. –processes in higher queues preempt lower queues

Multiple-processor scheduling What kind of scheduling algorithm is best? –different queue per processor? –each processor examines one ready queue? –processors assigned to different tasks ex. I/O –others?? Which is better symmetric multi-processing or asymmetric multi-processing?

Real-time Scheduling Hard Real-time systems –must complete a critical task within a certain amount of time –Process is admitted along with an I/O time-estimate –Scheduler admits process or rejects it as impossible –Difficult or impossible if using secondary storage. why? Soft real-time systems –requires critical processes scheduled before less-critical processes –needs priorities. why? –needs small dispatch latency. why? –what about long kernel sections?

Real-time scheduling event response to event response interval process made available interrupt processing real-time process execution dispatch latency conflicts dispatch

Real-time scheduling Problem Priority inversion –higher priority processes waiting for lower priority processes to release resource solved by priority-inheritance protocol –lower-priority processes with a needed resource assume the priority of the requesting process

Algorithm Evaluation Select evaluation criteria –Ex. Maximize CPU utilization with the constraint that the max response time is 1 second maximize throughput such that turnaround time is linearly proportional to total execution time Select an evaluation method

Evaluation methods Deterministic Modeling –know specific process burst times –use Gantt chart Queuing Models –use mathematical equations –If we know any two of the following, we can compute the other. average arrival rate number of processes in queue expected waiting time per process Simulations –full simulation of processor system –random distribution of process wait time and arrival time Little’s Formula

Solaris 2 priority-based process scheduling –4 classes of scheduling real-timesystem time sharing interactive –Scheduling policy dynamically alters scheduling priorities using a multi-level feedback approach

Windows 2000 Priority-based preemptive scheduling algorithm 32-level priority scheme –Two classes of priorities variable: 1-15 real-time class : –Several priority classes REALTIME_PRIORITY_CLASSHIGH_PRIORITY_CLASS…IDLE_PRIORITY_CLASS –Within each priority class there is a relative priority Time_CriticalHighest…LowestIdle

Windows 2000 When thread’s time quantum runs out –thread is interrupted –priority is lowered (1-15) –never lowered below base priority Distinguishes between –foreground processes increase time quanta by x3 –background processes

Linux Two separate process-scheduling algorithms –time sharing algorithm for fair preemptive scheduling –real-time tasks Linux uses a prioritized credit-based algorithm –process starts with a number of scheduling credits –process with most credits is run next –each time a timer interrupt occurs the running process loses one credit –when running processes credit reaches 0, another process is started –If no runnable processes have credits add credits to every process in the system credits = credits/2 + priority Processes that spend much of their time suspended accumulate credits Real-time scheduling –FCFS –RR