Linux Scheduler.

Slides:



Advertisements
Similar presentations
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Scheduling Algorithems
Tutorial 4 Scheduling. Why do we need scheduling? To manage processes according to requirements of a system, like: –User responsiveness or –Throughput.
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.
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Abdulrahman Idlbi COE, KFUPM Jan. 17, Past Schedulers: 1.2 & : circular queue with round-robin policy. Simple and minimal. Not focused on.
Linux Scheduler. Linux is a multitasking OS Deciding what process runs next, given a set of runnable processes, is a fundamental decision a scheduler.
Process Scheduling in Linux (Chap.7 in Understanding the Linux Kernel) J. H. Wang Oct. 1, 2009.
Sogang University Advanced Operating Systems (Process Scheduling - Linux) Advanced Operating Systems (Process Scheduling - Linux) Sang Gue Oh, Ph.D. .
BFS: Brain F*ck Scheduler Jacob Chan. Objectives  Brain F*ck Scheduling  What it is  How it works  Features  Scalability  Limitations  Definition.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 6: CPU Scheduling.
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
1 Traditional Unix Scheduling “Traditional” means –No consideration on realtime processes. –Typically 4.3BSD and SVR3 MFQ-based –Preemptive (time quantum.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
1 Thursday, June 15, 2006 Confucius says: He who play in root, eventually kill tree.
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.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
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.
Chapter III Scheduling Jehan-François Pâris
Recall … Process states –scheduler transitions (red) Challenges: –Which process should run? –When should processes be preempted? –When are scheduling decisions.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
Operating System Examples - Scheduling
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
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
Scheuduling.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Assign processes to be executed by the processor or processors: –Response time –Throughput –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.
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-
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
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)
Process Management Process Concept Why only the global variables?
Chapter 5a: CPU Scheduling
Linux Scheduling.
Uniprocessor Scheduling
Day 25 Uniprocessor scheduling
Lecture 23: Process Scheduling for Interactive Systems
CS 3204 Operating Systems Lecture 14 Godmar Back.
A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k
COT 4600 Operating Systems Spring 2011
Chapter 5: CPU Scheduling
Chapter5: CPU Scheduling
TDC 311 Process Scheduling.
Scheduling.
Chapter 9 Uniprocessor Scheduling
Outline Scheduling algorithms Multi-processor scheduling
CPU scheduling decisions may take place when a process:
Process Scheduling Decide which process should run and for how long
Scheduling of Regular Tasks in Linux
Linux Scheduler © DJ Foreman 3/8/2009.
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Scheduling 21 May 2019.
Uniprocessor Scheduling
Linux Scheduling CSE 2431: Introduction to Operating Systems
Scheduling of Regular Tasks in Linux
CPU Scheduling David Ferry CSCI 3500 – Operating Systems
Presentation transcript:

Linux Scheduler

Scheduling in Linux: Prior to Version 2.5 Traditional Unix Scheduler Processes Classes for Scheduling Purposes So-Called Real-Time are just high priority Priorities 0 - 99 Real-time FIFO Non-preemptible Real-time round robin Preemptible if its quantum expires Timesharing Priorities 100 – 139 Did not support systems with multiple processors well

With Version 2.5 O(1) Scheduler Ready queue organized as two chained hash-tables Active: ready/quantum has not expired Expired: ready/quantum has expired Each list within a category has a different priority and will receive a different size time slice Operation Select task from highest priority queue in Active list If it’s time slice expires, move it to the expired list If it blocks, decrement its time slice counter and put it back on the Active queue Priority is constantly recalculated Reward interactive processes Punish cpu-intensive processes Ran in constant regardless of the number of processes in the system. Had features that favored multiple processors like load balancing. Ran poorly on interactive systems

With Version 2.6 CFS(completely fair scheduler) Selecting Which Process to Run Next Ready queue organized as a red-black tree Each internal node is a task Children on left had less time on CPU Children on right had more time on CPU Schedule task which had least amount of CPU time Selecting a node: O(N) because it’s the left-most node Inserting a node: O(lg(n)) because the tree is balanced Accounts for priorities virtual clock ticks more quickly for low priority processes virtual clock ticks more slowly for high priority processes

CFS Conventional (interactive processes) Setting Static Priority Each interactive process has it own static priority: 100 (highest) – 139 (lowest) A new process inherits the static priority of its parent Determines the base time quantum in milliseconds according to this formula: if static priority < 120 base_time_quantum = (140 – static priority) * 20 else base_time_quantum = (140 – static priority) * 5 Since a higher process is associated with a lower numerical value, high priority processes start off with a longer quantum. Highest static priority is 100: btq = (140 – 100) * 20 = 800 ms Default static priority is 120: btq = (140 – 120) * 5 = 100 ms Lowest static priority is 139: btq = (140 – 139) * 5 = 5 ms Nice values: Older linux/unix systems used nice() which sets priorities from -20 to 19. These correspond 100 to 139

Conventional (interactive processes) Dynamic Priority The priority used in making scheduling decisions dynamic_priority = max(100, min(static_priority – bonus + 5, 139)) Bonus [0 .. 10] < 5 is a penalty for bad behavior > 5 is a premium for good behavior Related to the average sleep time of the process. That is, if the process has blocked several times it has slept more than one that has blocked only once. It is more interactive Example static_priority = 130 (i.e., a low static priority) bonus = 10 (process behaved well) dynamic_priority = max(100, min(125, 139)) = 125