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



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

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

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

Linux Process Scheduling Policy

W4118 Operating Systems. Instructor: Junfeng Yang

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

Process Scheduling in Linux

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

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

Linux Scheduler. Linux Scheduler

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

Konzepte von Betriebssystem-Komponenten. Linux Scheduler. Valderine Kom Kenmegne Proseminar KVBK Linux Scheduler Valderine Kom

Linux O(1) CPU Scheduler. Amit Gud amit (dot) gud (at) veritas (dot) com

Process Scheduling II

Operating Systems. III. Scheduling.

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

CPU Scheduling. CPU Scheduling

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

Processor Scheduling. Queues Recall OS maintains various queues

Scheduling Algorithms

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

CPU Scheduling Outline

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

Chapter 5 Process Scheduling

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

Completely Fair Scheduler and its tuning 1

OPERATING SYSTEMS SCHEDULING

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

Operating Systems Lecture #6: Process Management

Job Scheduling Model

Operating System: Scheduling

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

W4118 Operating Systems. Instructor: Junfeng Yang

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

Real-Time Scheduling 1 / 39

CPU Scheduling. Core Definitions

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

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

ICS Principles of Operating Systems

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

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

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

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

Threads Scheduling on Linux Operating Systems

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

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

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

Load Balancing in Distributed System. Prof. Ananthanarayana V.S. Dept. Of Information Technology N.I.T.K., Surathkal

Scheduling. Monday, November 22, 2004

Linux process scheduling

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

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

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

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

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

Tasks Schedule Analysis in RTAI/Linux-GPL

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

Understanding the Linux CPU Scheduler

Understanding the Linux CPU Scheduler

CS Fall 2008 Homework 2 Solution Due September 23, 11:59PM

Introduction. Scheduling. Types of scheduling. The basics

Linux Block I/O Scheduling. Aaron Carroll December 22, 2007

Improvement of Scheduling Granularity for Deadline Scheduler

Operating Systems, 6 th ed. Test Bank Chapter 7

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Weight-based Starvation-free Improvised Round-Robin (WSIRR) CPU Scheduling Algorithm

A Group based Time Quantum Round Robin Algorithm using Min-Max Spread Measure

Chapter 5 Linux Load Balancing Mechanisms

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

CS414 SP 2007 Assignment 1

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

Multilevel Load Balancing in NUMA Computers

Task Scheduling for Multicore Embedded Devices

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

Job Scheduling for MapReduce

Overview of the Linux Scheduler Framework

Jorix kernel: real-time scheduling

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Real- Time Scheduling

4. Fixed-Priority Scheduling

Scheduling for QoS Management

Scheduling algorithms for Linux

Scheduling and Kernel Synchronization

A Markovian Sensibility Analysis for Parallel Processing Scheduling on GNU/Linux

Design and performance evaluation of Advanced Priority Based Dynamic Round Robin Scheduling Algorithm (APBDRR)

OS OBJECTIVE QUESTIONS

Class-based Prioritized Resource Control in Linux

REAL TIME OPERATING SYSTEMS. Lesson-10:

Linux Load Balancing

Lecture 3 Theoretical Foundations of RTOS

PROCESS SCHEDULING ALGORITHMS: A REVIEW

A Review on Load Balancing In Cloud Computing 1

Safe Kernel Scheduler Development with Bossa

Process definition Concurrency Process status Process attributes PROCESES 1.3

Linux Scheduler Improvement for Time Demanding Network Applications, Running on Communication Platform Systems

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Announcements. Midterms. Mt #1 Tuesday March 6 Mt #2 Tuesday April 15 Final project design due April 11. Chapters 1 & 2 Chapter 5 (to 5.

Operating System Aspects. Real-Time Systems. Resource Management Tasks

A Comparative Study of CPU Scheduling Algorithms

Transcription:

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: Scheduling in Linux p. 1

Scheduling policy ULK2e 11.1 Combination of priority scheduling + round robin scheduling Preemptive when a process enters the TASK_RUNNING state, kernel checks priority if priority of current task is less than priority of new process, it is preempted Priority is dynamically calculated increase priority of waiting processes decrease priority of processes running for a long time Operating Systems: Scheduling in Linux p. 2

2.4 Scheduler 2.4 Scheduler Operating Systems: Scheduling in Linux p. 3

Static priority (rt_priority) assigned to real-time processes only ranges from 1 to 99; 0 for conventional processes never changed by the scheduler Priorities Dynamic priority applies only to conventional processes dynamic priority of conventional process is always less than static priority of real-time process Operating Systems: Scheduling in Linux p. 4

Scheduling algorithm ULK2e 11.2 CPU time is divided into epochs In each epoch, every process gets a specified time quantum quantum = maximum CPU time assigned to the process in that epoch duration of quantum computed when epoch begins different processes may have different time quantum durations when process forks, remainder of parent s quantum is split / shared between parent and child Epoch ends when all runnable processes have exhausted their quanta At end of epoch, scheduler algorithm recomputes the time-quantum durations of all processes; new epoch begins Operating Systems: Scheduling in Linux p. 5

Implementation Scheduling related fields in proc structure counter: contains quantum alloted to a process when new epoch begins decremented for current process by 1 at every tick nice: contains values ranging between -20 and +19 negative values high priority processes positive values low priority processes 0 (default value) normal processes. Operating Systems: Scheduling in Linux p. 6

Scheduling algorithm Process selection: c = -1000; list_for_each(tmp, &runqueue_head) { p = list_entry(tmp, struct task_struct, run_list); if (p->cpus_runnable & p->cpus_allowed & (1 << this_cpu)) { int weight = goodness(p, this_cpu, prev->active_mm); if (weight > c) c = weight, next = p; // break ties using FCFS } } Best candidate may be the current process c == 0 new epoch begins for_each_task(p) // all EXISTING processes p->counter = (p->counter >> 1) + (20 - p->nice) / 4 + 1; Operating Systems: Scheduling in Linux p. 7

goodness() Case I: p is a conventional process that has exhausted its quantum (p->counter is zero) weight = 0 Case II: p is a conventional process that has not exhausted its quantum weight = p->counter + 20 - p->nice; if (p->processor == this_cpu) weight +=15; if (p->mm == this_mm!p->mm) weight += 1; /* 2 <= weight <= 77 */ Case III: p is a real-time process weight = p->counter + 1000 // weight >= 1000 Operating Systems: Scheduling in Linux p. 8

Limitations ULK2e 11.2.3 Scalability: if # of existing/runnable processes is large inefficient to recompute all dynamic priorities I/O bound processes are boosted only at the end of an epoch interactive applications have longer response time if number of runnable processes is large I/O-bound process boosting strategy: batch programs with almost no user interaction may be I/O-bound e.g. database search engine, network application that collects data from a remote host on a slow link Operating Systems: Scheduling in Linux p. 9

2.6 Scheduler 2.6 Scheduler Operating Systems: Scheduling in Linux p. 10

Priorities ULK3e 7.2 Static priority (static_prio) low value high priority 0 99: real-time processes 100 139: conventional process default value is 120 may be changed via nice() new process inherits static priority of its parent Base time quantum time (ms) allocated to a process when it has exhausted its previous time quantum if (static_prio < 120) base = (140-static_prio) * 20; else if (static_prio >= 120) base = (140-static_prio)*5; Operating Systems: Scheduling in Linux p. 11

Priorities Dynamic priority (prio) interactive tasks receive a prio bonus CPU bound tasks receive a prio penalty prio = MAX(100, MIN(static_prio - bonus + 5, 139)) where bonus = MIN(sleep_avg / 100, 10) Operating Systems: Scheduling in Linux p. 12

Active vs. expired processes Active processes: runnable processes that have not yet exhausted their time quantum Expired processes: runnable processes that have exhausted their time quantum Time quantum is recalculated on expiry (cf. base time quantum) Active batch processes that finish time quantum expire Active interactive processes that finish time quantum: if the eldest expired process has already waited for a long time, or if an expired process has higher static priority than the interactive process expire otherwise, time quantum is refilled and process remains in the set of active processes Process is interactive if bonus - 5 >= static_prio / 4-28 Operating Systems: Scheduling in Linux p. 13

ULK3e 7.3 Data structures Bitmap keeps track of which process lists are non-empty Operating Systems: Scheduling in Linux p. 14

scheduler_tick() 1. Decrease the ticks left in the allocated time of the process. 2. Update dynamic priority using sleep_avg. 3. If necessary, refill the time allocation for the process with the base quantum. 4. Insert process in expired queue / active queue based on (i) whether the task is interactive, (ii) whether the expired tasks are starving, (iii) relative priority of the process w.r.t. expired processes. Operating Systems: Scheduling in Linux p. 15