Top Banner
Resource Management COS 316 Lecture 13 Amit Levy 1
26

Resource Management - COS 316 Lecture 13

Oct 03, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Resource Management - COS 316 Lecture 13

Resource Management

COS 316 Lecture 13

Amit Levy

1

Page 2: Resource Management - COS 316 Lecture 13

Administrativia

Page 3: Resource Management - COS 316 Lecture 13

• Assignment 4: Object Relational Mapper

• Released tomorrow (Nov. 5th)

• Due two weeks from tomorrow (Nov. 19th)

• General rule: something due every Tuesday, alternating assignmentand problem set

2

Page 4: Resource Management - COS 316 Lecture 13

Term Paper: System Analysis

• Due on dean’s date

• Groups of 1 or 2 (groups highly encouraged)

• Topic proposals due after Thanksgiving break

• What is the paper about?

1. Pick an open source system, or component of an open source system

2. Describe it in detail using analytical tools from the course

• Expect ~10 pages, but no strict limit or minimum3

Page 5: Resource Management - COS 316 Lecture 13

Term Paper: Example Systems to Analyze

• Nix package manager

• Node Package Manager (NPM), Ruby gems, Rust crates, etc

• Kubernetes

• MapReduce, TensorFlow, Spark

• The Linux device driver API

• ActiveRecord from Ruby on Rails

• WordPress plugin system4

Page 6: Resource Management - COS 316 Lecture 13

Resource Management

Page 7: Resource Management - COS 316 Lecture 13

• So far, we’ve talked about naming and caching as ways of making anapplication simpler to organize, more efficient, etc.

• Rest of the semester we’ll focus on design principles for mediatingand managing multiple applications:

• Resource management

• Virtualization

• Access Control

5

Page 8: Resource Management - COS 316 Lecture 13

What is resource management?

Recall one of our systems criteria from first lecture:Mediates access to shared resources

Touched on this a little:

• Allocation in naming schemes are policies for sharing a namespace,names indicate unique partitions of a resource

• Eviction algorithms are policies for sharing a cache

6

Page 9: Resource Management - COS 316 Lecture 13

What is resource management?

• Policies and layers of abstraction that expose a resource to multipleapplications

• Policies and abstractions have important effect on:

• Performance

• Flexibility

• Security

7

Page 10: Resource Management - COS 316 Lecture 13

Key Characteristics

• Fixed or arbitrary number of applications

• How many applications can the policy support? At what cost?

• Mandatory or cooperative sharing

• Are applications trusted to yield the resource?

• Virtual or explicit sharing

• Are applications aware they are using a shared resource?

8

Page 11: Resource Management - COS 316 Lecture 13

Which shared resources are there?

Which resources are shared by controllers or request handlers in a webapplication?

• CPU

• Memory

• Files, database, disk

• Local network controller

• Network and Internet links

9

Page 12: Resource Management - COS 316 Lecture 13

Which shared resources are there?

Which resources are shared by controllers or request handlers in a webapplication?

• CPU

• Memory

• Files, database, disk

• Local network controller

• Network and Internet links9

Page 13: Resource Management - COS 316 Lecture 13

Example: sharing the CPU

Figure 1: How do we run more applications than cores?10

Page 14: Resource Management - COS 316 Lecture 13

Three Policies for Sharing the CPU

1. Cooperative scheduling

2. Static scheduling

3. Round-robin timeslice scheduling

11

Page 15: Resource Management - COS 316 Lecture 13

Figure 2: Cooperative Scheduling12

Page 16: Resource Management - COS 316 Lecture 13

Cooperative Scheduling

• Fixed number of applications

• Apps have to know who they are yielding to

• Cooperative sharing

• An application could never yield

• Explicit sharing

• Applications must be written with sharing in mind

13

Page 17: Resource Management - COS 316 Lecture 13

Figure 3: Static Scheduling14

Page 18: Resource Management - COS 316 Lecture 13

Static Scheduling

• Fixed number of applications

• Scheduler subdivides time into fixed number of slots

• Mandatory sharing

• Applications preempted when their timeslice is up

• Virtual sharing

• Applications can be written as though they have exclusive access

15

Page 19: Resource Management - COS 316 Lecture 13

Figure 4: Round-Robin Timesliced Scheduling16

Page 20: Resource Management - COS 316 Lecture 13

Round-Robin Timesliced Scheduling

• Arbitrary number of applications

• Just add more applications to the queue

• Mandatory & Cooperative sharing

• Applications preempted when their timeslice is up

• Applications may also yield via I/O or sleep operations

• Virtual sharing

• Applications can be written as though they have exclusive access

17

Page 21: Resource Management - COS 316 Lecture 13

Performance Comparison

• Cooperative sharing

• CPU never has to do extra work for spurious context switches

• Applications switch when most convenient for performance

• Mandatory sharing

• Each application guaranteed some base level of performance

• Wasteful if application doesn’t use entire timeslice, or if context switches arefrequent

18

Page 22: Resource Management - COS 316 Lecture 13

Flexibility Comparison

• Fixed number of applications clearly less flexible than arbitrarynumber

• Virtual sharing means scheduling policy can be replaced under thehood

• Cooperative sharing allows applications to use slightly more orslightly less time on CPU

19

Page 23: Resource Management - COS 316 Lecture 13

Security

• Applications can learn secrets from other applications

func application1(secret string) {if secret == "password" {spin_for_10_seconds()

}yield()

}

20

Page 24: Resource Management - COS 316 Lecture 13

Resource Management

• Most systems run applications that share lots of resources

• System defines abstractions and policies for sharing resources

• Key characteristics:

• Fixed vs arbitrary number of applications

• Mandatory vs cooperative sharing

• Virtual vs explicit sharing

• Resource management policies affect performance, flexibility, security21

Page 25: Resource Management - COS 316 Lecture 13

Up Next

1. Wednesday: Network Layers (Prof. Rexford)

2. Monday: Wireless Networking (Prof. Jamieson)

3. Wednesday: Congestion Control (Prof. Freedman)

22

Page 26: Resource Management - COS 316 Lecture 13

References

23