Linux Scheduler © DJ Foreman 3/8/20091. Objectives Response time Throughput for batch No starvation Accommodate high AND low priority © DJ Foreman 3/8/2009.

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

Operating Systems Process Scheduling (Ch 3.2, )
Abdulrahman Idlbi COE, KFUPM Jan. 17, Past Schedulers: 1.2 & : circular queue with round-robin policy. Simple and minimal. Not focused on.
Process Scheduling in Linux (Chap.7 in Understanding the Linux Kernel) J. H. Wang Oct. 1, 2009.
Operating Systems, fall 2002 SCHEDULING in Linux Lior Amar, David Breitgand (recitation)
Sogang University Advanced Operating Systems (Process Scheduling - Linux) Advanced Operating Systems (Process Scheduling - Linux) Sang Gue Oh, Ph.D. .
Operating Systems ECE344 Ding Yuan Scheduling Lecture 10: 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.
Scheduling (continued)CS-3013 C-term Scheduling (continued) CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
1 Multilevel Feedback Queue Scheduling Another way to put a preference on short-lived processes –Penalize processes that have been running longer. Preemptive.
Scheduling in Linux COMS W4118 Spring Scheduling Goals O(1) scheduling; 2.4 scheduler iterated through Run queue on each invocation Task queue.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
1 Scheduling in Representative Operating Systems.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
The Linux Scheduler 2.4 vs 2.6 Michael McCabe Michael McCabe
Job scheduling Queue discipline.
Operating Systems Process Scheduling (Ch 4.2, )
Operating System Process Scheduling (Ch 4.2, )
Process Scheduling in Windows XP, Linux, and UNIX By Sarah G. Levinson CSC 4320.
Processes and Threads Case studies: Windows and Linux Lecture 6 ~ Fall, 2007 ~
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Cosc 4740 Chapter 5 Process Scheduling. CPU Scheduling Short-term Scheduler –Selects a process from the ready queue when current process releases the.
Linux Scheduling CS Scheduling Policy ► The scheduling algorithm of traditional Unix systems must fulfill several conflicting objectives  Fast.
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.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Operating System Examples - Scheduling
1 Scheduling Deciding what process runs next, given a set of runnable processes, is a fundamental decision the scheduler must make. Multitasking operating.
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
Seminar on Linux Process Management Presentation by Manoj Dhage MTech 1 st Year, SIT, IIT Kharagpur.
CPU Scheduling Thomas Plagemann (with slides from Otto J. Anshus, Kai Li, Pål Halvorsen and Andrew S. Tanenbaum)
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.
Process Scheduling in Linux (Chap. 11, Understanding the Linux Kernel) J. H. Wang Sep. 26, 2008.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
Lec 3aOperating Systems1 Operating Systems Lecture 3a: Linux Schedulers William M. Mongan Material drawn in part from
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Scheduling.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Scheduling II: priority scheduling.
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.
CS 4284 Systems Capstone Godmar Back Resource Allocation & Scheduling.
CS333 Intro to Operating Systems Jonathan Walpole.
TANNENBAUM SECTION 2.4, 10.3 SCHEDULING OPERATING SYSTEMS.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Operating Systems Unit 5: – Processor scheduling – Java – Linux – Windows XP Operating Systems.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
W4118 Operating Systems Instructor: Junfeng Yang.
Process Scheduling 國立中正大學 資訊工程研究所 羅習五 老師 1. Outline OS schedulers Unix scheduling Linux scheduling Linux 2.4 scheduler Linux 2.6 scheduler – O(1) scheduler.
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)
Linux Scheduler.
Linux Scheduling.
Chapter 5: CPU Scheduling
זימון תהליכים מדיניות בסיסיות: RR, FCFS, SJF
CS 3204 Operating Systems Lecture 14 Godmar Back.
A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k
Chapter 5: CPU Scheduling
Scheduling Adapted from:
COT 4600 Operating Systems Fall 2009
Process Scheduling Decide which process should run and for how long
CS703 – Advanced Operating Systems
Linux Scheduler © DJ Foreman 3/8/2009.
Linux Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Linux Scheduler © DJ Foreman 3/8/20091

Objectives Response time Throughput for batch No starvation Accommodate high AND low priority © DJ Foreman 3/8/2009 2

General Process Classifications Two schemes for classifying: –Traditional classes IO bound CPU bound –Alternative classes Interactive Batch Real-time –Video, robotics, sensor-based How to determine? © DJ Foreman 3/8/2009 3

Linux Scheduling Classes FIFOFIFO real-time process RRRound Robin real-time process Normalnon-real-time process © DJ Foreman 3/8/2009 4

Real-time Details © DJ Foreman 3/8/20095

Real-time Rules Priority 0(highest) - 99(lowest) –Program adjustable: sched_setparam() sched_setscheduler() FIFO - non-interruptible except –Higher priority –Blocked –Yields RR –Adds a time-slice to each thread –Suspends at end of slice © DJ Foreman 3/8/2009 6

Non-real-time Scheduling (Conventional processes) © DJ Foreman 3/8/20097

Rules Every process has a “static” priority –100(highest) – 139 (lowest) –Variable via nice() and setpriority() Base quantum (not a constant!) –If sp<120 20*(140-static priority) –If sp>=120 5*(140-static priority) Dynamic priority (also ) –Max(100, min(sp-bonus+5,139)) –0<=bonus<=10 © DJ Foreman 3/8/2009 8

Rules (continued) Bonus –0-5 is a penalty –6-10 is a prize –Related to average sleep time OF THIS PROCESS (not of all Processes) Based on past history Some sample values: © DJ Foreman 3/8/ Average sleep timeBonus 0<=N<100ms0 300<=N<400ms3 600<=N< <=N<10009

Priority Arrays Two arrays: struct prio_array { intnr_active; unsigned long bitmap[BITMAP_SIZE]; structlist_headqueue[MAX_PRIO]; } With: 140 priority levels (max) wordsize=32 bits BITMAP_SIZE is 5 (last 20 bits ignored) © DJ Foreman 3/8/

The Bitmaps Active queues Time-slice-expired queues 1 bit/queue (140 queues) Based on the Intel “bsfl” instruction –Select least significant 1-bit © DJ Foreman 3/8/

Priority arrays – revisited Two arrays (active/expired): *listheads prio_array[2][140]; typedef struct listheads { // 2-way list of this priority PD*next; PD*prev;} struct PD { PD *next; PD*prev; int PID; int prio; // etc } © DJ Foreman 3/8/

Scheduling Pick highest priority non-empty queue/list Tasks in queue/list scheduled © DJ Foreman 3/8/

References Lindsey, R., "What's New in the 2.6 Scheduler", Linux Journal, March 2004 Love, R., Linux Kernel Development, Indianapolis, IN, Sams Publishing, 2004 Understanding the Linux Kernel, Bovet & Cesati, O’Reilly Press, 2006 © DJ Foreman 3/8/