Integrating Concurrency Control and Energy Management in Device - - PowerPoint PPT Presentation
Integrating Concurrency Control and Energy Management in Device - - PowerPoint PPT Presentation
Integrating Concurrency Control and Energy Management in Device Drivers Chenyang Lu Why worry about energy? 16x Intel vs. Duracell 14x Processor (MIPS) 12x Hard Disk (capacity) 10x Improvement (compared to year 0) 8x Memory
Why worry about energy?
No Moore’s Law in batteries: 2-3%/year growth!
Processor (MIPS) Hard Disk (capacity) Memory (capacity) Battery (energy stored) 0 1 2 3 4 5 6 16x 14x 12x 10x 8x 6x 4x 2x 1x Improvement (compared to year 0) Time (years)
Intel vs. Duracell
2
3
The Mote Revolution: Low Power Wireless Sensor Network Devices, Joseph Polastre, Robert Szewczyk, Cory Sharp, David Culler, Hot Chips 16.
Low-Power Sensor Platforms
Power State Transitions
Ø System view when switching from sleep to active
4
Source: J. Polastre, R. Szewczyk, C. Sharp, D. Culler. The Mote Revolution: Low Power Wireless Sensor Network Devices. In Hot Chips 16, 2004.
Leaving/entering sleep states costs time & energy
Overview
Ø Concurrency Control:
q Concurrency of I/O operations alone, not of threads in general q Synchronous vs. Asynchronous I/O
Ø Energy Management:
q Power state of devices needed to perform I/O operations q Determined by pending I/O requests using Asynchronous I/O
5
OS Flash Driver Physical Flash
read() write() setPowerState()
Application
read() write() read() read()
Overview
6
Ø Concurrency Control:
q Concurrency of I/O operations alone, not of threads in general q Synchronous vs. Asynchronous I/O
Ø Energy Management:
q Power state of devices needed to perform I/O operations q Determined by pending I/O requests using Asynchronous I/O
The more workload information an application can give the OS, the more energy it can save.
Motivation
ØDifficult to manage energy in traditional OS
q Hard to tell OS about future application workloads q API extensions for hints?
7
Existing OS Approaches
ØDynamic CPU Voltage Scaling
q Vertigo
- Application workload classes
q Grace OS
- Explicit real-time deadlines
ØDisk Spin Down
q Coop-IO
- Application specified timeouts
8
Existing OS Approaches
9
Saving energy is a complex process
ØDynamic CPU Voltage Scaling
q Vertigo
- Application workload classes
q Grace OS
- Explicit real-time deadlines
ØDisk Spin Down
q Coop-IO
- Application specified timeouts
Existing OS Approaches
10
Saving energy is a complex process A little application knowledge can help us a lot
ØDynamic CPU Voltage Scaling
q Vertigo
- Application workload classes
q Grace OS
- Explicit real-time deadlines
ØDisk Spin Down
q Coop-IO
- Application specified timeouts
Sensor Networks
ØDomain in need of unique solution to this problem
q Harsh energy requirements q Very small source of power (2 AA batteries) q Must run unattended from months to years
11
Sensor Networks
ØDomain in need of unique solution to this problem
q Harsh energy requirements q Very small source of power (2 AA batteries) q Must run unattended from months to years
ØFirst generation IoT OSes (TinyOS, Contiki...)
q Push all energy management to the application q Optimal energy savings at cost of application complexity
12
ICEM: Integrated Concurrency and
Energy Management
Ø Device driver architecture that automatically manages energy Ø Introduces Power Locks, split-phase locks with integrated energy and configuration management Ø Defines three classes of drivers: dedicated, shared, virtualized Ø Provides a component library for building drivers Ø Implemented in TinyOS 2.0 -- all drivers follow it
13
Advantages of ICEM
Ø Energy efficient – 98.4% as hand-tuned implementation Ø Reduces code complexity – 400 vs. 68 lines of code Ø Enables natural decomposition of applications
14
The TelosB Platform
Ø Six major I/O devices Ø Possible Concurrency
q I2C, SPI, ADC
Ø Energy Management
q Turn peripherals on only when needed q Turn off otherwise
15
Representative Logging Application
16
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
17
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
Representative Logging Application
18
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
Representative Logging Application
19
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
Representative Logging Application
20
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
Representative Logging Application
21
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
Representative Logging Application
22
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
Representative Logging Application
23
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
Representative Logging Application
24
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
Representative Logging Application
Code Complexity
25 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
Code Complexity
26 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
Code Complexity
27 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
Code Complexity
28
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
Split-Phase I/O Operations
Ø Implemented within a single thread of control Ø Application notified of I/O completion through direct upcall Ø Driver given workload information before returning control Ø Example: read() à readDone()
29
Application Driver read() readDone() I/O request I/O interrupt
void readDone(uint16_t val) { next_val = val; read(); }
ICEM Architecture
Ø Defines three classes of drivers
q Virtualized
– provide only functional interface
q Dedicated
– provide functional and power interface
q Shared
– provide functional and lock interface
30
Dedicated Device Drivers
Ø Provide Functional and Power Control interfaces Ø Assume a single user Ø No concurrency control Ø Explicit energy management Ø Low-level hardware and bottom-level abstractions have a dedicated driver
31
Energy: Implicit Concurrency: None Dedicated
Virtualized Device Drivers
Ø Provide only a Functional interface Ø Assume multiple users Ø Implicit concurrency control through buffering requests Ø Implicit energy management based on pending requests Ø Implemented for higher-level services that can tolerate long latencies
32
Energy: Implicit Concurrency: Implicit Virtualized
Shared Device Drivers
Ø Provide Functional and Lock interfaces Ø Assume multiple users Ø Explicit concurrency control through Lock request Ø Implicit energy management based on pending requests Ø Used by users with stringent timing requirements
33
Energy: Implicit Concurrency: Explicit Shared
ICEM Architecture
34
- Defines three classes of drivers
w Virtualized – provide only functional interface w Dedicated – provide functional and power interface w Shared – provide functional and lock interface
- Power Locks, split-phase locks with integrated energy and
configuration management
Power Locks
35
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
36
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
37
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
38
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
39
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
40
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
41
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
42
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
43
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
44
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional 1 2 3
Power Locks
45
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional Lock
Power Locks
46
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
Power Locks
47
Dedicated Driver
Power Locks
Power Control HW-Specific Configuration Lock Functional
ICEM Architecture
48
- Defines three classes of drivers
w Virtualized – provide only functional interface w Dedicated – provide functional and power interface w Shared – provide functional and lock interface
- Power Locks, split-phase locks with integrated energy and
configuration management
- Component library
w Arbiters – manage I/O concurrency w Configurators – setup device specific configurations w Power Managers – provide automatic power management
Component Library
49
Lock
Power Locks
Power Control HW-Specific Configuration
Component Library
50
Lock Power Control HW-Specific Configuration Arbiter Arbiter Configure Default Owner Configurator Power Manager
Component Library
51
Power Control HW-Specific Configuration Arbiter Arbiter Configure Default Owner Configurator Power Manager Lock
n Lock interface for concurrency control (FCFS, Round-Robin) n ArbiterConfigure interface automatic hardware configuration n DefaultOwner interface for automatic power management
Component Library
52
Power Control HW-Specific Configuration Arbiter Arbiter Configure Default Owner Configurator Power Manager Lock
n Lock interface for concurrency control (FCFS, Round-Robin) n ArbiterConfigure interface automatic hardware configuration n DefaultOwner interface for automatic power management
Component Library
53
Power Control HW-Specific Configuration Arbiter Arbiter Configure Default Owner Configurator Power Manager Lock
n Implement ArbiterConfigure interface n Call hardware specific configuration from dedicated driver
Component Library
54
Power Control HW-Specific Configuration Arbiter Arbiter Configure Default Owner Configurator Power Manager Lock
n Implement DefaultOwner interface n Power down device when device falls idle n Power up device when new lock request comes in n Currently provide Immediate and Deferred policies
Shared Driver Example
Ø Msp430 USART (Serial Controller)
q Three modes of operation – SPI, I2C, UART
55
Shared Driver Example
Ø Msp430 USART (Serial Controller)
q Three modes of operation – SPI, I2C, UART
56
Msp430 USART Power Control Functional Configuration
Shared Driver Example
Ø Msp430 USART (Serial Controller)
q Three modes of operation – SPI, I2C, UART
57
Arbiter Immediate Power Manager SPI User Msp430 USART SPI Configurator Power Control Functional Configuration Lock
Shared Driver Example
Ø Msp430 USART (Serial Controller)
q Three modes of operation – SPI, I2C, UART
58
Uart Configurator Arbiter Immediate Power Manager SPI User Msp430 USART SPI Configurator Uart User I2C User I2C Configurator Power Control Functional Configuration Lock
Virtualized Driver Example
Ø Flash Storage
59
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
60
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
61
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
62
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
63
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
64
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Functional
Virtualized Driver Example
Ø Flash Storage
65
Arbiter Immediate Power Manager SPI User Log User Flash Driver Log Virtualizer Lock Power Control Block Virtualizer Block User
Virtualized Driver Example
Ø Flash Storage
66
Arbiter Immediate Power Manager SPI User Flash Driver Lock Power Control Log User Log Virtualizer Block Virtualizer Block User
Applications
Ø Hand Tuned – Most energy efficient Ø ICEM – All concurrent operations Ø Serial + – Optimal serial ordering Ø Serial - – Worst case serial ordering
67
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
Tmote Energy Consumption
68
Average energy consumption for application operations
Application Energy Consumption
69
Application energy with 5 minute sampling interval and
- ne send batch every 12 hours
25 50 75 100 288 Samples 2 Sends E (mAs) Hand Tuned ICEM Serial + Serial -
Application Energy Consumption
70
Application energy with 5 minute sampling interval and
- ne send batch every 12 hours
25 50 75 100 288 Samples 2 Sends E (mAs) Hand Tuned ICEM Serial + Serial -
Application Energy Consumption
71
Application energy with 5 minute sampling interval and
- ne send batch every 12 hours
25 50 75 100 288 Samples 2 Sends E (mAs) Hand Tuned ICEM Serial + Serial -
Sampling Power Trace
72
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%
- f total sampling energy
0.03%
- f total application energy
Expected Node Lifetimes
73
Expected Node Lifetimes
74
Expected Node Lifetimes
75
Evaluation Conclusions
ØConclusions about the OS
q Small RAM/ROM overhead q Small computational overhead q Efficiently manages energy when given enough information
ØConclusions for the developer
q Build drivers with short power down timeouts q Submit I/O requests in parallel
76
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
77
- K. Klues,
- V. Handziski, C. Lu, A. Wolisz, D. Culler, D. Gay and P. Levis, Integrating
Concurrency Control and Energy Management in Device Drivers, ACM Symposium on Operating System Principles (SOSP'07), October 2007.