15
1 Kevin Klues, Vlado Handziski, Chenyang Lu, Adam Wolisz, David Culler, David Gay, and Philip Levis 2 Affilia&ons 3 Overview Concurrency Control: Concurrency of I/O operaFons alone, not of threads in general Synchronous vs. Asynchronous I/O Energy Management: Power state of devices needed to perform I/O operaFons Determined by pending I/O requests using Asynchronous I/O 4 OS Flash Driver Overview Physical Flash read() write() setPowerState() Application read() write() read() read() Concurrency Control: Concurrency of I/O operaFons alone, not of threads in general Synchronous vs. Asynchronous I/O Energy Management: Power state of devices needed to perform I/O operaFons Determined by pending I/O requests using Asynchronous I/O 5 Overview The more workload informa&on an applica&on can give the OS, the more energy it can save when scheduling that workload Concurrency Control: Concurrency of I/O operaFons alone, not of threads in general Synchronous vs. Asynchronous I/O Energy Management: Power state of devices needed to perform I/O operaFons Determined by pending I/O requests using Asynchronous I/O 6 Outline Background Informa&on PlaNorm and ApplicaFon Driver architecture EvaluaFon Conclusion

Overview - Computer Science & Engineering at WashUlu/cse467s/slides/icem.pdf · 37 ICEM Architecture • Defines three classes of drivers Virtualized Lock – provide only funconal

Embed Size (px)

Citation preview

1

KevinKlues,VladoHandziski,ChenyangLu,AdamWolisz,DavidCuller,DavidGay,andPhilipLevis

2

Affilia&ons

3

Overview

•  ConcurrencyControl:  ConcurrencyofI/OoperaFonsalone,notofthreadsingeneral  Synchronousvs.AsynchronousI/O

•  EnergyManagement:  PowerstateofdevicesneededtoperformI/OoperaFons

  DeterminedbypendingI/OrequestsusingAsynchronousI/O

4

OS Flash Driver

Overview

Physical Flash

read()

write()

setPowerState()

Application

read() write() read() read()

•  ConcurrencyControl:  ConcurrencyofI/OoperaFonsalone,notofthreadsingeneral  Synchronousvs.AsynchronousI/O

•  EnergyManagement:  PowerstateofdevicesneededtoperformI/OoperaFons

  DeterminedbypendingI/OrequestsusingAsynchronousI/O

5

Overview

Themoreworkloadinforma&onanapplica&oncangivetheOS,themoreenergyit

cansavewhenschedulingthatworkload

•  ConcurrencyControl:  ConcurrencyofI/OoperaFonsalone,notofthreadsingeneral  Synchronousvs.AsynchronousI/O

•  EnergyManagement:  PowerstateofdevicesneededtoperformI/OoperaFons

  DeterminedbypendingI/OrequestsusingAsynchronousI/O

6

Outline

•  BackgroundInforma&on

•  PlaNormandApplicaFon•  Driverarchitecture•  EvaluaFon•  Conclusion

7

Mo&va&on

•  DifficulttomanageenergyintradiFonalOSs HardtotellOSaboutfutureapplicaFonworkloads AlllogicpushedouttotheapplicaFon APIextensionsforhints?

8

Exis&ngOSApproaches

•  DynamicCPUVoltageScaling VerFgo ‐ApplicaFonworkloadclasses GraceOS ‐Explicitreal‐Fmedeadlines

•  DiskSpinDown Coop‐IO ‐ApplicaFonspecifiedFmeouts

9

Exis&ngOSApproaches

Savingenergyisacomplexprocess

•  DynamicCPUVoltageScaling VerFgo ‐ApplicaFonworkloadclasses GraceOS ‐Explicitreal‐Fmedeadlines

•  DiskSpinDown Coop‐IO ‐ApplicaFonspecifiedFmeouts

10

Exis&ngOSApproaches

SavingenergyisacomplexprocessAliCleapplica&onknowledgecanhelpusalot

•  DynamicCPUVoltageScaling VerFgo ‐ApplicaFonworkloadclasses GraceOS ‐Explicitreal‐Fmedeadlines

•  DiskSpinDown Coop‐IO ‐ApplicaFonspecifiedFmeouts

11

SensorNetworks

•  DomaininneedofuniquesoluFontothisproblem Harshenergyrequirements Verysmallsourceofpower(2AAbaWeries) MustrununaWendedfrommonthstoyears

12

SensorNetworks

•  DomaininneedofuniquesoluFontothisproblem Harshenergyrequirements Verysmallsourceofpower(2AAbaWeries) MustrununaWendedfrommonthstoyears

•  FirstgeneraFonsensornetOSes(TinyOS,ConFki,ManFs,...) PushallenergymanagementtotheapplicaFon OpFmalenergysavingsatcostofapplicaFoncomplexity

13

ICEM:IntegratedConcurrencyandEnergyManagement

•  AdevicedriverarchitecturethatautomaFcallymanagesenergy  ImplementedinTinyOS2.0‐‐alldriversfollowit

  IntroducesPowerLocks,split‐phaselockswithintegratedenergyandconfiguraFonmanagement

  Definesthreeclassesofdrivers:dedicated,shared,virtualized  Providesacomponentlibraryforbuildingdrivers

14

ICEM:IntegratedConcurrencyandEnergyManagement

•  AdevicedriverarchitecturethatautomaFcallymanagesenergy  ImplementedinTinyOS2.0‐‐alldriversfollowit

  IntroducesPowerLocks,split‐phaselockswithintegratedenergyandconfiguraFonmanagement

  Definesthreeclassesofdrivers:dedicated,shared,virtualized  Providesacomponentlibraryforbuildingdrivers

•  AdvantagesofusingICEM  Energyefficient–Atleast98.4%ashand‐tunedimplementaFon

  Reducescodecomplexity–400vs.68linesofcode  EnablesnaturaldecomposiFonofapplicaFons

15

Outline

•  IntroducFonandMoFvaFon

•  PlaHormandApplica&on•  ICEMarchitecture

•  EvaluaFon•  Conclusion

16

TheTmotePlaHorm

•  SixmajorI/Odevices

•  PossibleConcurrency  I2C,SPI,ADC

•  EnergyManagement

 Turnperipheralsononlywhenneeded Turnoffotherwise

17

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

18

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

19

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

20

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

21

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

22

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

23

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

24

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

25

Representa&veLoggingApplica&on

Every 12 hours: For all new entries: Send current sample Read next sample

Flash

Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

26

CodeComplexity

Hand-Tuned Application

27

CodeComplexity

Every 5 minutes: Turn on SPI bus Turn on flash chip Turn on voltage reference Turn on I2C bus Log prior readings Start humidity sample Wait 5ms for log Turn off flash chip Turn off SPI bus Wait 12ms for vref Turn on ADC Start total solar sample Wait 2ms for total solar Start photo active sample Wait 2ms for photo active Turn off ADC Turn off voltage reference Wait 34ms for humidity Start temperature sample Wait 220ms for temperature Turn off I2C bus

Hand-Tuned Application

28

CodeComplexity

Every 5 minutes: Turn on SPI bus Turn on flash chip Turn on voltage reference Turn on I2C bus Log prior readings Start humidity sample Wait 5ms for log Turn off flash chip Turn off SPI bus Wait 12ms for vref Turn on ADC Start total solar sample Wait 2ms for total solar Start photo active sample Wait 2ms for photo active Turn off ADC Turn off voltage reference Wait 34ms for humidity Start temperature sample Wait 220ms for temperature Turn off I2C bus

Hand-Tuned Application

29

CodeComplexity

Every 5 minutes: Turn on SPI bus Turn on flash chip Turn on voltage reference Turn on I2C bus Log prior readings Start humidity sample Wait 5ms for log Turn off flash chip Turn off SPI bus Wait 12ms for vref Turn on ADC Start total solar sample Wait 2ms for total solar Start photo active sample Wait 2ms for photo active Turn off ADC Turn off voltage reference Wait 34ms for humidity Start temperature sample Wait 220ms for temperature Turn off I2C bus

Hand-Tuned Application

30

CodeComplexity

Every 5 minutes: Log prior readings sample humidity sample total solar sample photo active sample temperature

ICEM Application Every 5 minutes: Turn on SPI bus Turn on flash chip Turn on voltage reference Turn on I2C bus Log prior readings Start humidity sample Wait 5ms for log Turn off flash chip Turn off SPI bus Wait 12ms for vref Turn on ADC Start total solar sample Wait 2ms for total solar Start photo active sample Wait 2ms for photo active Turn off ADC Turn off voltage reference Wait 34ms for humidity Start temperature sample Wait 220ms for temperature Turn off I2C bus

Hand-Tuned Application

31

Outline

•  IntroducFonandMoFvaFon

•  PlaNormandApplicaFon•  ICEMarchitecture

•  EvaluaFon•  Conclusion

32

Split‐PhaseI/OOpera&ons

•  Split‐phaseI/OoperaFons  Implementedwithinasinglethreadofcontrol

  ApplicaFonnoFfiedofI/OcompleFonthroughdirectupcall

  DrivergivenworkloadinformaFonbeforereturningcontrol

  Example:read()==>readDone()

Application

Driver

read() ()readDone ‏ ‏

I/O request I/O interrupt

void readDone(uint16_t val) { next_val = val; read(); }

33

ICEMArchitecture

•  Definesthreeclassesofdrivers  Virtualized –provideonlyfuncFonalinterface

  Dedicated –providefuncFonalandpowerinterface  Shared –providefuncFonalandlockinterface

34

VirtualizedDeviceDrivers

•  ProvideonlyaFunc&onalinterface•  AssumemulFpleusers•  Implicitconcurrencycontrolthroughbufferingrequests•  Implicitenergymanagementbasedonpendingrequests

•  Forhigher‐levelservicesthatcantoleratelongerlatencies

Energy: Implicit Concurrency: Implicit

Virtualized

35

DedicatedDeviceDrivers

•  ProvideFunc&onalandPowerControlinterfaces•  Assumeasingleuser•  Noconcurrencycontrol•  Explicitenergymanagement

•  Low‐levelhardwareandboWom‐levelabstracFonshaveadedicateddriver

Energy: Implicit Concurrency: None

Dedicated

36

SharedDeviceDrivers

•  ProvideFunc&onalandLockinterfaces•  AssumemulFpleusers

•  ExplicitconcurrencycontrolthroughLockrequest•  Implicitenergymanagementbasedonpendingrequests

•  UsedbyuserswithstringentFmingrequirements

Energy: Implicit Concurrency: Explicit

Shared

37

ICEMArchitecture

•  Definesthreeclassesofdrivers Virtualized –provideonlyfuncFonalinterface

 Dedicated –providefuncFonalandpowerinterface  Shared –providefuncFonalandlockinterface

•  PowerLocks,split‐phaselockswithintegratedenergyandconfiguraFonmanagement

38

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

39

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

40

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

41

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

42

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

43

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

44

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

45

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

46

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

47

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

1

2

3

48

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

Lock - - -

49

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

- - -

50

PowerLocks

Dedicated Driver

Power Locks

Power Control

HW-Specific Configuration

Lock

Functional

- - -

51

ICEMArchitecture

•  Definesthreeclassesofdrivers Virtualized –provideonlyfuncFonalinterface

 Dedicated –providefuncFonalandpowerinterface  Shared –providefuncFonalandlockinterface

•  PowerLocks,split‐phaselockswithintegratedenergyandconfiguraFonmanagement

•  Componentlibrary

 Arbiters –manageI/Oconcurrency Configurators –setupdevicespecificconfiguraFons PowerManagers –provideautomaFcpowermanagement

52

ComponentLibrary

Lock

Power Locks

Power Control

HW-Specific Configuration

53

ComponentLibrary

Lock

Power Control

HW-Specific Configuration

Arbiter

Arbiter Configure

Default Owner

Configurator Power Manager

54

ComponentLibrary

Power Control

HW-Specific Configuration

Arbiter

Arbiter Configure

Default Owner

Configurator Power Manager

Lock

  Lockinterfaceforconcurrencycontrol(FCFS,Round‐Robin)

  ArbiterConfigureinterfaceautomaFchardwareconfiguraFon

  DefaultOwnerinterfaceforautomaFcpowermanagement

55

ComponentLibrary

Power Control

HW-Specific Configuration

Arbiter

Arbiter Configure

Default Owner

Configurator Power Manager

Lock

  Lockinterfaceforconcurrencycontrol(FCFS,Round‐Robin)

  ArbiterConfigureinterfaceautomaFchardwareconfiguraFon

  DefaultOwnerinterfaceforautomaFcpowermanagement

- - -

56

ComponentLibrary

Power Control

HW-Specific Configuration

Arbiter

Arbiter Configure

Default Owner

Configurator Power Manager

Lock

  ImplementArbiterConfigureinterface

  CallhardwarespecificconfiguraFonfromdedicateddriver

57

ComponentLibrary

Power Control

HW-Specific Configuration

Arbiter

Arbiter Configure

Default Owner

Configurator Power Manager

Lock

  ImplementDefaultOwnerinterface

  Powerdowndevicewhendevicefallsidle

  Powerupdevicewhennewlockrequestcomesin

  CurrentlyprovideImmediateandDeferredpolicies 58

SharedDriverExample

•  Msp430 USART (Serial Controller)  Three modes of operation – SPI, I2C, UART

59

SharedDriverExample

Msp430 USART

• Msp430USART(SerialController) ThreemodesofoperaFon–SPI,I2C,UART

Power Control

Functional Configuration 60

SharedDriverExample

Arbiter

Immediate Power Manager

SPI User

Msp430 USART

• Msp430USART(SerialController) ThreemodesofoperaFon–SPI,I2C,UART

SPI Configurator

Power Control

Functional Configuration

Lock

61

Uart Configurator

SharedDriverExample

• Msp430USART(SerialController) ThreemodesofoperaFon–SPI,I2C,UART

Arbiter

Immediate Power Manager

SPI User

Msp430 USART

SPI Configurator

Uart User

I2C User I2C Configurator

Power Control

Functional Configuration

Lock

62

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

63

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

64

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

65

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

66

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

- - -

67

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Functional

68

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Log User

Flash Driver

Log Virtualizer

Lock

Power Control

Block Virtualizer

Block User

69

VirtualizedDriverExample

•  FlashStorage

Arbiter

Immediate Power Manager SPI User

Flash Driver Lock

Power Control

Log User

Log Virtualizer Block Virtualizer

Block User

70

Outline

•  IntroducFonandMoFvaFon

•  PlaNormandApplicaFon•  ICEMarchitecture

•  Evalua&on•  Conclusion

71

Applica&ons

•  HandTuned –Mostenergyefficient

•  ICEM – All concurrentoperaFons•  Serial+ –OpFmalserialordering

•  Serial‐ –Worstcaseserialordering

Every 12 hours: For all new entries: Send current sample Read next sample

Flash Consumer

Sensors Radio

Every 5 minutes: Write prior samples Sample photo active Sample total solar Sample temperature Sample humidity

Producer

72

TmoteEnergyConsump&on

Average energy consumption for application operations

73

TmoteEnergyConsump&on

Average energy consumption for application operations 74

Applica&onEnergyConsump&on

Application energy with 5 minute sampling interval and one send batch every 12 hours

0

25

50

75

100

288 Samples 2 Sends

E (

mA

s) Hand Tuned

ICEM

Serial +

Serial -

75

Applica&onEnergyConsump&on

Application energy with 5 minute sampling interval and one send batch every 12 hours

0

25

50

75

100

288 Samples 2 Sends

E (

mA

s) Hand Tuned

ICEM

Serial +

Serial -

76

Applica&onEnergyConsump&on

Application energy with 5 minute sampling interval and one send batch every 12 hours

0

25

50

75

100

288 Samples 2 Sends

E (

mA

s) Hand Tuned

ICEM

Serial +

Serial -

77

SamplingPowerTrace

Overhead of ICEM to Hand-Tuned Implementation = ADC Timeout + Power Lock Overheads

With 288 samples per day ≈ 2.9 mAs/day ≈ 1049 mAs/year

Insignificant compared to total 5.60% of total sampling energy 0.03% of total application energy

78

ExpectedNodeLife&mes

79

ExpectedNodeLife&mes

80

ExpectedNodeLife&mes

81

Evalua&onConclusions

•  ConclusionsabouttheOS  SmallRAM/ROMoverhead  SmallcomputaFonaloverhead  EfficientlymanagesenergywhengivenenoughinformaFon

•  Conclusionsforthedeveloper  SelectrightpowerdownFmeouts  SubmitI/Orequestsinparallel

82

Conclusion

•  ICEM: Integrated Concurrency and Energy Management   Device driver architecture for low power devices   At least 98.4% as energy efficient as hand-tuned

implementation of representative application   Simplifies application and driver development   Questions the assumption that applications must be responsible

for all energy management and cannot have a standardized OS with a simple API

83

Ques&ons?

84

Ques&ons?

•  SourceForgeTinyOSCVSrepository:  hWp://sourceforge.net/cvs/?group_id=28656

•  Librarycomponentsandinterfaces  Fnyos‐2.x/tos/interfaces  Fnyos‐2.x/tos/lib/power  Fnyos‐2.x/tos/system

•  ExampleDrivers  Atmega128ADC:tos/chips/atm128/adc  MTS300Photo:tos/sensorboards/mts300  MSP430USART0:tos/chips/msp430/usart  Storage:tos/chips/stm25p  CC2420:tos/chips/cc2420

Reading

•  K.Klues,V.Handziski,C.Lu,A.Wolisz,D.Culler,D.GayandP.Levis,IntegraFngConcurrencyControlandEnergyManagementinDeviceDrivers,ACMSymposiumonOperaFngSystemPrinciples(SOSP'07),October2007.

85