marcin miete based on
play

Marcin Miete Based on K. Klues, V. Handziski, C. Lu, A. Wolisz, D. - PowerPoint PPT Presentation

Integrating Concurrency Control and Energy Management in Device Drivers Marcin Miete Based on K. Klues, V. Handziski, C. Lu, A. Wolisz, D. Culler, D. Gay, and P. Levis: Integrating Concurrency Control and Energy Management in Device


  1. Integrating Concurrency Control and Energy Management in Device Drivers Marcin Mieteń Based on K. Klues, V. Handziski, C. Lu, A. Wolisz, D. Culler, D. Gay, and P. Levis: “Integrating Concurrency Control and Energy Management in Device Drivers ,” in Proceedings SOSP 2007, Stevenson, WA, USA, October 2007.

  2. First look at the problem  Concurrency Control of I/O operations  Energy Management – power state of devices is determined by pending, asynchronous I/O requests

  3. Sensornets – motivation  Energy management is a critical concern in wireless sensornets (small source of power, must run from months to years).  First generation sensornet Oses (TinyOS, Contiki, Mantis)  Push all energy management to the application  Optimal energy saving at cost of application complexity.

  4. ● ICEM ( Integrated Concurrency Control and Energy Management)  A device driver architecture that enables simple, energy efficient wireless sensornet applications.  Simple API  Sensornet applications don't have to be responsible for all power management  Implemented in TinyOS 2.0

  5. Energy management  OS can improve energy efficiency by putting peripherals into low power modes and dropping process to a sleep state when idle.  We have many researches about saving energy in OS but...  Most modern operating system still use very simplistic energy management policies.

  6. Hardware  T2 on the telos  8MHz 16 bit CPU  250kbps 802.15.4 radio  2 MB external flash  10kB of RAM

  7. What we have  6 major I/O devices (sensors)  Possible Concurrency: I2C, SPI, ADC  Energy management ­ turn on peripherals only when needed

  8. Concurrency opportunities  I2C –2 digital sensors use it  ADC – 2 analog sensors use it  OS can concurrently sample 1 digital and 1 analog sensor  Radio only need a SPI bus when loadin a packet into transmit memory  In MSP 430 tree bus protocols I2C, SPI and UART share a common set of I/O pins

  9. Energy management  In many OSes energy efficiency comes at the cost of application code complexity. Many code lines with cases such as: “if forwarding a packet, defer powering down”  ICEM – allows a sensornet OS to automatically minimize energy consumption without requiring additional explicit information from an application.  500 lines of code → using ICEM it would by fewer then 50 lines

  10. Running example

  11. Hand-Tuned vs ICEM ICEM energy efficient >= 98,4% hand tuned implmentation

  12. ● Concurrency PRODUCER CONSUMER Every 5 minutes: Every 12 hours: Write prior samples For all new log entries: Sample photo active Send current sample Sample total solar Read next sample Sample temperature Sample humidity  Depending on the hardware OSes can do sampling operations concurrently.  Concurrency reduces how long the producer part of the application stays awake when sampling.  To achieve it producer's 5 operations should be non blocking or run one thread per operation.  Sensornets usually use saplit-phase non­blocking operations because of limited RAM

  13. Siplit-phase operations  Asynchronous I/O with one difference: Application application making split­phase receives explicit notifications (upcall) Read() readDone() about its completion. Driver  It allows a device driver to know exactly when an application has been I/O I/O request interrupt notified about the completion of an I/O event.  ICEM uses this knowledge to control device's power state.

  14. ICEM concurrency classes  Virtualized  Dedicated  Shared

  15. ● Virtualized  Support multiple users  Buffer requests  Give clients the appearance of independence  For higher level services that can tolerate latency.  For example: data­link packet sender is virtualized driver.  Buffers requests and services them with a round­ robin policy.  Driver can control power stated (power on when pending requests)

  16. Dedicated Dedicated  Support single user  For low­level hardware resources  Give single user complete control over requests and energy management  May provide explicit power control interface.

  17. Shared  Provide explicit concurrency  Users must contend for the driver through lock  Calling commands on shared drivers without holding lock is an error. Some clients are trusted (unchecked) and some are not trusted (checked)  Buffer lock request (Virtualized drivers buffer functional request e.g. send a packet)  Arbiter is an ICEM library component.

  18. Split-phase Power Locks

  19. Split-phase Power Locks  ICEM use shared drivers with power locks  Power locks couple energy, configuration and concurrency management.  Turn device off if lock falls idle.  Allow a client to specify a device configuration before an arbiter grants him the lock.  Lock must be split­phase (TinyOS does not have blocking calls)  Each lock in system has set of candidate holders (fixed at compile­time … TinyOS can create components only in compile­time)

  20. Split-phase Power Locks  Lock request are non­blocking (split­phase)  We can request several locks in parallel. Upcalls for lock could come in different order then requests. It could cause deadlock.  Client 1: lock1, lock2, ?(upcall1 and upcall 2) Client 2: lock1, lock2, ?(upcall1 and upcall 2) upcall 1 to client 1, upcall 2 to client 2 == deadlock

  21. ICEM Component Library  ICEM provides a library of components that allow to implement power locks in device drivers.  The library has three types of components:

  22. Power Lock Power Lock

  23. Power Lock components

  24. Arbiter  Power locks core component  Provide split­phase lock interface that arbitrates between outstanding requests  Determines its request queueing policy(RR or FCFS)  When no one use lock Arbiter grant it to Default owner (DO). When DO has lock and somebody want to get lock then arbiter sends callback to DO.  Before granting lock for user (and sending callback to him) Arbiter use corresponding configuration interface. 

  25. Power Managers  Implement the DefaultOwne interface and use explicit power interfaces.  Specifies a power lock's energy management policy.  2 power manager policies: immediate and deferred  3 interfaces to control energy  Device on ↔ Power Managers has not lock. Client Interfaces to control energy: request lock Start() ● StdControl (single-phase control) relese lock ● SplitControl (split-phase control) startDone()

  26. Configurators  Implementing Configuration interface that arbiter use  Allow clients to run some preambles before granting locks.  One implementation can serve the same code preamble for many clients.  Configurators are device specific  Mega128 ADC, MSP430 ADC, SPI, USART, I2C

  27. Power Lock components

  28. ADC driver example 1. Instantiate ADC  RR arbiter client and his Config. 2. request ADC 3. Request lock sample 11. relese lock 8. Lock granted 10. sample 9 . Request done sample 4. Request 7. Configure ADC lock 6. relese lock 5. Turn on

  29. USART example

  30. Energy consumption Serial+ - Optimal I/O ordering  Serial- - the worst case I/O ordering 

  31. Lifetime

  32. Lifetime

  33. Livetime

  34. ICEM waste energy  Stays in active mode due to power lock  Timeouts (hand­tuned imp. knows to turn off immediately when device is no more needed)  Additional 1800 cycles per sample due to arbiter

  35. Sleep Energy Management  The second part of an efficient energy management strategy is to control the sleep state of node's microcontroller.  Microcontrollers have spectrum of low power modes.  Power mode has to be enough high to run all actually used peripherals.  Computing the lowest power state of microcontroller requires system width­ information and can be complex and costly.

  36. ICEM Sleep Energy Management  Every controller have function calculating the lowest safe power state (based on enabled devices)  OS compute this function only when dirty bit is on  Drivers set dirty bit when they touch hardware.  Drivers can specify a minimum safe sleep state ­ hook

  37. Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend