apprehending joule thieves with cinder

52
1 Apprehending Joule Thieves With Cinder Stephen M. Rumble, Ryan Stutsman, Philip Levis, David Mazières Stanford University Nickolai Zeldovich MIT

Upload: others

Post on 22-Dec-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Apprehending Joule Thieves With Cinder

1

Apprehending Joule ThievesWith Cinder

Stephen M. Rumble, Ryan Stutsman,Philip Levis, David Mazières

Stanford University

Nickolai ZeldovichMIT

Page 2: Apprehending Joule Thieves With Cinder

2

Handheld Linux

Page 3: Apprehending Joule Thieves With Cinder

3

Desktop Resource Management

If it's slowadd more resources

Page 4: Apprehending Joule Thieves With Cinder

4

The State of Mobile Devices

● Complex● Running full UNIX stacks● Multiprogrammed● Software from many sources● Hard to trace resource consumption to individual tasks

● Users care about● Energy● Network

Page 5: Apprehending Joule Thieves With Cinder

5

The Future of Mobile Devices

● Need new OS mechanisms● Make resource accounting a first class OS primitive

● This talk: energy● Same mechanism applies to networking, which is 

easier● Cinder OS

● Simple kernel– Easy to reason about– Familiar UNIX userland

Page 6: Apprehending Joule Thieves With Cinder

6

Cinder Goals

● Energy as a first class resource● Track it● Ration it● Delegate it

● In terms the user understands● Talk time/Standby time rationing

– Phone calls (total talk time, 911)– “Games & Widgets” folder– E­mail (composing versus polling)

Page 7: Apprehending Joule Thieves With Cinder

7

Capacitors

● First­class abstraction● Can be named and manipulated● Protected by permissions

● All threads run in the context of one or more● Track and ration resources for all actions

– CPU usage– Flash writes– Network transmissions

Page 8: Apprehending Joule Thieves With Cinder

8

Capacitors

maps

Page 9: Apprehending Joule Thieves With Cinder

9

Capacitors

● Input rate● Throttles consumption

maps

1 W

Page 10: Apprehending Joule Thieves With Cinder

10

Capacitors

● Input rate● Throttles consumption

● Energy storage● Allows for burstiness

maps

1 W

Page 11: Apprehending Joule Thieves With Cinder

11

Capacitors

● Input rate● Throttles consumption

● Stored energy● Allows for burstiness

● Half­life● Acts as a ceiling● Prevents hoarding/starvation

maps

1 W

Page 12: Apprehending Joule Thieves With Cinder

12

Capacitors

● Input rate● Throttles consumption

● Stored energy● Allows for burstiness

● Half­life● Acts as a ceiling● Prevents hoarding/starvation

● Form a hierarchy maps

1 W

1 W

Page 13: Apprehending Joule Thieves With Cinder

13

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited

maps

Page 14: Apprehending Joule Thieves With Cinder

14

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited

maps

Page 15: Apprehending Joule Thieves With Cinder

15

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited

maps

X

Page 16: Apprehending Joule Thieves With Cinder

16

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited maps

Page 17: Apprehending Joule Thieves With Cinder

17

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited maps

Page 18: Apprehending Joule Thieves With Cinder

18

Hierarchy

● Allows composition of policies● Actions debited upward

● To the battery● Block on any empty ancestor

● Can't perform actions● Effectively rate limited maps

Page 19: Apprehending Joule Thieves With Cinder

19

Throttle Games

20 KJ

1 W

0 J

wumpus roguespacewar

Page 20: Apprehending Joule Thieves With Cinder

20

Downloaded Apps

● Include resource declarations● Background / 

Foreground● Hold them to it

● 1 MB/mo ($.40)– about 3 bps

● 24 hrs active life – about 250 mW

20 KJ

250 mW

0 J

200 MB

0 B

3 bps

iFoo

Page 21: Apprehending Joule Thieves With Cinder

21

Composition

20 KJ

0 J

wumpus roguespacewar

1 W

0 J

iFoo

250 mW

Page 22: Apprehending Joule Thieves With Cinder

22

Limits on Background Apps

● User's expectations● Driven from interaction● Not visible not using energy

● “Foreground” Capacitor● Increased 

responsiveness/fidelity● Matches user's expectations● Driven from specification for 

downloaded apps

20 KJ

iFoo

250 mW 1 W

Page 23: Apprehending Joule Thieves With Cinder

23

Limits on Background Apps

● User's expectations● Driven from interaction● Not visible not using energy

● “Foreground” Capacitor● Increased 

responsiveness/fidelity● Matches user's expectations● Driven from specification for 

downloaded apps

20 KJ

iFoo

250 mW 1 W

Page 24: Apprehending Joule Thieves With Cinder

24

Capacitors

● Fine­grained● Tracking● Rationing

– Limits– Reservations

● Delegation● Composable

● Can represent● Users● Applications● Classes of Apps● Vendors● Web­application 

Origins

● Easily expresses real­world policies

Page 25: Apprehending Joule Thieves With Cinder

25

Initial Results

● OS running on the HTC Dream● AKA T­Mobile G1 with Google● Keyboard, Display, Serial port● Incoming and outgoing phone calls 

work!– No audio

● Text messaging works● GPS works for 45 seconds

● Also runs on x86_64 desktops/laptops

Page 26: Apprehending Joule Thieves With Cinder

26

Initial Results

● Capacitors implemented● All threads are accounted for 

using capacitors● Only accounts for the CPU

Page 27: Apprehending Joule Thieves With Cinder

27

Remaining Work

● Create a rich energy model for a device● Hopefully the HTC Dream

● Craft interesting policies● Validate the approach

● Experiment with user involvement● Allow the user to specify policies easily

Page 28: Apprehending Joule Thieves With Cinder

28

Q&A

Page 29: Apprehending Joule Thieves With Cinder

29

Example

Page 30: Apprehending Joule Thieves With Cinder

30

Example

Page 31: Apprehending Joule Thieves With Cinder

31

Permissions

● Ownership allows a thread to– Change the capacitor's parameters– Grant other threads Ownership

● Consumption allows a thread to– Use energy of the capacitor– Read energy levels of the capacitor– Attach child capacitors– Grant other threads Consumption

Page 32: Apprehending Joule Thieves With Cinder

32

Current Mechanisms

● Users● Disk quotas

– No delegation

● Processes● nice

– Priorities– Can't reason about

● setrlimit

– Kill switch– Child processes inherit 

same limits

Neither address energy or networking

Page 33: Apprehending Joule Thieves With Cinder

33

State­of­the­art accounting

● Profile device­state consumption● Statically or dynamically

● Account to tasks● Bill for device­state changes

● Difficulties● Ambiguity● Lack of fine­grained sensors

● Prior control systems limited

Page 34: Apprehending Joule Thieves With Cinder

34

Subdivision

maps

route

render

gps­sense

gui­shell

Page 35: Apprehending Joule Thieves With Cinder

35

Cgroups

● Cinder● Energy● Application controlled

● Linux Cgroups● No energy yet

– Pluggable● Large kernel   High →

baseline

Page 36: Apprehending Joule Thieves With Cinder

36

setrlimit

● Capacitors● Energy● Network● Limits

– Blocks on violation● Reservations● For use in the general 

case

● setrlimit● No energy● No network● “Kill” limits

– Sends signal or aborts● No Reservations● Intended for 

runaways

Page 37: Apprehending Joule Thieves With Cinder

37

ECOsystem/Currentcy

● Cinder● Hierarchical● Network

● ECOsystem● “Task” Containers● Energy specific

Page 38: Apprehending Joule Thieves With Cinder

38

Over­committing                 

● Contention for resources● First­come­first­served 10 W

6 W 6 W

Page 39: Apprehending Joule Thieves With Cinder

39

Reservations

● No Over­commiting● Act as a reservation● Guaranteed and set aside

● Works● As a rate● As a quantity

10 W

6 W 4 W

Page 40: Apprehending Joule Thieves With Cinder

40

Reservations

● No Over­commiting● Act as a reservation● Guaranteed and set aside

● Works● As a rate● As a quantity

10 J

6 J 4 J

12 J

Page 41: Apprehending Joule Thieves With Cinder

41

Guarantee a 5­minute 911 call

20 KJ

0 W 

250 J

911

Page 42: Apprehending Joule Thieves With Cinder

42

Throttle Games

20 KJ

1 W

0 J

wumpus roguespacewar

Page 43: Apprehending Joule Thieves With Cinder

43

Composition

20 KJ

0 W

250 J

911

0 J

wumpus roguespacewar

1 W

Page 44: Apprehending Joule Thieves With Cinder

44

Amortizing GPS Costs

GPSd

maps

Page 45: Apprehending Joule Thieves With Cinder

45

Amortizing GPS Costs

GPSd

maps

Page 46: Apprehending Joule Thieves With Cinder

46

Amortizing GPS Costs

GPSd

maps

Page 47: Apprehending Joule Thieves With Cinder

47

Amortizing GPS Costs

GPSd

maps

Page 48: Apprehending Joule Thieves With Cinder

48

Amortizing GPS Costs

GPSd

loc­share

Page 49: Apprehending Joule Thieves With Cinder

49

Amortizing GPS Costs

GPSd

loc­share

Page 50: Apprehending Joule Thieves With Cinder

50

Amortizing GPS Costs

GPSd

loc­share

Page 51: Apprehending Joule Thieves With Cinder

51

Amortizing GPS Costs

GPSd

loc­share

Page 52: Apprehending Joule Thieves With Cinder

52

Amortizing GPS Costs

GPSd

loc­share