Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-

Slides:



Advertisements
Similar presentations
Scheduling Algorithems
Advertisements

1 Always want to have CPU (or CPU’s) working Usually many processes in ready queue –Ready to run on CPU –Focus on a single CPU here Need strategies for.
Operating Systems Process Scheduling (Ch 3.2, )
CPU Scheduling CPU Scheduler Performance metrics for CPU scheduling
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
CPU Scheduling Section 2.5.
CMPT 300: Operating Systems I Ch 5: CPU Scheduling Dr. Mohamed Hefeeda
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.
Chapter 5: CPU Scheduling
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
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.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: Process Scheduling.
Job scheduling Queue discipline.
Operating Systems Process Scheduling (Ch 4.2, )
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
7/2/2015 Operating Systems Michael Elhadad, Meni Adler& Amnon Meisels 1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2.
7/2/2015 Operating Systems, 2012, Danny Hendler & Roie Zivan 1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management.
Operating System Process Scheduling (Ch 4.2, )
Chapter 5 CPU Scheduling (Algorithms)
Process Scheduling in Windows XP, Linux, and UNIX By Sarah G. Levinson CSC 4320.
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Chapter 5: CPU Scheduling (Continuation). 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Determining Length.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: Process Scheduling
Cosc 4740 Chapter 5 Process Scheduling. CPU Scheduling Short-term Scheduler –Selects a process from the ready queue when current process releases the.
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.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Windows 2000 Scheduling Computing Department, Lancaster University, UK.
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.
Chapter 6 CPU SCHEDULING.
Shan Gao Fall 2007 Department of Computer Science Georgia State University.
Operating System Examples - Scheduling
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
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.
Win32 Programming Lesson 10: Thread Scheduling and Priorities.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling G.Anuradha References : Galvin and William Stallings Problems taken from Principles of OS by Naresh Chauhan.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
CPU Scheduling Presentation by Colin McCarthy. Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Traditional UNIX Scheduling Scheduling algorithm objectives Provide good response time for interactive users Ensure that low-priority background jobs do.
Scheuduling.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
Lecture 6 Page 1 CS 111 Online Preemptive Scheduling Again in the context of CPU scheduling A thread or process is chosen to run It runs until either it.
Operating System Examples - Scheduling. References r Silberschatz et al, Chapter 5.6, Chapter
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS333 Intro to Operating Systems Jonathan Walpole.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 6: CPU Scheduling.
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.
UNIT–II: Process Management
Scheduling of Non-Real-Time Tasks in Linux (SCHED_NORMAL/SCHED_OTHER)
Thursday, February 2, 2012 Use ranger3 (instead of ranger2)
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Operating System Concepts
Chapter 2: The Linux System Part 3
Scheduling Adapted from:
TDC 311 Process Scheduling.
Process Scheduling Decide which process should run and for how long
Scheduling of Regular Tasks in Linux
Presentation transcript:

Operating System Examples - Scheduling

References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler- 2.6.pdf r cheduler.pdf r CFS.txt r Windows Operating System Internals Curriculum Development Kit, developed by Solomon, Russinovich and Polze

Solaris r Solaris uses priority-based thread scheduling r Each thread belongs to one of six classes m Time sharing m Interactive m Real time m System m File share m Fixed priority r Default class: time sharing r Within each class there are different priorities r Each class uses different scheduling algorithms

Solaris r Time sharing scheduling algorithm m Dynamically alters priorities of processes m Uses a multilevel feedback queue m The higher the priority the smaller the time slice m The lower the priority the larger the time slice m Interactive processes typically have higher priority (good response time) m CPU-bound processes have lower priority (good throughput)

Solaris r Time sharing scheduling algorithm m If a thread has used its entire time quantum without blocking its priority is changed m The priority of a thread that is returning from sleeping (e.g. waiting for I/O) has its priority increased r Interactive scheduling algorithm m Similar to time sharing but give window managers (e.g., KDE, GNOME) a higher priority

Solaris Dispatch Table

Solaris r Real-time class m Highest priority m A thread in this class will before a process in any other class m Few processes belong in this class r System class m Kernel threads are assigned to this class e.g., scheduler and paging daemons

Solaris r Fixed-priority m Relatively new m Same number of priorities as time sharing but no dynamic adjustment of priorities r Fair-share m Uses CPU shares instead of priorities m A share is an indicator of entitlement

Solaris r Each scheduling class includes a set of priorities r However, the scheduler converts the class- specific priorities into global priorities r The thread with the highest global priority is chosen to run

Solaris Scheduling

Windows XP r The scheduler is called a dispatcher r 32-level priority scheme r Priorities are divided into two classes: m Variable class: priorities 1 to 15 m Real-time class: priorities 16 to 31 r There is a queue for each priority r The dispatcher traverses the set of queues from highest to lowest until it finds a thread that is ready to run r If there are no processes ready to run the dispatcher executes the idle thread

Windows XP Scheduling r Processes are given a priority class upon creation: m REALTIME_PRIORITY_CLASS m HIGH_PRIORITY_CLASS m ABOVE_NORMAL_PRIORITY_CLASS m NORMAL_PRIORITY_CLASS m BELOW_NORMAL_PRIORITY_CLASS m IDLE_PRIORITY_CLASS r Priorities in all classes except the REALTIME_PRIORITY class can change

Windows XP Scheduling r A thread within a given priority class has a relative priority within the class: m TIME_CRITICAL m HIGHEST m ABOVE_NORMAL m NORMAL m BELOW_NORMAL m LOWEST m IDLE

Windows XP r Each thread has a base priority representing a value in the priority range for the class that the thread belongs r The priority of each thread is based on both the priority class it belongs to and its relative priority within that class r As with Solaris the classes and the priorities in the classes are mapped to a global priority

Windows XP Priorities

Windows XP r Priority changes for threads in the variable class m Time quantum expires: Priority is lowered but not below the base priority m Thread switches from blocked to running: Priority is increased The amount depends on what the thread was doing Keyboard I/O gets a large increase while disk I/O gets a moderate increase

Windows XP r Windows XP distinguishes between the foreground process that is currently selected on the screen and the background processes that are not currently selected r The strategy tends to give good response times to interactive threads that are using the mouse and windows r The I/O devices are kept busy

Linux Scheduling r The Linux kernel internally represents processes and threads as tasks via the task_struct r Linux uses task_struct (process control block)to represent any execution context m A single-threaded process will be represented with one task structure m A multithreaded process will have one task structure for each of the user-level threads

Linux Scheduling r Constant order O(1) scheduling time r Two priority ranges: time-sharing and real- time r Real-time range from 0 to 99 and nice value from 100 to 140 r Linux (unlike Solaris) assigns higher priority tasks longer time quanta and lower priority tasks shorter time quanta

Linux Scheduling Priorities and Time-slice length

Linux Scheduling r A runnable task is considered for execution on the CPU as long as it has time remaining in its time slice r When a task has exhausted its time slice, it is considered expired and is not eligible for execution again until all other tasks have all exhausted their time slice

Linux Scheduling r The kernel maintains a list of all runnable tasks in a runqueue data structure r In a multi-core machine there is a runqueue for each processor r Each runqueue consists of two priority arrays: m Active: Contains all tasks with time remaining in their time slices m Expired: Contains all expired tasks r The active, expired queues are indexed according to priority

Linux Scheduling List of Tasks Indexed According to Priorities

Linux Scheduling r The scheduler chooses the task with the highest priority from the active array for execution r When there are no more tasks in the active array, the expired array becomes the active array and the active array becomes the expired array.

Linux Scheduling r The scheduler chooses the task with the highest priority from the active array for execution r A task’s dynamic priority is recalculated when the task has exhausted its time quantum and is to be moved to the expired array

Linux Scheduling r Linux tries to give a higher priority to interactive tasks r The scheduler somehow needs to measure the interactivity of a process r Interactive processes sleep more than others

Linux Scheduling r The scheduler keeps track of the average amount of time a task sleeps vs average amount of time task uses CPU m Use the sleep_avg variable r When a process wakes the time spent sleeping is added to its sleep_avg; r The run time is subtracted from sleep_avg r The higher the value of sleep_avg the more I/O bound it is

Question Can Linux processes starve?

Case Study Discussion r Basic idea for schedule user processes is the same for all systems: m Lower priority for CPU bound process m Increase priority for I/O bound process r The scheduling in Solaris / Linux is more concerned about fairness. m More popular as the OSes for servers. r The scheduling in Window XP is more concerned about user perceived performance. m More popular as the OS for personal computers.

Summary r We have examined scheduling in several contemporary operating systems