Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for...

40
Cinder: Rethinking the Handset Operating System Stephen Rumble , Ryan Stutsman, Philip Levis , and David Mazières Computer Systems Lab Stanford University

Transcript of Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for...

Page 1: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Cinder: Rethinking the Handset Operating System

Stephen Rumble, Ryan Stutsman, Philip Levis, and David MazièresComputer Systems Lab

Stanford University

Page 2: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

UNIX, a Life

Page 3: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

The Progression

1971 2009

Page 4: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

POSIX

• Standardized in 1988

1988 1989

Page 5: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Computing has Changed

• Commodity devices• Rich, user-centric applications• Battery-powered• Untrustworthy programs

Page 6: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

The State of the Art Today

Page 7: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Cinder

• A new operating system designed for mobile phones• Goal: be able to download and run any code without worry• Security

• Solve the morass of current approaches• Track data, not code• Enables simple and easy user policies

• Energy Efficiency• Allow the OS to energy-limit applications• Allow programs to see, in detail, where energy is going

• Start with a clean design, then seek backwards compatibility

Page 8: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Cinder

• A new operating system designed for mobile phones• Goal: be able to download and run any code without worry• Security

• Solve the morass of current approaches• Track data, not code• Enables simple and easy user policies

• Energy Efficiency• Allow the OS to energy-limit applications• Allow programs to see, in detail, where energy is going

• Start with a clean design, then seek backwards compatibility

Page 9: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Framing the Problem

• Energy efficiency• Energy efficiency trades off with time to completion• Never doing something costs no energy

• Energy accounting• Track what is spending it

• Energy limiting• Limit the energy consumption of a particular application• Protects system lifetime from bad applications

Page 10: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Energy Efficiency

Page 11: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Kernel

Application

Device

Page 12: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

Kernel

Application

Device

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Page 13: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

Kernel

Application

Device

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Page 14: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

Kernel

Application

Device

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Page 15: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

Kernel

Application

Device

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Page 16: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Device Control

Kernel

Application

Device

?

?

• Primary challenge is knowing the future workload• Do you power down a device and later spend the cost for warm-up?

• Made more difficult by traditional I/O pattern• Control returns to application a*er I/O, when it might request again

Page 17: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Asynchrony

• Asynchronous I/O: breaks 1-to-1 between threads and I/O• Key mechanism for high performance/highly parallel services• More I/O requests gives OS better scheduling flexibility

• Asynchronous I/O can improve energy efficiency• Given a workload, OS can schedule it • OS difficulty is when an energy resource goes idle

Page 18: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Power Locks

• Every device driver ends up with a specialized policy and mechanism for power management

• Insight: locks have knowledge of future workload• Power locks integrate concurrency and power management• When lock falls idle, power down, perhaps delayed

• Power locks simplify device drivers• Single, general mechanism

• SOSP 2007

Power Lock

Lock

Power Control

Page 19: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Energy Accounting(Fonseca, Dutta, Levis and Stoica, OSDI 2008)

Page 20: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

A Personal Story

Page 21: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Black Box

• No way for users or applications to account for energy use• “What’s expensive” is a guessing game

3 bits of information!

Page 22: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Accounting (for wireless sensors)(OSDI 2008)

Metering

Breakdown 0

1

2

3

4

5

6

7

8

5609 5610 5611 5612 5613 5614

Curre

nt (~

mA)

Time(ms)

MCUBlue

GreenRed

Aggregate Quanto TraceOscilloscope Trace

Accounting

Page 23: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Metering

• Metering: iCount, using a PFM switching regulator• A single wire• Almost zero cost (24 instructions to sample, 1µJ accuracy)

Page 24: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Virtual Metering

• Suzanne Rivoire (Sonoma State University) and Christos Kozyrakis (Stanford University)

• Use internal system performance counters• Derive a model of energy consumption• Accurate to within 2% on most processors

• Extend to broader system

Page 25: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Breakdown

• Instrument each energy sink (hardware resource) to track explicit power state

• Log aggregate energy consumed, interval length, and power state of all devices

• Use linear regression to derive the power draw of each device power state

Page 26: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Activity Tracking

• Track in terms of “resource principals”• All uses of hardware resources have an associated principal• Use labels to track which principal is active• Simple API to change principal

Page 27: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Activity Tracking

• Track in terms of “resource principals”• All uses of hardware resources have an associated principal• Use labels to track which principal is active• Simple API to change principal

• Account on power state or principal change• Share costs across principals when needed

!"#$%&'(!(

!"#$%&'()(

*+,(-./01(2&3&0(

*+,4.5(*+,4.6(

*+,4.5(*+,4.6(

!" !#$" $"*+,(!"#$%#07(

!88(!( !88()( 90:(!( 90:()(;%:0(

Page 28: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Power Summary

• Power locks to easily manage device power states• Accurate accounting through

metering, linear regression, and state tracking

Page 29: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Energy Limiting

Page 30: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Story, Revisited

Page 31: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Design Considerations

• Need to be able to rate-limit energy consumption• Control input power rate• Untrustworthy programs can use up entire battery

• Need to allow infrequent burst of high use• Build up energy

• Prevent starvation• An idle program should not hoard all unused energy

Page 32: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

So*ware Capacitor

• A capacitor C has an energy input i and a decay rate d• C = C*d + e

• A capacitor can create sub-capacitors• Sum of children inputs must be <= parent input• The OS has a “root capacitor,” the battery

• Programs with an empty capacitor do not run• A lack of energy manifests as poor performance

• Prevent an app from consuming all the battery

C

i

d

Page 33: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Chaining

Page 34: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Why Decay?

• Another approach: hard caps• A*er capacitor reaches maximum capacity, all input leaks

• Decay has two advantages• Integrates rate with capacity (simpler management)• Provides a smoother signal (simpler control systems)

Cap Decay

Page 35: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Task Profiles

• Capacitors are a mechanism for enforcement• Need system for policy

• Explicit statement of user intentions• “I expect my maps application to last 2 hours”• “I expect to be able to watch movies for 4 hours”

• Capacitors provide direct feedback• Limits resource use implicitly (e.g., only gets 20% of CPU)• Application adapts its performance accordingly

Page 36: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Malicious Code

• Emergence of third-party application markets• Walled gardens

• Prevent an application from running down the battery using a task profile

Page 37: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Information Flow

• Energy has implications to security

• Decay rate depends on quantity C• Decaying energy is a form of information flow• Requires labels/taint

• Decayed energy returns to the root capacitor• As input is constant, there is no information flow until system runs out

of energy• Inputs must therefore be constant: a contract

Page 38: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Steps

• Port HiStar to ARM processors (almost done)• Add capacitors (done)• Fit nicely into HiStar’s container hierarchy

• Run HiStar on Android phones• Incorporate energy accounting into HiStar• Metering, virtual metering

• Explore mechanisms• Explore policies and user interfaces

Page 39: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Cinder

• A new operating system designed for mobile phones• Goal: be able to download and run any code without worry• Security

• Solve the morass of current approaches• Track data, not code• Enables simple and easy user policies

• Energy Efficiency• Allow the OS to energy-limit applications• Allow programs to see, in detail, where energy is going

• Start with a clean design, then seek backwards compatibility

Page 40: Cinder: Rethinking the Handset Operating System · Cinder •A new operating system designed for mobile phones •Goal: be able to download and run any code without worry • Security

Questions and Feedback