Scheduling Dave Eckhardt Outline ● Chapter 6: Scheduling.

Slides:



Advertisements
Similar presentations
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Advertisements

CPU Scheduling Tanenbaum Ch 2.4 Silberchatz and Galvin Ch 5.
Operating Systems Process Scheduling (Ch 3.2, )
CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
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
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
Operating System Process Scheduling (Ch 4.2, )
Operating System I Process Scheduling. Schedulers F Short-Term –“Which process gets the CPU?” –Fast, since once per 100 ms F Long-Term (batch) –“Which.
CS444/CS544 Operating Systems Scheduling 1/31/2007 Prof. Searleman
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
Job scheduling Queue discipline.
Operating Systems Process Scheduling (Ch 4.2, )
Operating System Process Scheduling (Ch 4.2, )
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
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.
Operating Systems Part III: Process Management (CPU Scheduling)
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.
CSC 360- Instructor: K. Wu CPU Scheduling. CSC 360- Instructor: K. Wu Agenda 1.What is CPU scheduling? 2.CPU burst distribution 3.CPU scheduler and dispatcher.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
15-410, F’ Scheduling Oct. 29, 2004 Dave Eckhardt Bruce Maggs L22a_Scheduling “...Everything old is new again...”
Chapter 5 – CPU Scheduling (Pgs 183 – 218). CPU Scheduling  Goal: To get as much done as possible  How: By never letting the CPU sit "idle" and not.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
ICS Principles of Operating Systems Lecture 5 - CPU Scheduling Prof. Nalini Venkatasubramanian
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
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.
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.
CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.
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.
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.
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.
Scheduling Dave Eckhardt Synchronization ● “Pop Quiz” ● Project 2 ● Outline – Chapter 6.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
lecture 5: CPU Scheduling
Chapter 6: CPU Scheduling
CS 143A - Principles of Operating Systems
Module 5: CPU Scheduling
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
“...Everything old is new again...”
Presentation transcript:

Scheduling Dave Eckhardt

Outline ● Chapter 6: Scheduling

CPU-I/O Cycle ● Process view: 2 states – Running – Waiting for I/O ● Life Cycle – I/O (load), CPU, I/O, CPU,.., CPU (exit)

CPU Burst Lengths ● Overall – Exponential fall-off in CPU burst length

CPU Burst Lengths ● CPU-bound – Batch job – Long CPU bursts

CPU Burst Lengths ● I/O-bound – Copy, Data acquisition,... – Tiny CPU bursts

Preemptive? ● Four opportunities to schedule – Running process waits (I/O, child,...) – Running process exits – Waiting process becomes runnable (I/O done) – Other interrupt (clock, page fault) ● Multitasking types – Fully Preemptive: All four cause scheduling – “Cooperative”: only first two

CPU Scheduler ● Invoked when CPU becomes idle – Current task blocks – Clock interrupt ● Select next task – Quickly – PCB's in: FIFO, priority queue, tree ● Switch (using “Dispatcher”)

Dispatcher ● Set down running task – Save register state – Update CPU usage information – Store PCB in “run queue” ● Pick up designated task – Activate new task's memory ● Protection, mapping – Restore register state – Transfer to user mode

Scheduling Criteria ● Maximize/trade off – CPU utilization (“busy-ness”) – Throughput (“jobs per second”) ● Process view – Turnaround time (everything) – Waiting time (runnable but not running) ● User view – Response time (input/output latency)

Algorithms ● Don't try these at home – FCFS – SJF – Priority ● Reasonable – Round-Robin – Multi-level (plus feedback) ● Multiprocessor, real-time

FCFS- First Come, First Served ● Basic idea – Run task until relinquishes CPU – When runnable, place at end of FIFO queue ● Waiting time very dependent on mix ● “Convoy effect” – N tasks each make 1 I/O request, stall – 1 tasks executes very long CPU burst – Lather, rinse, repeat

SJF- Shortest Job First ● Basic idea – Choose task with shortest next CPU burst – Provably “optimal” ● Minimizes average waiting time across tasks – Practically impossible (oh, well) ● Could predict next burst length... – Text presents exponential average – Does not present evaluation (Why not? Hmm...)

Priority ● Basic idea – Choose “most important” waiting task ● Does “high priority” mean p=0 or p=255 ? ● Priority assignment – Static: fixed property (engineered?) – Dynamic: function of task behavior ● Big problem: Starvation – Possible hack: aging

Round-Robin ● Basic idea – Run each task for a fixed “time quantum” – When quantum expires, append to FIFO queue ● “Fair” – But not “provably optimal” ● Choosing quantum length – Infinite = FCFS, Infinitesimal = “Processor sharing” – Balance “fairness” vs. context-switch costs

True “Processor Sharing” ● CDC Peripheral Processors ● Memory latency – Long, predictable – Every instruction ● Solution: round robin – Quantum = 1 instruction ● ~ Intel “superthreading”

Multi-level Queue ● N independent process queues – One per priority – Algorithm per-queue

Multi-level Queue ● Inter-queue scheduling – Strict priority ● Pri 0 runs before Pri 1, Pri 1 runs before batch – every time – Time slicing (e.g., weighted round-robin) ● Pri 0 gets 2 slices ● Pri 1 gets 1 slice ● Batch gets 1 slice

Multi-level Feedback Queue ● N queues, different quanta ● Exhaust your quantum? – Demoted to slower queue ● Longer quantum ● Lower priority ● Can you be promoted back up? – Maybe I/O promotes you – Maybe you “age” upward ● Popular “time-sharing” scheduler

Multiprocessor Scheduling ● Common assumptions – Homogeneous processors (same speed) – Uniform memory access (UMA) ● Load sharing / Load balancing – Single global ready queue – no false idleness ● Processor Affinity – Some processor may be more desirable or necessary – Special I/O device – Fast thread switch

Multiprocessor Scheduling - “SMP” ● Asymmetric multiprocessing – One processor is “special” ● Executes all kernel-mode instructions ● Schedules other processors – “Special” aka “bottleneck” ● Symmetric multiprocessing - “SMP” – “Gold standard” – Tricky

Real-time Scheduling ● Hard real-time – System must always meet performance goals ● Or it's broken (think: avionics) – Designers must describe task requirements ● Worst-case execution time of instruction sequences – “Prove” system response time ● Argument or automatic verifier – Cannot use indeterminate-time technologies ● Disks!

Real-time Scheduling ● Soft real-time – “Occasional” deadline failures tolerable ● CNN video clip on PC ● DVD playback on PC – Much cheaper than hard real-time ● Real-time extension to timesharing OS – POSIX real-time extensions for Unix ● Can estimate (vs. prove) task needs – Priority scheduler – Preemptible OS

Scheduler Evaluation Approaches ● “Deterministic modeling” – aka “hand execution” ● Queueing theory – Math gets big fast – Math sensitive to assumptions – May be unrealistic (aka “wrong”) ● Simulation – Workload model or trace-driven – GIGO hazard (either way)

Summary ● Round-robin is ok for simple cases – Certainly 80% of the conceptual weight – Certainly good enough for P3 ● “Real” systems – Some multi-level feedback – Probably some soft real-time