LOTTERY SCHEDULING: FLEXIBLE PROPORTIONAL-SHARE RESOURCE MANAGEMENT

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

Advanced Operating Systems
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Scheduling Introduction to Scheduling
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Scheduling Algorithems
Embedded System Lab. 1 Embedded system Lab.
CPU Scheduling Tanenbaum Ch 2.4 Silberchatz and Galvin Ch 5.
Threads, Events, and Scheduling Andy Wang COP 5611 Advanced Operating Systems.
© Ibrahim Korpeoglu Bilkent University
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
G Robert Grimm New York University Lottery Scheduling.
Project 2 – solution code
Tao Yang, UCSB CS 240B’03 Unix Scheduling Multilevel feedback queues –128 priority queues (value: 0-127) –Round Robin per priority queue Every scheduling.
1 Thursday, June 15, 2006 Confucius says: He who play in root, eventually kill tree.
RTOS Scheduling – II EE202A (Fall 2001): Lecture #5.
Scheduling CS623, Lecture 7 3/9/2004 © Joel Wein, updated by T. Suel.
Chapter 11 Operating Systems
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Dreams in a Nutshell Steven Sommer Microsoft Research Institute Department of Computing Macquarie University.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Chapter 2 Processes and Threads Scheduling Classical Problems.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Lottery Scheduling: Flexible Proportional-Share Resource Management Sim YounSeok C. A. Waldspurger and W. E. Weihl.
University of Michigan Electrical Engineering and Computer Science 1 Dynamic Acceleration of Multithreaded Program Critical Paths in Near-Threshold Systems.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
Outline for Today Objectives: Linux scheduler Lottery scheduling
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.
Difference of Degradation Schemes among Operating Systems -Experimental analysis for web application servers- Hideaki Hibino*(Tokyo Tech) Kenichi Kourai.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Scheduling Algorithms : Important Aspects Minimize Response Time –Elapsed time to do an operation (job) –Response time is what the user sees Time to echo.
CS333 Intro to Operating Systems Jonathan Walpole.
STROUD Worked examples and exercises are in the text Programme 29: Probability PROGRAMME 29 PROBABILITY.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Advanced Operating Systems (CS 202) Scheduling Jan, 20, 2016.
Stride Scheduling: Deterministic Proportional-Share Resource Management Carl A. Waldspurger, William E. Weihl MIT Laboratory for Computer Science Presenter:
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
Lecture 12 Scheduling Models for Computer Networks Dr. Adil Yousif.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
Chapter III Scheduling Jehan-François Pâris
CPU Scheduling Andy Wang Operating Systems COP 4610 / CGS 5765.
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.
Scheduling Policies.
Scheduling Some of the slides are adapted from Matt Welsh’s.
Outline for Today Objectives: Announcements Interrupts (continued)
PROCESS MANAGEMENT IN MACH
Advanced Operating Systems (CS 202) Scheduling (2)
Lottery Scheduling and Dominant Resource Fairness (Lecture 24, cs262a)
CPU Scheduling Chapter 5.
Chapter 2 Scheduling.
Threads, Events, and Scheduling
Lottery Scheduling: Flexible Proportional-Share Resource Management
Lottery Scheduling Ish Baid.
Andy Wang Operating Systems COP 4610 / CGS 5765
TDC 311 Process Scheduling.
CPU SCHEDULING.
CPU scheduling decisions may take place when a process:
Threads, Events, and Scheduling
Lecture 2 Part 3 CPU Scheduling
CS703 – Advanced Operating Systems
Threads, Events, and Scheduling
CSE 542: Operating Systems
Don Porter Portions courtesy Emmett Witchel
CPU Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

LOTTERY SCHEDULING: FLEXIBLE PROPORTIONAL-SHARE RESOURCE MANAGEMENT Carl A. Waldspurger William E. Weihl MIT LCS

Overview Lottery scheduling Gives variable numbers of lottery tickets to processes Holds lotteries to decide which thread will get the CPU Paper introduces currencies For allocating CPU among multiple threads of a single user

Traditional schedulers Priority schemes: Priority assignments often ad hoc Schemes using decay-usage scheduling are poorly understood “Fair share” schemes adjust priorities with a feedback loop to achieve fairness Only achieve long-term fairness

Lottery scheduling Priority determined by the number of tickets each thread has: Priority is the relative percentage of all of the tickets whose owners compete for the resource Scheduler picks winning ticket randomly, gives owner the resource

Example Three threads A has 5 tickets B has 3 tickets C has 2 tickets If all compete for the resource B has 30% chance of being selected If only B and C compete B has 60% chance of being selected

Ticket properties Abstract: operate independently of machine details Relative: chances of winning the lottery depends on contention level Uniform: can be used for many different resources

Another advantage Lottery scheduling is starvation-free Every ticket holder will finally get the resource

Fairness analysis (I) Lottery scheduling is probabilistically fair If a thread has a t tickets out of T Its probability of winning a lottery is p = t/T Its expected number of wins over n drawings is np Binomial distribution Variance σ2 = np(1 – p)

Fairness analysis (II) Coefficient of variation of number of wins σ/np = √((1-p)/np) Decreases with √n Number of tries before winning the lottery follows a geometric distribution As time passes, each thread ends receiving its share of the resource

Ticket transfers Explicit transfers of tickets from one client to another They an be used whenever a client blocks due to some dependency When a client waits for a reply from a server, it can temporarily transfer its tickets to the server They eliminate priority inversions

Ticket inflation Lets users create new tickets Like printing their own money Counterpart is ticket deflation Normally disallowed except among mutually trusting clients Lets them to adjust their priorities dynamically without explicit communication

Ticket currencies (I) Consider the case of a user managing multiple threads Want to let her favor some threads over others Without impacting the threads of other users

Ticket currencies (II) Will let her create new tickets but will debase the individual values of all the tickets she owns Her tickets will be expressed in a new currency that will have a variable exchange rate with the base currency

Example (I) Ann manages three threads A has 5 tickets B has 3 tickets C has 2 tickets Ann creates 5 extra tickets and assigns them to process C Ann now has 15 tickets

Example (II) These 15 tickets represent 15 units of a new currency whose exchange rate with the base currency is 10/15 The total value of Ann tickets expressed in the base currency is still equal to 10

Analogy When coins represented specific amounts of gold and silver A king could create new money (inflation) by minting coins with a lesser amount of precious metal Worked well inside the kingdom Exchange rate of new coins with coins from other countries went down.

Compensation tickets (I) I/O-bound threads are likely get less than their fair share of the CPU because they often block before their CPU quantum expires Compensation tickets address this imbalance

Compensation tickets (II) A client that consumes only a fraction f of its CPU quantum can be granted a compensation ticket Ticket inflates the value of all client tickets by 1/f until the client starts gets the CPU (Wording in the paper is much more abstract)

Example CPU quantum is 100 ms Client A releases the CPU after 20ms f = 0.2 or 1/5 Value of all tickets owned by A will be multiplied by 5 until A gets the CPU

Compensation tickets (III) Favor I/O-bound—and interactive—threads Helps them getting their fair share of the CPU

IMPLEMENTATION On a MIPS-based DECstation running Mach 3 microkernel Time slice is 100ms Fairly large as scheme does not allow preemption Requires A fast RNG A fast way to pick lottery winner

Picking the winner (I) First idea: Assign to each client a range of consecutive lottery ticket numbers Create a list of clients Use RNG to generate a winning ticket number Search client list until we find the winner

Example Three threads A has 5 tickets B has 3 tickets C has 2 tickets List contains A (0-4) B (5-7) C (8-9) Search time is O(n) where n is list length

Picking the winner (II) Better idea: For larger n "A tree of partial ticket sums, with clients at the leaves"

Example 4 A 7 B C ≤ > ≤ >

Long-term fairness (I)

Long-term fairness (II) Allocation ratio is ratio of numbers of tickets allocated to the two tasks Measurements made over a 60 s interval Actual allocation fairly close to allocation ratio except for 10:1 ratio Resulted in an average ratio of 13.42 Gets better over longer intervals

Short term fluctuations For 2:1 ticket alloc. ratio

What the paper does not say [A] straightforward implementation of lottery scheduling does not provide the responsiveness for a mixed interactive and CPU-bound workload offered by the decay usage priority scheduler of the FreeBSD operating system. Moreover, standard lottery scheduling ignores kernel priorities used in the FreeBSD scheduler to reduce kernel lock contention.

What the paper does not say Quotes are from: D. Petrou, J. W. Milford, and G. A. Gibson, Implementing Lottery Scheduling: Matching the Specializations in Traditional Schedulers, Proc. USENIX '99, Monterey CA, June 9-11, 1999.