New - saednews.com · 322F dx A = (sin x) + 1 sin Sin —1 sin e lim (COS (cos (cos (cos dx
Resource Management - COS 316 Lecture 13
Transcript of Resource Management - COS 316 Lecture 13
![Page 1: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/1.jpg)
Resource Management
COS 316 Lecture 13
Amit Levy
1
![Page 2: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/2.jpg)
Administrativia
![Page 3: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/3.jpg)
• 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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/4.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/5.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/6.jpg)
Resource Management
![Page 7: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/7.jpg)
• 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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/8.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/9.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/10.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/11.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/12.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/13.jpg)
Example: sharing the CPU
Figure 1: How do we run more applications than cores?10
![Page 14: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/14.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/15.jpg)
Figure 2: Cooperative Scheduling12
![Page 16: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/16.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/17.jpg)
Figure 3: Static Scheduling14
![Page 18: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/18.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/19.jpg)
Figure 4: Round-Robin Timesliced Scheduling16
![Page 20: Resource Management - COS 316 Lecture 13](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/20.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/21.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/22.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/23.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/24.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/25.jpg)
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](https://reader031.fdocuments.us/reader031/viewer/2022012014/6159b658b92b2162c478d968/html5/thumbnails/26.jpg)
References
23