Scheduling & Dispatching

Slides:



Advertisements
Similar presentations
© 2004, D. J. Foreman 1 Scheduling & Dispatching.
Advertisements

CH 5. CPU Scheduling Basic Concepts F CPU Scheduling  context switching u CPU switching for another process u saving old PCB and loading.
Operating Systems Process Scheduling (Ch 3.2, )
Slide 7-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 7 7 Scheduling.
Scheduling in Batch Systems
Scheduling. Model of Process Execution Ready List Ready List Scheduler CPU Resource Manager Resource Manager Resources Preemption or voluntary yield AllocateRequest.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Slide 7-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 7.
CPU Scheduling Chapter 6 Chapter 6.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Chapter 7 Scheduling Chien-Chung Shen CIS/UD
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
CPU SCHEDULING.
Chapter 6: CPU Scheduling
Dan C. Marinescu Office: HEC 439 B. Office hours: M, Wd 3 – 4:30 PM.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Chapter 5a: CPU Scheduling
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Uniprocessor Scheduling
Chapter 2 Scheduling.
Operating Systems Processes Scheduling.
Chapter 2.2 : Process Scheduling
Scheduling (Priority Based)
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Andy Wang Operating Systems COP 4610 / CGS 5765
Lecture 21: Introduction to Process Scheduling
Outline Announcements Process Management – continued
Operating System Concepts
Chapter5: CPU Scheduling
TDC 311 Process Scheduling.
Scheduling.
Chapter 5: CPU Scheduling
CPU SCHEDULING.
Outline Scheduling algorithms Multi-processor scheduling
Chapter 6: CPU Scheduling
CGS 3763 Operating Systems Concepts Spring 2013
Process Scheduling Decide which process should run and for how long
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Scheduling.
Lecture 21: Introduction to Process Scheduling
Outline Announcements Process Scheduling– continued
Processor Scheduling Hank Levy 1.
Outline Announcement Process Scheduling– continued
Scheduling & Dispatching
Shortest-Job-First (SJR) Scheduling
Scheduling 21 May 2019.
Uniprocessor Scheduling
Uniprocessor Scheduling
CPU Scheduling: Basic Concepts
CPU Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Scheduling & Dispatching © 2004, D. J. Foreman

What is "Scheduling"? Managing resources and demands for them Determine next "run-user" Determine resources required Add new "run-user" to "ready" list All above usually done in kernel mode "Run-user" Current thread/process that is executing © 2004, D. J. Foreman

What is "Dispatching"? Determine user at head of "ready list" Preempt/wait for current run-user to yield Save state of current run-user Load state data for new run-user Mode switch to new run-user © 2004, D. J. Foreman

Questions How would you design a scheduler that runs in user-mode? What problems would you have to handle? Why would you want to run it in user-mode? © 2004, D. J. Foreman

What is a “job”? Fixed set of programs (NOT processes) Sort employee records Compute wages for each employee Print checks for all employees Resources pre-specified by “job control” statements Employee DB Payroll DB High-speed printer Programs run in strict sequence © 2004, D. J. Foreman

How is the scheduler invoked? Voluntary Process/thread blocks itself (“yield”s the CPU) Calls scheduler Processes can yield to each other Problems-> greed, errors Involuntary Pre-emption by interrupt (device/timer) Kernel calls scheduler before/after interrupt is processed, before return to pre-empted user CIMPAC is a voluntary system © 2004, D. J. Foreman

Policies Ideally Practically Additionally Selectable Changeable Built into OS Can be changed with versions of OS Additionally Scheduler can BE the Resource Manager © 2004, D. J. Foreman

Control Interval timer Multiple policies possible in one system Quantum or slice Fixed or variable Multiple policies possible in one system Interactive applications May become compute-bound Batch jobs Deadline production Real-time – process-control systems © 2004, D. J. Foreman

Policy implimentation Mechanism – fixed Varies by requirements CPU usage Wait time Job completion time Controls: Fair share Favor long/short jobs Priorities Deadlines © 2004, D. J. Foreman

Scheduling Variables Let P = {pi | 0  i < n}, be a set of processes Let {Pij} = set of threads, j, in Pi Let S(pi)  {running, ready, blocked} Let t(pi) = required runtime or service time Let W(pi) = initial wait time Let TTRnd(pi) = wall clock: endtime – start time (turnaround time) Batch Throughput rate = 1/(avg TTRnd) Timesharing response time = W(pi) © 2004, D. J. Foreman

Optimizing Schedules Criteria Methods CPU usage Wait time Deadlines Restrict # of processes pi Pre-determine service time τ(pi) Compute all schedules and choose best © 2004, D. J. Foreman

Optimization problems τ(pi) are estimates Schedule-compute time is O(n2) Only an approximation of optimum New jobs arrive during processing © 2004, D. J. Foreman

Estimating CPU Utilization l = average rate at which processes are placed in the Ready List= arrival rate (arrivals/sec) m = the average service rate  1/ m = the average service time, t(pi), per process r = expected CPU busy time, computed as: r = arrival rate * avg CPU time each r = l * 1/ m = l / m Notice: must have l < m (i.e., r < 1) What if r approaches 1? © 2004, D. J. Foreman

Non-preemptive Schedulers Using the simplified scheduling model: new->ready-> scheduled-> running->done Only considers running and ready states Ignores time in blocked state: New process created when it becomes ready Process is destroyed when it is blocked Only looking at “small phases” of a process © 2004, D. J. Foreman

Non-preemptive Schedulers First Come First Served Shortest Job Next Priority Deadline © 2004, D. J. Foreman

First Come, First Served Simple Ignores service time Average wait time=simple avg of all W(p) Predicted W(p)=Wavg Wavg=Lw/m + .5/m = (L/m) +1/(2m) © 2004, D. J. Foreman

Shortest Job Next Minimizes wait time “Bad” jobs may take excessive time Service times must be known in advance Known for batch systems © 2004, D. J. Foreman

Priority Pre-determined rules required Low priority jobs may get poor service Addressable via Age Re-assesment Other resource requirements © 2004, D. J. Foreman

Deadline Based on required finish time Requires known runtime © 2004, D. J. Foreman

Preemptive Scheduling Almost always by priority Most common form today Complex analysis Requires interval timer support Examples: Round Robin (RR) Round Robin with Overhead (RRO) Multi-level queues © 2004, D. J. Foreman

Round Robin Each process gets a fixed time slice to run (Time in Queue) Fair share Most common preemptive scheduler today Optional placement of new processes: queue vs. ring For n processes, q CPU units, C context Total real time available=n*(q+C) Or q=(T/n)-C C is usually ignored, but should not be © 2004, D. J. Foreman

RR w/Overhead included Fixed overhead for C added between slices Changes average performance time © 2004, D. J. Foreman

Multi-level Queues More than 1 ready list Interactive Small batch Large batch Compute bound Top-level queue must clear before next level runs Within a level use RR, etc © 2004, D. J. Foreman

Current systems Linux BSD 4.4 Win 2K/NT/XP/7/10 See book for descriptions © 2004, D. J. Foreman