Linux scheduler history. We will be talking about the O(1) scheduler

Size: px
Start display at page:

Download "Linux scheduler history. We will be talking about the O(1) scheduler"

Transcription

1 CPU Scheduling

2 Linux scheduler history We will be talking about the O(1) scheduler

3 SMP Support in 2.4 and 2.6 versions 2.4 Kernel 2.6 Kernel CPU1 CPU2 CPU3 CPU1 CPU2 CPU3

4 Linux Scheduling 3 scheduling classes SCHED_FIFO and SCHED_RR are realtime classes SCHED_OTHER is for the rest 140 Priority levels : RT priority : User task priorities Three different scheduling policies One for normal tasks Two for Real time tasks

5 Pre-emptive, priority based scheduling. When a process with higher real-time priority (rt_priority) wishes to run, all other processes with lower real-time priority are thrust aside. In SCHED_FIFO, a process runs until it relinquishes control or another with higher real-time priority wishes to run. SCHED_RR process, in addition to this, is also interrupted when its time slice expires or there are processes of same real-time priority (RR between processes of this class) SCHED_OTHER is also round-robin, with lower time slice

6 SCHED_OTHER: Normal tasks Each task assigned a Nice value Static priority = Nice Nice value between -20 and +19 Assigned a time slice Tasks at the same priority are round-robined Ensures Priority + Fairness

7 Basic Philosophies Priority is the primary scheduling mechanism Priority is dynamically adjusted at run time Processes denied access to CPU get increased Processes running a long time get decreased Try to distinguish interactive processes from noninteractive Bonus or penalty reflecting whether I/O or compute bound Use large quanta for important processes Modify quanta based on CPU use Associate processes to CPUs Do everything in O(1) time

8 The Runqueue 140 separate queues, one for each priority level Actually, two sets, active and expired Priorities 0-99 for real-time processes Priorities for normal processes; value set via nice()/setpriority() system calls

9 Linux 2.6 scheduler runqueue structure

10 Scheduler Runqueue A scheduler runqueue is a list of tasks that are runnable on a particular CPU. A rq structure maintains a linked list of those tasks. The runqueues are maintained as an array runqueues, indexed by the CPU number. The rq keeps a reference to its idle task The idle task for a CPU is never on the scheduler runqueue for that CPU (it's always the last choice) Access to a runqueue is serialized by acquiring and releasing rq->lock

11 Basic Scheduling Algorithm Find the highest-priority queue with a runnable process Find the first process on that queue Calculate its quantum size Let it run When its time is up, put it on the expired list Recalculate priority first Repeat

12 Process Descriptor Fields Related to the Scheduler thread_info->flags thread_info->cpu state prio static_prio run_list array sleep_avg timestamp last_ran activated policy cpus_allowed time_slice first_time_slice rt_priority

13 The Highest Priority Process There is a bit map indicating which queues have processes that are ready to run Find the first bit that s set: 140 queues 5 integers Only a few compares to find the first that is nonzero Hardware instruction to find the first 1-bit bsfl on Intel Time depends on the number of priority levels, not the number of processes

14 Scheduling Components Static Priority Sleep Average Bonus Dynamic Priority Interactivity Status

15 Static Priority Each task has a static priority that is set based upon the nice value specified by the task. static_prio in task_struct Value between 0 and 139 (between 100 and 139 for normal processes) Each task has a dynamic priority that is set based upon a number of factors tries to increase priority of interactive jobs

16 Sleep Average Interactivity heuristic: sleep ratio Mostly sleeping: I/O bound Mostly running: CPU bound Sleep ratio approximation sleep_avg in the task_struct Range: 0.. MAX_SLEEP_AVG When process wakes up (is made runnable), recalc_task_prio adds in how many ticks it was sleeping (blocked), up to some maximum value (MAX_SLEEP_AVG) When process is switched out, schedule subtracts the number of ticks that a task actually ran (without blocking) sleep_avg scaled to a bonus vale

17 Average Sleep Time and Bonus Values Average sleep time >= 0 but < 100 ms >= 100 ms but < 200 ms >= 200 ms but < 300 ms >= 300 ms but < 400 ms >= 400 ms but < 500 ms >= 500 ms but < 600 ms >= 600 ms but < 700 ms >= 700 ms but < 800 ms >= 800 ms but < 900 ms >= 900 ms but < 1000 ms 1 second Bonus

18 Bonus and Dynamic Priority Dynamic priority (prio in task_struct) is calculated in from static priority and bonus = max (100, min( static_priority bonus + 5, 139) )

19 Calculating Time Slices time_slice in the task_struct Calculate Quantum where If (SP < 120): Quantum = (140 SP) 20 if (SP >= 120): Quantum = (140 SP) 5 where SP is the static priority Higher priority process get longer quanta Basic idea: important processes should run longer Other mechanisms used for quick interactive response

20 Nice Value vs. static priority and Quantum

21 Interactive Processes A process is considered interactive if bonus 5 >= (Static Priority / 4) 28 (Static Priority / 4) 28 = interactive delta Low-priority processes have a hard time becoming interactive: A high static priority (100) becomes interactive when its average sleep time is greater than 200 ms A default static priority process becomes interactive when its sleep time is greater than 700 ms Lowest priority (139) can never become interactive The higher the bonus the task is getting and the higher its static priority, the more likely it is to be considered interactive.

22 Using Quanta At every time tick (in scheduler_tick), decrement the quantum of the current running process (time_slice) If the time goes to zero, the process is done Check interactive status: If non-interactive, put it aside on the expired list If interactive, put it at the end of the active list Exceptions: don t put on active list if: If higher-priority process is on expired list If expired task has been waiting more than STARVATION_LIMIT If there s nothing else at that priority, it will run again immediately Of course, by running so much, its bonus will go down, and so will its priority and its interactive status

23 Avoiding Starvation The system only runs processes from active queues, and puts them on expired queues when they use up their quanta When a priority level of the active queue is empty, the scheduler looks for the next-highest priority queue After running all of the active queues, the active and expired queues are swapped There are pointers to the current arrays; at the end of a cycle, the pointers are switched

24 The Priority Arrays struct prio_array { unsigned int nr_active; unsigned long bitmap[5]; struct list_head queue[140]; }; struct rq { spinlock_t lock; unsigned_long nr_running; struct prio_array *active, *expired; struct prio_array arrays[2]; task_struct *curr, *idle; };

25 Swapping Arrays struct prioarray *array = rq->active; if (array->nr_active == 0) { rq->active = rq->expired; rq->expired = array; }

26 Why Two Arrays? Why is it done this way? It avoids the need for traditional aging Why is aging bad? It s O(n) at each clock tick

27 Linux is More Efficient Processes are touched only when they start or stop running That s when we recalculate priorities, bonuses, quanta, and interactive status There are no loops over all processes or even over all runnable processes

28 Real-Time Scheduling Linux has soft real-time scheduling No hard real-time guarantees All real-time processes are higher priority than any conventional processes Processes with priorities [0, 99] are real-time saved in rt_priority in the task_struct scheduling priority of a real time task is: 99 - rt_priority Process can be converted to real-time via sched_setscheduler system call

29 Real-Time Policies First-in, first-out: SCHED_FIFO Static priority Process is only preempted for a higher-priority process No time quanta; it runs until it blocks or yields voluntarily RR within same priority level Round-robin: SCHED_RR As above but with a time quanta (800 ms) Normal processes have SCHED_OTHER scheduling policy

30 Multiprocessor Scheduling Each processor has a separate run queue Each processor only selects processes from its own queue to run Yes, it s possible for one processor to be idle while others have jobs waiting in their run queues Periodically, the queues are rebalanced: if one processor s run queue is too long, some processes are moved from it to another processor s queue

31 Locking Runqueues To rebalance, the kernel sometimes needs to move processes from one runqueue to another This is actually done by special kernel threads Naturally, the runqueue must be locked before this happens The kernel always locks runqueues in order of increasing indexes Why? Deadlock prevention!

32 Processor Affinity Each process has a bitmask saying what CPUs it can run on Normally, of course, all CPUs are listed Processes can change the mask The mask is inherited by child processes (and threads), thus tending to keep them on the same CPU Rebalancing does not override affinity

33 Load Balancing To keep all CPUs busy, load balancing pulls tasks from busy runqueues to idle runqueues. If schedule finds that a runqueue has no runnable tasks (other than the idle task), it calls load_balance load_balance also called via timer schedule_tick calls rebalance_tick Every tick when system is idle Every 100 ms otherwise

34 Load Balancing load_balance looks for the busiest runqueue (most runnable tasks) and takes a task that is (in order of preference): inactive (likely to be cache cold) high priority load_balance skips tasks that are: likely to be cache warm (hasn't run for cache_decay_ticks time) currently running on a CPU not allowed to run on the current CPU (as indicated by the cpus_allowed bitmask in the task_struct)

35 Linux 2.6 CFS Scheduler Was merged into the release. Uses red-black tree structure instead of multilevel queues. Tries to run the task with the "gravest need" for CPU time

36 Red-Black tree in CFS

37 Red-Black tree properties Self Balance Insertion and deletion operation in O(log(n)) With proper implementation its performance is almost the same as O(1) algorithms!

38 The switch_to Macro switch_to() performs a process switch from the prev process (descriptor) to the next process (descriptor). switch_to is invoked by schedule() & is one of the most hardware-dependent kernel routines. See kernel/sched.c and include/asm- */system.h for more details.

W4118 Operating Systems. Instructor: Junfeng Yang

W4118 Operating Systems. Instructor: Junfeng Yang W4118 Operating Systems Instructor: Junfeng Yang Outline Advanced scheduling issues Multilevel queue scheduling Multiprocessor scheduling issues Real-time scheduling Scheduling in Linux Scheduling algorithm

More information

Linux Scheduler. Linux Scheduler

Linux Scheduler. Linux Scheduler or or Affinity Basic Interactive es 1 / 40 Reality... or or Affinity Basic Interactive es The Linux scheduler tries to be very efficient To do that, it uses some complex data structures Some of what it

More information

Process Scheduling II

Process Scheduling II Process Scheduling II COMS W4118 Prof. Kaustubh R. Joshi krj@cs.columbia.edu hdp://www.cs.columbia.edu/~krj/os References: OperaWng Systems Concepts (9e), Linux Kernel Development, previous W4118s Copyright

More information

Linux O(1) CPU Scheduler. Amit Gud amit (dot) gud (at) veritas (dot) com http://amitgud.tk

Linux O(1) CPU Scheduler. Amit Gud amit (dot) gud (at) veritas (dot) com http://amitgud.tk Linux O(1) CPU Scheduler Amit Gud amit (dot) gud (at) veritas (dot) com http://amitgud.tk April 27, 2005 Agenda CPU scheduler basics CPU scheduler algorithms overview Linux CPU scheduler goals What is

More information

Scheduling policy. ULK3e 7.1. Operating Systems: Scheduling in Linux p. 1

Scheduling policy. ULK3e 7.1. Operating Systems: Scheduling in Linux p. 1 Scheduling policy ULK3e 7.1 Goals fast process response time good throughput for background jobs avoidance of process starvation reconciliation of needs of low- and high-priority processes Operating Systems:

More information

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6 Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6 Winter Term 2008 / 2009 Jun.-Prof. Dr. André Brinkmann Andre.Brinkmann@uni-paderborn.de Universität Paderborn PC² Agenda Multiprocessor and

More information

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling Scheduling 0 : Levels High level scheduling: Deciding whether another process can run is process table full? user process limit reached? load to swap space or memory? Medium level scheduling: Balancing

More information

Linux Process Scheduling. sched.c. schedule() scheduler_tick() hooks. try_to_wake_up() ... CFS CPU 0 CPU 1 CPU 2 CPU 3

Linux Process Scheduling. sched.c. schedule() scheduler_tick() hooks. try_to_wake_up() ... CFS CPU 0 CPU 1 CPU 2 CPU 3 Linux Process Scheduling sched.c schedule() scheduler_tick() try_to_wake_up() hooks RT CPU 0 CPU 1 CFS CPU 2 CPU 3 Linux Process Scheduling 1. Task Classification 2. Scheduler Skeleton 3. Completely Fair

More information

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking? Housekeeping Paper reading assigned for next Thursday Scheduling Lab 2 due next Friday Don Porter CSE 506 Lecture goals Undergrad review Understand low-level building blocks of a scheduler Understand competing

More information

Process Scheduling in Linux

Process Scheduling in Linux Process Scheduling in Linux Scheduling Mechanism: how to switch. Scheduling Policy: when to switch and what process to choose. Some scheduling objectives: fast process response time avoidance of process

More information

Linux Process Scheduling Policy

Linux Process Scheduling Policy Lecture Overview Introduction to Linux process scheduling Policy versus algorithm Linux overall process scheduling objectives Timesharing Dynamic priority Favor I/O-bound process Linux scheduling algorithm

More information

Chapter 5 Linux Load Balancing Mechanisms

Chapter 5 Linux Load Balancing Mechanisms Chapter 5 Linux Load Balancing Mechanisms Load balancing mechanisms in multiprocessor systems have two compatible objectives. One is to prevent processors from being idle while others processors still

More information

CPU Scheduling Outline

CPU Scheduling Outline CPU Scheduling Outline What is scheduling in the OS? What are common scheduling criteria? How to evaluate scheduling algorithms? What are common scheduling algorithms? How is thread scheduling different

More information

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Operating Systems Concepts: Chapter 7: Scheduling Strategies Operating Systems Concepts: Chapter 7: Scheduling Strategies Olav Beckmann Huxley 449 http://www.doc.ic.ac.uk/~ob3 Acknowledgements: There are lots. See end of Chapter 1. Home Page for the course: http://www.doc.ic.ac.uk/~ob3/teaching/operatingsystemsconcepts/

More information

Completely Fair Scheduler and its tuning 1

Completely Fair Scheduler and its tuning 1 Completely Fair Scheduler and its tuning 1 Jacek Kobus and Rafał Szklarski 1 Introduction The introduction of a new, the so called completely fair scheduler (CFS) to the Linux kernel 2.6.23 (October 2007)

More information

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d Comp 204: Computer Systems and Their Implementation Lecture 12: Scheduling Algorithms cont d 1 Today Scheduling continued Multilevel queues Examples Thread scheduling 2 Question A starvation-free job-scheduling

More information

Linux Load Balancing

Linux Load Balancing Linux Load Balancing Hyunmin Yoon 2 Load Balancing Linux scheduler attempts to evenly distribute load across CPUs Load of CPU (run queue): sum of task weights Load balancing is triggered by Timer interrupts

More information

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances: Scheduling Scheduling Scheduling levels Long-term scheduling. Selects which jobs shall be allowed to enter the system. Only used in batch systems. Medium-term scheduling. Performs swapin-swapout operations

More information

Overview of the Linux Scheduler Framework

Overview of the Linux Scheduler Framework Overview of the Linux Scheduler Framework WORKSHOP ON REAL-TIME SCHEDULING IN THE LINUX KERNEL Pisa, June 27th, 2014 Marco Cesati University of Rome Tor Vergata Marco Cesati (Univ. of Rome Tor Vergata)

More information

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS CPU SCHEDULING CPU SCHEDULING (CONT D) Aims to assign processes to be executed by the CPU in a way that meets system objectives such as response time, throughput, and processor efficiency Broken down into

More information

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters

More information

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput Import Settings: Base Settings: Brownstone Default Highest Answer Letter: D Multiple Keywords in Same Paragraph: No Chapter: Chapter 5 Multiple Choice 1. Which of the following is true of cooperative scheduling?

More information

CPU Scheduling. Core Definitions

CPU Scheduling. Core Definitions CPU Scheduling General rule keep the CPU busy; an idle CPU is a wasted CPU Major source of CPU idleness: I/O (or waiting for it) Many programs have a characteristic CPU I/O burst cycle alternating phases

More information

Linux process scheduling

Linux process scheduling Linux process scheduling David Morgan General neediness categories realtime processes whenever they demand attention, need it immediately other processes interactive care about responsiveness demand no

More information

Understanding the Linux 2.6.8.1 CPU Scheduler

Understanding the Linux 2.6.8.1 CPU Scheduler Understanding the Linux 2.6.8.1 CPU Scheduler By Josh Aas c 2005 Silicon Graphics, Inc. (SGI) 17th February 2005 Contents 1 Introduction 3 1.1 Paper Overview............................ 3 1.2 Linux Kernel

More information

ò Scheduling overview, key trade-offs, etc. ò O(1) scheduler older Linux scheduler ò Today: Completely Fair Scheduler (CFS) new hotness

ò Scheduling overview, key trade-offs, etc. ò O(1) scheduler older Linux scheduler ò Today: Completely Fair Scheduler (CFS) new hotness Last time Scheduling overview, key trade-offs, etc. O(1) scheduler older Linux scheduler Scheduling, part 2 Don Porter CSE 506 Today: Completely Fair Scheduler (CFS) new hotness Other advanced scheduling

More information

Understanding the Linux 2.6.8.1 CPU Scheduler

Understanding the Linux 2.6.8.1 CPU Scheduler Understanding the Linux 2.6.8.1 CPU Scheduler By Josh Aas c 2005 Silicon Graphics, Inc. (SGI) 17th February 2005 Contents 1 Introduction 3 1.1 Paper Overview............................................

More information

Scheduling and Kernel Synchronization

Scheduling and Kernel Synchronization 7 Scheduling and Kernel Synchronization In this chapter 7.1 Linux Scheduler 375 7.2 Preemption 405 7.3 Spinlocks and Semaphores 409 7.4 System Clock: Of Time and Timers 411 Summary 418 Exercises 419 373

More information

Chapter 5 Process Scheduling

Chapter 5 Process Scheduling Chapter 5 Process Scheduling CPU Scheduling Objective: Basic Scheduling Concepts CPU Scheduling Algorithms Why Multiprogramming? Maximize CPU/Resources Utilization (Based on Some Criteria) CPU Scheduling

More information

Scheduling. Monday, November 22, 2004

Scheduling. Monday, November 22, 2004 Scheduling Page 1 Scheduling Monday, November 22, 2004 11:22 AM The scheduling problem (Chapter 9) Decide which processes are allowed to run when. Optimize throughput, response time, etc. Subject to constraints

More information

Process Scheduling in Linux

Process Scheduling in Linux The Gate of the AOSP #4 : Gerrit, Memory & Performance Process Scheduling in Linux 2013. 3. 29 Namhyung Kim Outline 1 Process scheduling 2 SMP scheduling 3 Group scheduling - www.kandroid.org 2/ 41 Process

More information

Real-Time Scheduling 1 / 39

Real-Time Scheduling 1 / 39 Real-Time Scheduling 1 / 39 Multiple Real-Time Processes A runs every 30 msec; each time it needs 10 msec of CPU time B runs 25 times/sec for 15 msec C runs 20 times/sec for 5 msec For our equation, A

More information

The Linux Kernel: Process Management. CS591 (Spring 2001)

The Linux Kernel: Process Management. CS591 (Spring 2001) The Linux Kernel: Process Management Process Descriptors The kernel maintains info about each process in a process descriptor, of type task_struct. See include/linux/sched.h Each process descriptor contains

More information

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition Chapter 5: CPU Scheduling Silberschatz, Galvin and Gagne 2009 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating

More information

EECS 750: Advanced Operating Systems. 01/28 /2015 Heechul Yun

EECS 750: Advanced Operating Systems. 01/28 /2015 Heechul Yun EECS 750: Advanced Operating Systems 01/28 /2015 Heechul Yun 1 Recap: Completely Fair Scheduler(CFS) Each task maintains its virtual time V i = E i 1 w i, where E is executed time, w is a weight Pick the

More information

Operating Systems. III. Scheduling. http://soc.eurecom.fr/os/

Operating Systems. III. Scheduling. http://soc.eurecom.fr/os/ Operating Systems Institut Mines-Telecom III. Scheduling Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ Outline Basics of Scheduling Definitions Switching

More information

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems Based on original slides by Silberschatz, Galvin and Gagne 1 Basic Concepts CPU I/O Burst Cycle Process execution

More information

W4118 Operating Systems. Instructor: Junfeng Yang

W4118 Operating Systems. Instructor: Junfeng Yang W4118 Operating Systems Instructor: Junfeng Yang Outline Introduction to scheduling Scheduling algorithms 1 Direction within course Until now: interrupts, processes, threads, synchronization Mostly mechanisms

More information

SYSTEM ecos Embedded Configurable Operating System

SYSTEM ecos Embedded Configurable Operating System BELONGS TO THE CYGNUS SOLUTIONS founded about 1989 initiative connected with an idea of free software ( commercial support for the free software ). Recently merged with RedHat. CYGNUS was also the original

More information

Mitigating Starvation of Linux CPU-bound Processes in the Presence of Network I/O

Mitigating Starvation of Linux CPU-bound Processes in the Presence of Network I/O Mitigating Starvation of Linux CPU-bound Processes in the Presence of Network I/O 1 K. Salah 1 Computer Engineering Department Khalifa University of Science Technology and Research (KUSTAR) Sharjah, UAE

More information

CPU Scheduling. CSC 256/456 - Operating Systems Fall 2014. TA: Mohammad Hedayati

CPU Scheduling. CSC 256/456 - Operating Systems Fall 2014. TA: Mohammad Hedayati CPU Scheduling CSC 256/456 - Operating Systems Fall 2014 TA: Mohammad Hedayati Agenda Scheduling Policy Criteria Scheduling Policy Options (on Uniprocessor) Multiprocessor scheduling considerations CPU

More information

Operating System: Scheduling

Operating System: Scheduling Process Management Operating System: Scheduling OS maintains a data structure for each process called Process Control Block (PCB) Information associated with each PCB: Process state: e.g. ready, or waiting

More information

Task Scheduling for Multicore Embedded Devices

Task Scheduling for Multicore Embedded Devices Embedded Linux Conference 2013 Task Scheduling for Multicore Embedded Devices 2013. 02. 22. Gap-Joo Na (funkygap@etri.re.kr) Contents 2 What is multicore?? 1. Multicore trends 2. New Architectures 3. Software

More information

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling Objectives To introduce CPU scheduling To describe various CPU-scheduling algorithms Chapter 5: Process Scheduling To discuss evaluation criteria for selecting the CPUscheduling algorithm for a particular

More information

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum Scheduling Yücel Saygın These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum 1 Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods

More information

Konzepte von Betriebssystem-Komponenten. Linux Scheduler. Valderine Kom Kenmegne Valderinek@hotmail.com. Proseminar KVBK Linux Scheduler Valderine Kom

Konzepte von Betriebssystem-Komponenten. Linux Scheduler. Valderine Kom Kenmegne Valderinek@hotmail.com. Proseminar KVBK Linux Scheduler Valderine Kom Konzepte von Betriebssystem-Komponenten Linux Scheduler Kenmegne Valderinek@hotmail.com 1 Contents: 1. Introduction 2. Scheduler Policy in Operating System 2.1 Scheduling Objectives 2.2 Some Scheduling

More information

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010. Road Map Scheduling Dickinson College Computer Science 354 Spring 2010 Past: What an OS is, why we have them, what they do. Base hardware and support for operating systems Process Management Threads Present:

More information

Processor Scheduling. Queues Recall OS maintains various queues

Processor Scheduling. Queues Recall OS maintains various queues Processor Scheduling Chapters 9 and 10 of [OS4e], Chapter 6 of [OSC]: Queues Scheduling Criteria Cooperative versus Preemptive Scheduling Scheduling Algorithms Multi-level Queues Multiprocessor and Real-Time

More information

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run SFWR ENG 3BB4 Software Design 3 Concurrent System Design 2 SFWR ENG 3BB4 Software Design 3 Concurrent System Design 11.8 10 CPU Scheduling Chapter 11 CPU Scheduling Policies Deciding which process to run

More information

Understanding the Linux 2.6.8.1 CPU Scheduler

Understanding the Linux 2.6.8.1 CPU Scheduler Understanding the Linux 2.6.8.1 CPU Scheduler Contents By Josh Aas c 2005 Silicon Graphics, Inc. (SGI) 17th February 2005 1 Introduction 3 1.1 Paper Overview............................ 3 1.2 Linux Kernel

More information

Advanced topics: reentrant function

Advanced topics: reentrant function COSC 6374 Parallel Computation Advanced Topics in Shared Memory Programming Edgar Gabriel Fall 205 Advanced topics: reentrant function Functions executed in a multi-threaded environment need to be re-rentrant

More information

Job Scheduling Model

Job Scheduling Model Scheduling 1 Job Scheduling Model problem scenario: a set of jobs needs to be executed using a single server, on which only one job at a time may run for theith job, we have an arrival timea i and a run

More information

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings Operatin g Systems: Internals and Design Principle s Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings Operating Systems: Internals and Design Principles Bear in mind,

More information

10.04.2008. Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

10.04.2008. Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details Thomas Fahrig Senior Developer Hypervisor Team Hypervisor Architecture Terminology Goals Basics Details Scheduling Interval External Interrupt Handling Reserves, Weights and Caps Context Switch Waiting

More information

Tasks Schedule Analysis in RTAI/Linux-GPL

Tasks Schedule Analysis in RTAI/Linux-GPL Tasks Schedule Analysis in RTAI/Linux-GPL Claudio Aciti and Nelson Acosta INTIA - Depto de Computación y Sistemas - Facultad de Ciencias Exactas Universidad Nacional del Centro de la Provincia de Buenos

More information

An Implementation Of Multiprocessor Linux

An Implementation Of Multiprocessor Linux An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than

More information

Multilevel Load Balancing in NUMA Computers

Multilevel Load Balancing in NUMA Computers FACULDADE DE INFORMÁTICA PUCRS - Brazil http://www.pucrs.br/inf/pos/ Multilevel Load Balancing in NUMA Computers M. Corrêa, R. Chanin, A. Sales, R. Scheer, A. Zorzo Technical Report Series Number 049 July,

More information

Threads Scheduling on Linux Operating Systems

Threads Scheduling on Linux Operating Systems Threads Scheduling on Linux Operating Systems Igli Tafa 1, Stavri Thomollari 2, Julian Fejzaj 3 Polytechnic University of Tirana, Faculty of Information Technology 1,2 University of Tirana, Faculty of

More information

A complete guide to Linux process scheduling. Nikita Ishkov

A complete guide to Linux process scheduling. Nikita Ishkov A complete guide to Linux process scheduling Nikita Ishkov University of Tampere School of Information Sciences Computer Science M.Sc. Thesis Supervisor: Martti Juhola February 2015 University of Tampere

More information

A Survey of Parallel Processing in Linux

A Survey of Parallel Processing in Linux A Survey of Parallel Processing in Linux Kojiro Akasaka Computer Science Department San Jose State University San Jose, CA 95192 408 924 1000 kojiro.akasaka@sjsu.edu ABSTRACT Any kernel with parallel processing

More information

Process Scheduling CS 241. February 24, 2012. Copyright University of Illinois CS 241 Staff

Process Scheduling CS 241. February 24, 2012. Copyright University of Illinois CS 241 Staff Process Scheduling CS 241 February 24, 2012 Copyright University of Illinois CS 241 Staff 1 Announcements Mid-semester feedback survey (linked off web page) MP4 due Friday (not Tuesday) Midterm Next Tuesday,

More information

Linux Scheduler Analysis and Tuning for Parallel Processing on the Raspberry PI Platform. Ed Spetka Mike Kohler

Linux Scheduler Analysis and Tuning for Parallel Processing on the Raspberry PI Platform. Ed Spetka Mike Kohler Linux Scheduler Analysis and Tuning for Parallel Processing on the Raspberry PI Platform Ed Spetka Mike Kohler Outline Abstract Hardware Overview Completely Fair Scheduler Design Theory Breakdown of the

More information

CPU Scheduling. CPU Scheduling

CPU Scheduling. CPU Scheduling CPU Scheduling Electrical and Computer Engineering Stephen Kim (dskim@iupui.edu) ECE/IUPUI RTOS & APPS 1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling

More information

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading Announcements Reading Chapter 5 Chapter 7 (Monday or Wednesday) Basic Concepts CPU I/O burst cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution What are the

More information

Effective Computing with SMP Linux

Effective Computing with SMP Linux Effective Computing with SMP Linux Multi-processor systems were once a feature of high-end servers and mainframes, but today, even desktops for personal use have multiple processors. Linux is a popular

More information

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts Objectives Chapter 5: CPU Scheduling Introduce CPU scheduling, which is the basis for multiprogrammed operating systems Describe various CPU-scheduling algorithms Discuss evaluation criteria for selecting

More information

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking.

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking. CPU Scheduling The scheduler is the component of the kernel that selects which process to run next. The scheduler (or process scheduler, as it is sometimes called) can be viewed as the code that divides

More information

Improvement of Scheduling Granularity for Deadline Scheduler

Improvement of Scheduling Granularity for Deadline Scheduler Improvement of Scheduling Granularity for Deadline Scheduler Yoshitake Kobayashi Advanced Software Technology Group Corporate Software Engineering Center TOSHIBA CORPORATION Copyright 2012, Toshiba Corporation.

More information

On Linux Starvation of CPU-bound Processes in the Presence of Network I/O

On Linux Starvation of CPU-bound Processes in the Presence of Network I/O On Linux Starvation of CPU-bound Processes in the Presence of Network I/O 1 K. Salah 1 Computer Engineering Department Khalifa University of Science Technology and Research (KUSTAR) Sharjah, UAE Email:

More information

Linux 2.6 (< 2.6.23) Scheduler. Administrivia. Linux task lists (continued) Linux task lists. Lottery scheduling [Waldspurger 94]

Linux 2.6 (< 2.6.23) Scheduler. Administrivia. Linux task lists (continued) Linux task lists. Lottery scheduling [Waldspurger 94] Administrivia Project 1 due Thursday 4:15pm - Show up to lecture for free extension to midnight - SCPD can just watch lecture before midnight If you need longer, email cs14-staff. - Put extension in the

More information

Real-time KVM from the ground up

Real-time KVM from the ground up Real-time KVM from the ground up KVM Forum 2015 Rik van Riel Red Hat Real-time KVM What is real time? Hardware pitfalls Realtime preempt Linux kernel patch set KVM & qemu pitfalls KVM configuration Scheduling

More information

ICS 143 - Principles of Operating Systems

ICS 143 - Principles of Operating Systems ICS 143 - Principles of Operating Systems Lecture 5 - CPU Scheduling Prof. Nalini Venkatasubramanian nalini@ics.uci.edu Note that some slides are adapted from course text slides 2008 Silberschatz. Some

More information

Overview of Presentation. (Greek to English dictionary) Different systems have different goals. What should CPU scheduling optimize?

Overview of Presentation. (Greek to English dictionary) Different systems have different goals. What should CPU scheduling optimize? Overview of Presentation (Greek to English dictionary) introduction to : elements, purpose, goals, metrics lambda request arrival rate (e.g. 200/second) non-preemptive first-come-first-served, shortest-job-next

More information

UNIVERSITY OF WISCONSIN-MADISON Computer Sciences Department A. Arpaci-Dusseau

UNIVERSITY OF WISCONSIN-MADISON Computer Sciences Department A. Arpaci-Dusseau CS 537 Spring 2000 UNIVERSITY OF WISCONSIN-MADISON Computer Sciences Department A. Arpaci-Dusseau Multilevel Feedback Queue Schedulers In this handout, we give a brief overview of the behavior of the Solaris

More information

A Study of Performance Monitoring Unit, perf and perf_events subsystem

A Study of Performance Monitoring Unit, perf and perf_events subsystem A Study of Performance Monitoring Unit, perf and perf_events subsystem Team Aman Singh Anup Buchke Mentor Dr. Yann-Hang Lee Summary Performance Monitoring Unit, or the PMU, is found in all high end processors

More information

Lecture 3 Theoretical Foundations of RTOS

Lecture 3 Theoretical Foundations of RTOS CENG 383 Real-Time Systems Lecture 3 Theoretical Foundations of RTOS Asst. Prof. Tolga Ayav, Ph.D. Department of Computer Engineering Task States Executing Ready Suspended (or blocked) Dormant (or sleeping)

More information

CS414 SP 2007 Assignment 1

CS414 SP 2007 Assignment 1 CS414 SP 2007 Assignment 1 Due Feb. 07 at 11:59pm Submit your assignment using CMS 1. Which of the following should NOT be allowed in user mode? Briefly explain. a) Disable all interrupts. b) Read the

More information

Process Scheduling in Linux

Process Scheduling in Linux Process Scheduling in Linux This document contains notes about how the Linux kernel handles process scheduling. They cover the general scheduler skeleton, scheduling classes, the completely fair scheduling

More information

Chapter 2 Process, Thread and Scheduling

Chapter 2 Process, Thread and Scheduling Chapter 2 Process, Thread and Scheduling Scheduler Class and Priority XIANG Yong xyong@tsinghua.edu.cn Outline Scheduling Class and Priority Dispatch Queues & Dispatch Tables Thread Priorities & Scheduling

More information

The Role of Load Balancing and High Performance Process Schematics

The Role of Load Balancing and High Performance Process Schematics 1 A Dynamic Scheduler for Balancing HPC Applications Carlos Boneti, Roberto Gioiosa, Francisco J. Cazorla, Mateo Valero Barcelona Supercomputing Center, Spain Universitat Politecnica de Catalunya, Spain

More information

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5 77 16 CPU Scheduling Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5 Until now you have heard about processes and memory. From now on you ll hear about resources, the things operated upon

More information

OPERATING SYSTEMS SCHEDULING

OPERATING SYSTEMS SCHEDULING OPERATING SYSTEMS SCHEDULING Jerry Breecher 5: CPU- 1 CPU What Is In This Chapter? This chapter is about how to get a process attached to a processor. It centers around efficient algorithms that perform

More information

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2) RTOSes Part I Christopher Kenna September 24, 2010 POSIX Portable Operating System for UnIX Application portability at source-code level POSIX Family formally known as IEEE 1003 Originally 17 separate

More information

4003-440/4003-713 Operating Systems I. Process Scheduling. Warren R. Carithers (wrc@cs.rit.edu) Rob Duncan (rwd@cs.rit.edu)

4003-440/4003-713 Operating Systems I. Process Scheduling. Warren R. Carithers (wrc@cs.rit.edu) Rob Duncan (rwd@cs.rit.edu) 4003-440/4003-713 Operating Systems I Process Scheduling Warren R. Carithers (wrc@cs.rit.edu) Rob Duncan (rwd@cs.rit.edu) Review: Scheduling Policy Ideally, a scheduling policy should: Be: fair, predictable

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005 Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation

More information

Jorix kernel: real-time scheduling

Jorix kernel: real-time scheduling Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and

More information

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies Scheduling Main Points Scheduling policy: what to do next, when there are multiple threads ready to run Or multiple packets to send, or web requests to serve, or Definitions response time, throughput,

More information

Linux Block I/O Scheduling. Aaron Carroll aaronc@gelato.unsw.edu.au December 22, 2007

Linux Block I/O Scheduling. Aaron Carroll aaronc@gelato.unsw.edu.au December 22, 2007 Linux Block I/O Scheduling Aaron Carroll aaronc@gelato.unsw.edu.au December 22, 2007 As of version 2.6.24, the mainline Linux tree provides four block I/O schedulers: Noop, Deadline, Anticipatory (AS)

More information

These sub-systems are all highly dependent on each other. Any one of them with high utilization can easily cause problems in the other.

These sub-systems are all highly dependent on each other. Any one of them with high utilization can easily cause problems in the other. Abstract: The purpose of this document is to describe how to monitor Linux operating systems for performance. This paper examines how to interpret common Linux performance tool output. After collecting

More information

Testing task schedulers on Linux system

Testing task schedulers on Linux system Testing task schedulers on Linux system Leonardo Jelenković, Stjepan Groš, Domagoj Jakobović University of Zagreb, Croatia Faculty of Electrical Engineering and Computing Abstract Testing task schedulers

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus 1 Concurrency and Process Challenge: Physical reality is Concurrent Smart to do concurrent software instead of sequential? At least we want to have

More information

Scheduling Algorithms

Scheduling Algorithms Scheduling Algorithms List Pros and Cons for each of the four scheduler types listed below. First In First Out (FIFO) Simplicity FIFO is very easy to implement. Less Overhead FIFO will allow the currently

More information

Hard Real-Time Linux

Hard Real-Time Linux Hard Real-Time Linux (or: How to Get RT Performances Using Linux) Andrea Bastoni University of Rome Tor Vergata System Programming Research Group bastoni@sprg.uniroma2.it Linux Kernel Hacking Free Course

More information

On the implementation of real-time slot-based task-splitting scheduling algorithms for multiprocessor systems

On the implementation of real-time slot-based task-splitting scheduling algorithms for multiprocessor systems On the implementation of real-time slot-based task-splitting scheduling algorithms for multiprocessor systems Paulo Baltarejo Sousa CISTER-ISEP Research Center, Polytechnic Institute of Porto Rua Dr. António

More information

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University Multitasking ARM-Applications with uvision and RTX 1. Objectives The purpose of this lab is to lab is to introduce

More information

White Paper Perceived Performance Tuning a system for what really matters

White Paper Perceived Performance Tuning a system for what really matters TMurgent Technologies White Paper Perceived Performance Tuning a system for what really matters September 18, 2003 White Paper: Perceived Performance 1/7 TMurgent Technologies Introduction The purpose

More information

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads.

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads. CPU Scheduling CPU Scheduling 101 The CPU scheduler makes a sequence of moves that determines the interleaving of threads. Programs use synchronization to prevent bad moves. but otherwise scheduling choices

More information

Load-Balancing for Improving User Responsiveness on Multicore Embedded Systems

Load-Balancing for Improving User Responsiveness on Multicore Embedded Systems Load-Balancing for Improving User Responsiveness on Multicore Embedded Systems 2012 Linux Symposium Geunsik Lim Sungkyungkwan University Samsung Electronics leemgs@ece.skku.ac.kr geunsik.lim@samsung.com

More information

Why Relative Share Does Not Work

Why Relative Share Does Not Work Why Relative Share Does Not Work Introduction Velocity Software, Inc March 2010 Rob van der Heij rvdheij @ velocitysoftware.com Installations that run their production and development Linux servers on

More information

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 05. Threads Paul Krzyzanowski Rutgers University Spring 2015 February 9, 2015 2014-2015 Paul Krzyzanowski 1 Thread of execution Single sequence of instructions Pointed to by the program

More information