Resource Management for Computer Operating Systems Sarah Bird PhD Candidate Berkeley EECS Burton Smith Technical Fellow Microsoft.

Slides:



Advertisements
Similar presentations
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Advertisements

Paging: Design Issues. Readings r Silbershatz et al: ,
Operating Systems Process Scheduling (Ch 3.2, )
SCHEDULING Kshama Desai Bijal Shah Kishore Putta Kashyap Sheth.
Tools for Investigating Graphics System Performance
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)
Chapter 11 Operating Systems
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
1 Inside the Windows NT Scheduler, Part 1 Assigning CPU time in a uniprocessor environment by Mark Russinovich Windows NT Magazine - July 1997 Inside the.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Spreadsheet Modeling of Linear Programming (LP). Spreadsheet Modeling There is no exact one way to develop an LP spreadsheet model. We will work through.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Tessellation: Space-Time Partitioning in a Manycore Client OS Rose Liu 1,2, Kevin Klues 1, Sarah Bird 1, Steven Hofmeyr 3, Krste Asanovic 1, John Kubiatowicz.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
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.
Chapter 10 Analysis and Design Discipline. 2 Purpose The purpose is to translate the requirements into a specification that describes how to implement.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
1 Iterative Integer Programming Formulation for Robust Resource Allocation in Dynamic Real-Time Systems Sethavidh Gertphol and Viktor K. Prasanna University.
Energy-Aware Resource Adaptation in Tessellation OS 3. Space-time Partitioning and Two-level Scheduling David Chou, Gage Eads Par Lab, CS Division, UC.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Real-Time Operating Systems RTOS For Embedded systems.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Memory Management.
OPERATING SYSTEMS CS 3502 Fall 2017
Processes and threads.
Scheduling of Non-Real-Time Tasks in Linux (SCHED_NORMAL/SCHED_OTHER)
Process Management Process Concept Why only the global variables?
PROCESS MANAGEMENT IN MACH
Operating Systems (CS 340 D)
Networks and Operating Systems: Exercise Session 2
Chapter 2 Scheduling.
Chapter 8 – Processor Scheduling
Operating Systems (CS 340 D)
CS61C : Machine Structures Lecture 6. 2
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Main Memory Background Swapping Contiguous Allocation Paging
Operating systems Process scheduling.
A Simulator to Study Virtual Memory Manager Behavior
Virtual-Time Round-Robin: An O(1) Proportional Share Scheduler
Process Description and Control
Threads Chapter 4.
Process Scheduling Decide which process should run and for how long
Virtual Memory: Working Sets
CSE 153 Design of Operating Systems Winter 2019
COMP755 Advanced Operating Systems
Presentation transcript:

Resource Management for Computer Operating Systems Sarah Bird PhD Candidate Berkeley EECS Burton Smith Technical Fellow Microsoft

Background Management of computing resources is a primary operating system responsibility – It lets multiple applications share a single system These days, we face new challenges – Increasing numbers of cores (hardware threads) – Emergence of parallel applications – Quality of Service (QoS) requirements – The need to manage power and energy Current practice fails to address these issues – Thread management is a good example

Windows Thread Management Windows maintains queues of runnable threads – One queue per priority per core Each core chooses a thread from the head of its nonempty queue of highest priority and runs it The thread runs for a “time quantum” unless it blocks or a higher priority queue becomes nonempty Thread priority can change at scheduling events, with a new priority based on what just happened: – One thread unblocking another – I/O completion (keyboard, mouse, storage, network) – Preemption by a higher priority thread – Time quantum expiration – New thread creation Other operating systems are pretty similar

Some Obvious Shortcomings Operating system thread scheduling is costly – It incurs (needless) changes in protection – User mode thread scheduling is much cheaper Thread progress is unpredictable – Lock-free techniques were invented to avoid this Processes have no control over threads – Despite their big role in memory management Response times are impossible to guarantee – What number of threads is enough for a process? Power and energy are ignored

A Way Forward Resources should be allocated to processes – Cores of various types – Memory (working sets) – Bandwidths, e.g. to shared caches, memory, storage and interconnection networks The operating system should: – Optimize the responsiveness of the system – Respond to changes in user expectations – Respond to changes in process requirements – Maintain resource, power and energy constraints What follows is a scheme to realize this vision

Responsiveness Run times determine process responsiveness – The time from a mouse click to its result – The time from a service request to its response – The time from job launch to job completion – The time to execute a specified amount of work The relationship is usually a nonlinear one – Achievable responses may be needlessly fast – There is generally a threshold of acceptability Run time depends on the resources – Some resources will have more effect than others – Effects will often vary with computational phase

Penalty Functions The penalty function of a process defines how run times translate into responsiveness – Its shape expresses the nonlinearity of the relationship – The shape will depend on the application and on the current user interface state (e.g. minimized) We let the total penalty be the instantaneous sum of the current penalties of the running processes – Resources determine run times and therefore penalties Assigning resources to processes to minimize the total penalty maximizes system responsiveness

Typical Penalty Functions Run time Penalty Deadline Run time Penalty

Adjusting Penalty Functions Penalty functions are like priorities, except: – They apply to processes, not kernel threads – They are explicit convex functions of the run time The operating system can adjust their slopes – Up or down, based on user behavior or preference – The deadlines can probably be left alone The total penalty is easy to compute – The objective is to keep minimizing it

Run Time Functions Generally, they exhibit “diminishing returns” as resources are added to a process – That is, run times are generally convex functions They vary with input and must be measured – Sometimes run time increases with some resource – We may see “plateaus” or various types of “noise” Run time Memory allocation

Resource Allocation As Optimization Continuously minimize  p  P  p (  p (r p,0, … r p,n-1 ) with respect to the resource allocations r p,j, where P,  p,  p, and the r p,j are all time-varying; P is the set of runnable processes; r p,j  0 is the allocation of resource j to process p; The penalty  p depends on the run time  p ;  p depends in turn on the allocated resources r p,j ;  p  P r p,j = A j, the available quantity of resource j. – All unused (slack) resources are allocated to process 0

The Optimization Picture Runtime 1 (r (0,1), …, r (n-1,1) ) Runtime 1 Penalty 1 Continuously minimize the total penalty Runtime 2 (r (0,2), …, r (n-1,2) ) Runtime 2 Runtime i (r (0,i), …, r (n-1,i) ) Runtime i Penalty 2 Penalty i Subject to the total available resources

Convexity and Concavity A function f is convex if for all x, y in  n, in , and 0   1, f( x + (1− )y)  f(x) + (1− )f(y) – Chords of the function’s graph must lie on or above it A function f is concave if for all x, y in  n, in , and 0   1, f( x + (1− )y)  f(x) + (1− )f(y) – Alternatively, f is concave if and only if –f is convex Affine functions Ax + b are both convex and concave If functions f i are convex so is their sum  i f i If functions f i are convex so is their maximum max i f i If f is both convex and monotone non-decreasing and g is convex then h(x) = f(g(x)) is convex If f is convex, so is the set C  = { x  dom(f) | f(x)  } – C  is called the  -sublevel set of f

Convex Optimization A convex optimization problem has the form: Minimize f 0 (x 1, … x m ) subject to f i (x 1, … x m )  0, i = 1, … k where the functions f i : R m  R are all convex Convex optimization has several virtues – It guarantees a single global extremum – It is not much slower than linear programming In our formulation, resource management is a convex optimization problem

Managing Power and Energy Total system power can be limited by an affine resource constraint  j w j ·  p  0 r p,j  W Total power can also be limited using  0 and  0 – Assume all slack resources r 0,j are powered off – Instead of being a run time,  0 is total power It will be convex in each of the slack resources r 0,j –  0 has a slope that can depend on the battery charge Low-penalty work loses to  0 when the battery is depleted Total Power Penalty As charge depletes, slope increases a 0,r Total Power

Modeling Run Times Run time measurements can be used to construct a model, yielding several advantages – “Noise” can be removed while building the model – Interpolation among measurements is avoided – Rates of change with resources are computable We have constructed several types of model – Linear and quadratic (rate) models – Kernel Canonical Correlation Analysis – Genetically Programmed Response Surfaces – Most recently, convex run time models

Convex Models 17 w: learned parameters b : bandwidth allocations  : bandwidth amplifications m: memory allocations

Modeling Results Our convex models fit the data very well – We are now seeing how they work in practice We think linear least-squares applied to past run time data can learn the model parameters – The QR matrix factorization can be updated and downdated to track changes in process behavior We have also discovered some interesting artifacts along the way…

Nbodies Frame Time

PACORA PACORA stands for “Performance-Aware Convex Optimization for Resource Allocation” – See our paper in the poster session of HotPar ‘11 It manages resource allocation policy in the Berkeley ParLab’s Tesselation operating system – One of us (Bird) is currently implementing it Nearly all of the ideas presented here are being prototyped in PACORA and in Tesselation – If these ideas work they may be used elsewhere

Policy Service Major Change Request ACK/NAC K App Creation and Resizing Requests from Users Admissio n Control Minor Changes ACK/NACK App All system resources App group with fraction of resources App Current Application Store (Current Resources) Global Policies / User Policies and Preferences Offline Models and Behavioral Parameters Build and Refine Resource Value Functions App #1 App #2 App #3 User/System Performance Reports Convex Optimization Set Penalty Functions Decision Validation 24 PACORA in Tessellation Resource Allocations Performance/Ener gy Counters

Acknowledgements Stephen Boyd and Lieven Vandenberghe, whose book taught us about convex optimization book Krste Asanović, David Patterson, and John Kubiatowicz at Berkeley, for their strong support The Microsoft Windows developers, for giving us real applications and ways to measure them Colleagues at the UC Berkeley ParLab and at Microsoft Research, for helping us tell the story

Thank you. Any Questions?