CPU Scheduling Presentation by Colin McCarthy. Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One.

Slides:



Advertisements
Similar presentations
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.
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.
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. .
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 6: CPU Scheduling.
CPU Scheduling Basic Concepts Scheduling Criteria
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.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Scheduling in Linux COMS W4118 Spring Scheduling Goals O(1) scheduling; 2.4 scheduler iterated through Run queue on each invocation Task queue.
1 Scheduling in Representative Operating Systems.
Chapter 5.2: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Chapter 5.1 Basic Concepts Scheduling.
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
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.
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.
 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.
Scheduling in Linux and Windows 2000
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.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
Operating System Examples - 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.
Outline for Today Objectives: Linux scheduler Lottery scheduling
Seminar on Linux Process Management Presentation by Manoj Dhage MTech 1 st Year, SIT, IIT Kharagpur.
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
ICOM Noack Scheduling For Distributed Systems Classification – degree of coupling Classification – granularity Local vs centralized scheduling Methods.
Process Scheduling in Linux (Chap. 11, Understanding the Linux Kernel) J. H. Wang Sep. 26, 2008.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Scheduling.
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
BFSBFS by Con KolivasCon Kolivas Guruprasad Aphale. Real Time Lunch, 10/21/ Guruprasad Aphale.
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
LINUX SCHEDULING Evolution in the 2.6 Kernel Kevin Lambert Maulik Mistry Cesar Davila Jeremy Taylor.
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.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
Real Time System with MVL. © 2007 MontaVista Confidential | Overview of MontaVista Agenda Why Linux Real Time? Linux Kernel Scheduler Linux RT technology.
Operating System Examples - Scheduling. References r Silberschatz et al, Chapter 5.6, Chapter
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Linux Process Management. Linux Implementation of Threads Threads enable concurrent programming / true parallelism Linux implementation of threads.
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.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
W4118 Operating Systems Instructor: Junfeng Yang.
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.
Networks and Operating Systems: Exercise Session 2
CS 3204 Operating Systems Lecture 14 Godmar Back.
Linux kernel: Processes, threads and scheduling
Chapter 5: CPU Scheduling
Scheduling.
CPU SCHEDULING.
Process Scheduling Decide which process should run and for how long
CS703 – Advanced Operating Systems
Scheduling Classes and Real-Time Scheduling in Linux
Linux Process State Scheduling information Identifiers
Linux Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

CPU Scheduling Presentation by Colin McCarthy

Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One runqueue for each CPU

Runqueues ActiveExpired Task 1 Task 2 (lock) Task 3 Task 4 Task 5

Priority Arrays O(1) performance Multiple tasks with same priority are scheduled round robin

Priority Arrays BitmapPriority Array T1 T2 T

Calculating Priority Static task priority –Nice value: changed with nice() system call –Scheduler never changes static priority, but user can Dynamic task priority –Adds to or subtracts from static priority with rewards and penalties –I/O-bound tasks get rewarded, CPU-bound tasks are penalized

I/O-bound vs. CPU-bound Keep track of how much time a task spent sleeping (blocked on I/O) and how much time spent running on CPU The higher a task’s sleep average, the higher it’s dynamic priority

Calculating Timeslice Scale a task’s static priority onto the possible timeslice range (max and min) The higher the task’s static priority, the larger the timeslice it gets. An interactive task’s timeslice may be broken up into chunks

Other effects on calculations When tasks are forked, the sleep average of both the parent and child are reduced –Prevents highly interactive parents from hogging the CPU with like children –Timeslice is not reduced, since timeslice is based only on static priority Interactive tasks whose timeslice has run out will be reinserted into the active priority array as long as there are no tasks starving in the expired array.

The schedule() Function Picks a new task to run and switches to it 1.Check that it’s not being called during an atomic period 2.Disable preemption and check how long the current task has been running 3.Look for runnable tasks. If none, try a load balancing. If still none, idle or swap priority arrays 4.Check active priority array’s bitmap 5.Switch tasks and re-enable preemption

Load Balancing Tasks tend to stay on the same CPU in the interest of cache hotness and memory bank proximity Load balancing is distributing tasks more evenly between CPUs Since there is a single runqueue for each CPU, it keeps track of the CPU’s load A migration thread is kept running on each CPU to handle load balancing

Soft RT Scheduling Linux 2.6 scheduler provides soft RT scheduling support in the same manner described in Nathan’s presentation on Linux 2.2

● Processes can be in three scheduling classes: – SCHED_FIFO – “Real time.” – SCHED_RR - “Real time.” – SCHED_OTHER – Normal process. ● Real time processes always win out over normal processes. ● Real time processes with higher priority always win out over those with with lower priority. ● FIFO/RR only applies if there are multiple RT processes with the same priority. Linux 2.2 Scheduler

NUMA Scheduling Intended for large systems with many nodes Scheduler domains created to account for proximity issues with speed Top-level domain contains all CPUs with one group for each node, with multiple CPUs possible in each. A CPU mask is provided by the group.

NUMA Task Migration First balances base domains in individual CPU Then balances the parent domain (could be multiple CPUs) and so on