Beruflich Dokumente
Kultur Dokumente
Adam Dunkels, Bjrn Grnvall, Thiemo Voigt Swedish Institute of Computer Science
IEEE EmNetS-I, 16 November 2004
Sensor OS trade-offs:
static vs dynamic
event-driven vs multi-threaded
Contributions
Events vs threads
Trade-offs: preemption, size
Mote-class device
10-100 kilobytes of code ROM 1-10 kilobytes of RAM Communication (radio)
Code MSP430
Code AVR
RAM
810 658
1044 -
10 + e + p 8
Multi-threading library
Timer library Memory manager
582
60 170
678
90 226
8+s
0 0
1656 4146
1934 5218
200 18 + b
Entire system is a monolithic binary Compile-time optimizations, analysis possible Makes code smaller
Core
Loadable programs
Core
Works well
Program typically much smaller than entire system image (1-10%)
Concurrency in Contiki
Concurrency is tricky!
Compact, low context switching overhead, fits well for reactive systems
Not suitable for e.g. long running computations
Multi-threading
Suitable for long running computations
Requires more resources
Event-driven
Event-driven (TinyOS)
Handler
Handler
Multi-threaded
Thread
Thread
Thread
Kernel unblocks threads when event occurs Thread runs until next Kernel blocking statement
Each thread requires its own stack
Event-driven vs multi-threaded
Event-driven
- No wait() statements - No preemption - State machines + Compact code + Locking less of a problem + Memory efficient
Multi-threaded
+ wait() statements + Preemption possible + Sequential code flow - Larger code overhead
- Locking problematic
- Larger memory requirements
Preemption possible
Responsive system with running computations
Responsiveness
Computation in a thread
Event
Event handler
yield()
Conclusions
Conclusions
event-driven vs multi-threaded
Thank you!
Adam Dunkels <adam@sics.se> http://www.sics.se/~adam/contiki/
Backup slides
Memory management
Contiki
Event-driven system
TinyOS