Linux Scheduler © DJ Foreman 3/8/2009.

Slides:



Advertisements
Similar presentations
Scheduling Algorithems
Advertisements

© 2004, D. J. Foreman 1 Scheduling & Dispatching.
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Operating Systems Process Scheduling (Ch 3.2, )
Linux Scheduling Algorithm -Ashish Singh. Introduction History and Background Linux Scheduling Modification in Linux Scheduling Results Conclusion References.
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 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.
Project 2 – solution code
Scheduling in Linux COMS W4118 Spring Scheduling Goals O(1) scheduling; 2.4 scheduler iterated through Run queue on each invocation Task queue.
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.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Linux Scheduling CS Scheduling Policy ► The scheduling algorithm of traditional Unix systems must fulfill several conflicting objectives  Fast.
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 Presentation by Colin McCarthy. Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One.
Linux Scheduler © DJ Foreman 3/8/ Objectives Response time Throughput for batch No starvation Accommodate high AND low priority © DJ Foreman 3/8/2009.
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.
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 Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS333 Intro to Operating Systems Jonathan Walpole.
TANNENBAUM SECTION 2.4, 10.3 SCHEDULING OPERATING SYSTEMS.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 6: CPU Scheduling.
UNIT–II: Process Management
CPU SCHEDULING.
Scheduling of Non-Real-Time Tasks in Linux (SCHED_NORMAL/SCHED_OTHER)
Linux Scheduler.
Linux Scheduling.
Operating Systems 9 – scheduling
Chapter 2.2 : Process Scheduling
Chapter 5: CPU Scheduling
Chapter 5: CPU Scheduling
זימון תהליכים מדיניות בסיסיות: RR, FCFS, SJF
CS 3204 Operating Systems Lecture 14 Godmar Back.
Message Passing, Scheduler
A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k
COT 4600 Operating Systems Spring 2011
Andy Wang Operating Systems COP 4610 / CGS 5765
Introduction What is an operating system bootstrap
Operating System Concepts
Chapter 5: CPU Scheduling
Chapter 2: The Linux System Part 3
Scheduling Adapted from:
TDC 311 Process Scheduling.
CPU SCHEDULING.
CPU scheduling decisions may take place when a process:
COT 4600 Operating Systems Fall 2009
Process Scheduling Decide which process should run and for how long
CS703 – Advanced Operating Systems
Scheduling & Dispatching
Scheduling 21 May 2019.
Scheduling & Dispatching
Linux Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Linux Scheduler © DJ Foreman 3/8/2009

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

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

Linux Scheduling Classes FIFO FIFO real-time process RR Round Robin real-time process Normal non-real-time process © DJ Foreman 3/8/2009

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

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

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

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 100-139) Max(100, min(sp-bonus+5,139)) 0<=bonus<=10 © DJ Foreman 3/8/2009

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: Average sleep time Bonus 0<=N<100ms 300<=N<400ms 3 600<=N<700 6 900<=N<1000 9 © DJ Foreman 3/8/2009

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

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

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

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

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/2009