Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.

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

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
Operating Systems Chapter 6
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
02/06/2008CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Job scheduling Queue discipline.
1 Scheduling Algorithms FCFS First-Come, First-Served Round-robin SJF Multilevel Feedback Queues.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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.
More Scheduling cs550 Operating Systems David Monismith.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
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.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: 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, Lecture 7: CPU Scheduling Chapter 5.
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.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
CSC 322 Operating Systems Concepts Lecture - 10: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
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
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
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.
CPU SCHEDULING.
Chapter 5a: CPU Scheduling
Chapter 2 Scheduling.
Operating Systems Processes Scheduling.
Scheduling (Priority Based)
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Lecture 23: Process Scheduling for Interactive Systems
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 21: Introduction to Process Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Outline Scheduling algorithms Multi-processor scheduling
CPU scheduling decisions may take place when a process:
Lecture 21: Introduction to Process Scheduling
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch Systems (Compute Servers) –Many processes, not interactive, throughput is important Real Time Systems –Guaranteed response times, must meet deadlines

Cpr E 308 Spring 2005 Context Switch One process stops and another one starts Process Contexts stored in the Kernel Process Table Significant Overhead for each Context Switch

Cpr E 308 Spring 2005 Non Preemptive Scheduling Context Switch happens only when the process gives up the CPU (wait for I/O, process completes, etc) –Example: DOS Bad: A user process can cause the system to hang Good: Fewer context switches

Cpr E 308 Spring 2005 Preemptive Scheduling CPU forcibly taken away from process and given to a new process Preemptive Scheduling used on current PC operating systems (Windows, Linux) Enabled by interrupts

Cpr E 308 Spring 2005 Goals of Batch Scheduling Maximize Throughput (jobs per minute) Fast Response Times Fairness to Processes Often the goals conflict with each other…

Cpr E 308 Spring 2005 First Come First Serve (FCFS) (non preemptive) Rule: Service processes (jobs) according to order of arrival Implementation 1.Maintain queue of current processes 2.Schedule first in queue; Scheduled job executes until it finishes or blocks for I/O 3.A new job is added to the end of the queue Advantages: Simple, easy to implement Problems –Example: a short job arriving soon after a long one –What about simultaneous, or near simultaneous arrivals? –Doesn’t optimize throughput or the response time

Cpr E 308 Spring 2005 Shortest Job First (non-preemptive) Suppose 3 jobs arrive Shortest Job First: Scheduler X: Sum of response times = 15 Sum of response times = 29

Cpr E 308 Spring 2005 Shortest Remaining Time Next (preemptive) Shortest job First is fine if all jobs arrive simultaneously If not, use shortest remaining time next –Strategy: Next schedule the job with the shortest time to completion Starvation: A long job might be continually pre-empted by many short jobs

Cpr E 308 Spring 2005 Realistically... Don’t know the length of jobs Jobs don’t run to completion –run till they block for user input How long is that? –predict using past behavior –Guess next job’s running time = average running time of all jobs so far from the user Copyright © 2002 Thomas W.Doeppner. All rights reserved

Cpr E 308 Spring 2005 Mean Guessing i TiTi guess(i) Copyright © 2002 Thomas W.Doeppner. All rights reserved

Cpr E 308 Spring 2005 Exponential Averaging guess i = a(new_data) + (1-a)(guess i-1 ) –a: weight given to new data –(1-a): weight given to previous guess Copyright © 2002 Thomas W.Doeppner. All rights reserved

Cpr E 308 Spring 2005 Better Guessing i TiTi guess(i) Copyright © 2002 Thomas W.Doeppner. All rights reserved

Cpr E 308 Spring 2005 Round Robin (Preemptive) Give CPU time to each process by turn Circular queue of ready processes Quantum = CPU time allotted every turn How to choose the value of the quantum? oToo small might mean high context switch overhead oToo large might mean bad response times oTypically a few 10s of milliseconds oIf quantum is very high, then similar to FCFS

Cpr E 308 Spring 2005 Round Robin Example Three processes –P1 = 24ms –P2 = 6ms –P3 = 3ms Quantum = 4ms What is the schedule?

Cpr E 308 Spring 2005 Round Robin Better than shortest remaining time next –Long job will not be overwhelmed by short jobs Better than first come first serve –Long job arriving early will not overwhelm future short jobs

Cpr E 308 Spring 2005 Priority Scheduling Different Priorities –Background process sending mail versus –Shell process accepting input “nice” command in UNIX –allows user to reduce the priority of a process

Cpr E 308 Spring 2005 Priority Scheduling Goals Schedule jobs with highest priority first High priority jobs should not overwhelm the others –Might decrease priority with time

Cpr E 308 Spring 2005 Multiple Queues – Static Version System level processes Interactive processes Batch processes Lower priority queues don’t run if higher priority queues non-empty Could time slice between queues High Low

Cpr E 308 Spring 2005 Multiple Queues – Dynamic Version Quantum = 1 Quantum = 2 Quantum = 4 Process enters high priority level If takes more than 1 quantum, moved to second highest priority, ….. High Low

Cpr E 308 Spring 2005 Multiple Queues – Dynamic Version Higher priority = faster service, but short service times Reduce number of context switches for long processes What about a process which became interactive after a long bout of computation? –Increase priority?

Cpr E 308 Spring 2005 Real-Time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus hard real-time –Streaming mp3 player versus air-traffic controller

Cpr E 308 Spring 2005 Real-Time Scheduling Is this set of processes schedulable? –A: once every 100ms, 20ms CPU time –B: once every 200ms, 80ms CPU time –C: once every 100ms, 50ms CPU time If schedulable, still have to draw up a schedule for the processes

Cpr E 308 Spring 2005 CPU Scheduling: Summary FCFS Shortest job first, shortest remaining job next Round robin – context switch overhead Priority scheduling – Multi-level queues Real-time Scheduling – Schedulability