1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.

Slides:



Advertisements
Similar presentations
Operating Systems Process Scheduling (Ch 3.2, )
Advertisements

CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
Chapter 6: CPU Scheduling
Chap 5 Process Scheduling. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a.
Ceng Operating Systems Chapter 2.2 : Process Scheduling Process concept  Process scheduling Interprocess communication Deadlocks Threads.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
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.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
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.
1 Multilevel Feedback Queue Scheduling Another way to put a preference on short-lived processes –Penalize processes that have been running longer. Preemptive.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Informationsteknologi Tuesday, October 9, 2007Computer Systems/Operating Systems - Class 141 Today’s class Scheduling.
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.
Operating Systems Process Scheduling (Ch 4.2, )
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
1 Inside the Windows NT Scheduler, Part 1 Assigning CPU time in a uniprocessor environment by Mark Russinovich Windows NT Magazine - July 1997 Inside the.
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.
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Main Job: Assign processes to be executed by the processor(s) and processes to be loaded in main.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
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.
Windows 2000 Scheduling Computing Department, Lancaster University, UK.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Chapter 9 Uniprocessor Scheduling Spring, 2011 School of Computer Science & Engineering Chung-Ang University.
Chapter 6 CPU SCHEDULING.
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.
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
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.
Operating Systems Lecture Notes CPU Scheduling Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
ICS Principles of Operating Systems Lecture 5 - CPU Scheduling Prof. Nalini Venkatasubramanian
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
5.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 6: CPU Scheduling Overview: Basic Concepts Scheduling Criteria Scheduling Algorithms.
Process Scheduling 1 Chapter 5. Process Scheduling Clock interrupt handling Scheduler goal Traditional UNIX scheduling SVR4 scheduler Solaris 2.x scheduling.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Response time Throughput Processor efficiency.
Uniprocessor Scheduling
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Operating Systems: Internals and Design Principles
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Assign processes to be executed by the processor or processors: –Response time –Throughput –Processor.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Purpose of Operating System Part 2 Monil Adhikari.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
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.
Operating Systems Unit 5: – Processor scheduling – Java – Linux – Windows XP Operating Systems.
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.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
 In a single-processor system, only one process can run at a time; any others must wait until the CPU is free and can be rescheduled.  The objective.
Scheduling.
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
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.
Chapter 6: CPU Scheduling (Cont’d)
lecture 5: CPU Scheduling
Scheduling.
Chapter 5: CPU Scheduling
CPU scheduling decisions may take place when a process:
Chapter 6: CPU Scheduling
Uniprocessor Scheduling
Presentation transcript:

1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not be fair u SJF - optimal, but high overhead, starvation possible u SRF - optimal, even higher overhead, starvation possible n combined techniques: u priority scheduling u multiple feedback scheduling n all are incorporated in modern OS scheduler design

2 Lecture 8: Scheduling in modern OS n non-preemptive kernel to avoid kernel data corruption n classical Unix (SVR3, 4.3BSD) scheduler design n real-time requirements n SVR4 scheduling improvements n Solaris scheduling improvements n multiprocessor scheduling

3 Non-Preemptive Kernel n to prevent data structures (especially kernel structures) corruption by simultaneous access by different processes/threads we need to ensure mutual exclusion of access n classical approach u make kernel non-preemptive - process in kernel mode cannot be suspended when it is in the middle of a shared structure modification u disable interrupts when vital structures are modified (see Nachos lecture) - interrupt handler cannot corrupt shared structures modified by kernel n problems: u can be unfair/does not scale u cannot be used for real-time scheduling u cannot be used for multiprocessor systems

4 Classical Unix CPU Scheduling (System V release 3(SVR3), 4.3BSD) n policy: u multiple queues (32), each with a priority value (low value = high priority): F Kernel processes (or user processes in kernel mode) the lower values (0-49) - kernel processes are not preemptive! F User processes have higher value (50-127) u choose the process from the occupied queue with the highest priority, and run that process preemptively, using a timer (time slice typically around 100ms) F Round-robin scheduling in each queue u move processes between queues F Keep track of clock ticks (60/second) F add the number of clock ticks to the process on CPU (decreasing its priority) – process decay F increase priority of processes spending time in ready queue u users can decrease (but not increase!) priority

5 Analysis of classical UNIX CPU scheduling n advantages: u simple (relatively) and effective u ok for general purpose, single processor, small sized systems n disadvantages: u re-computing priorities every second is inefficient in large systems u no response time guarantee u priority inversion - a high priority process has to wait for a lower priority process which is in kernel space (non-preemptive kernel) - some kernel code paths take several ms u applications do not have adequate control over priority (only superuser can increase)

6 Real-time scheduling n Soft real-time capabilities are needed for quality of service sensitive applications - video, audio, multimedia, virtual reality n require bounded dispatch latency, and response time n dispatch latency - time from the moment the process becomes runnable to the moment it begins to run n response time = interrupt processing + dispatch latency + real-time process execution Reproduced from “Unix Internals” by Uresh Vahalia

7 System V release 4 (SVR4) scheduling n Scheduling classes (in the order of priority): u real-time - fixed priority and time slices u system - kernel u time-sharing (default) - RR scheduling, dynamic priorities, lower priority processes are given larger time slices (to offset overall I/O favoring) n possibility of adding other classes (dynamic loading of scheduler implementations) n on-event priority recompilation - priority changes on specific events u priority reduced when process uses up time slice u priority upped if process blocks n kernel preemptive in preemption points - points defined where it is safe to preempt the kernel

8 Analysis of SVR4 scheduling n Advantages u flexible, allows real-time, scalable u modifiable (allows to add classes) u efficient priority computation u more balanced scheduling between I/O and CPU bound processes n Problems u switching time sharing -> real-time is not allowed - hand tuning required and not always possible u kernel is not completely preemptible u no multiprocessor support

9 Solaris Scheduling n fully preemptive kernel, shared kernel structures are protected by explicit synchronization mechanisms n kernel is multithreaded, interrupts are implemented as threads - no need to change interrupt level n symmetric multiprocessor scheduling n priority inheritance or priority lending (solves priority inversion problem) - when a higher priority thread is needs a resources used by a lower priority thread - the higher priority thread lends it’s priority to the lower priority thread; must be transitive! n Does not have hard real-time capabilities

10 Multiprocessor scheduling in Solaris n one run queue n processors communicate through cross- processor interrupts n example of multiprocessor scheduling (greater number - higher priority): 1. T6, T7 blocked 2. P1 unblocks T6, calls scheduler to find proc. to run it on, 3. scheduler selects T3, and sends it cross-processor interrupt 4. P2 unblocks T7, calls scheduler to find proc to run 5. P2 needs to know that T6 is scheduled on P3! Reproduced from “Unix Internals” by Uresh Vahalia

11 Processor Affinity Multicore Processors n process migration between processes, although necessary, invalidates processor cache u processor affinity – OS tries to schedule processes on the same processors n multicore processors particularly vulnerable to memory stall u to mitigate it – several (typically two) programmable threads per core that are switched in hardware when blocked