160 likes | 501 Views
Justin. TOSThread : Thread-safe and non-invasive preemption in tinyos. Outline. Introduction The Challenge of Preemption TOSThreads Architecture Implementation Evaluation. Introduction. Operating System for WSNs Support multiple concurrent execution
E N D
Justin TOSThread: Thread-safe and non-invasive preemption in tinyos
Outline • Introduction • The Challenge of Preemption • TOSThreads Architecture • Implementation • Evaluation
Introduction • Operating System for WSNs • Support multiple concurrent execution • Network protocol, storage and data filter…etc • Event-driven execution • TinyOS • Disadvantage • Develop higher-level services and application • Compression
The Challenge of Preemption • Challenge: • Ability to call kernel code (code interact with hardware) • Common techniques • Cooperative threading – using yield • Kernel locking – using mutex • Message passing
TOSThreads Architecture • TinyOS – two classes of execution • Synchronous (tasks) • Asynchronous (interrupts) • TOSThreads – third class • User-level application threads • Goals • MinimunTinyOS kernel modification
TOSThreads Architecture Original TinyOS
Implementation • Platform independent • Thread scheduler • Thread and system call structure • Dynamic linking and loading • Platform dependent • Context switch (assembly language) • Post-amble for interrupt handler
Flexible User/Kernel Boundary • Blocking system call API • Dynamic Linker and Loader System Call Task Kernel-level thread Application-level thread 1,2,3… TinyOS Original code Send Recv Sense File
TinyOS Modification • Boot sequence Hardware Initialize Task Scheduler Thread Scheduler Kernel-level thread App-level thread 1 TinyOS Original code App-level thread 2 App-level thread 3
Evaluation - Microbenchmark Overhead can be tolerated
Evaluation - Energy analysis • SSF application (Sense, Store and Forward) • Sense and write to flash per 5 mins • Send via radio per 12hours
Evaluation - Tenet • A linear dataflow programs consisting of a sequence of tasklets. Repeat(1000ms) > Sample(ADC1,T) > LEQ(A,T,50) > DeleteDataIf(A) > Send()
Evaluation - Tenet • Tenet – C • Implement in TOSThread and TinyLD
Evaluation - Tenet • Tenet – C • Implement in TOSThread and TinyLD TaskLong Repeat(100ms) > ReadBlock(A,1024) > Avg(B,A) > MeanDev(C,A) > Send() TaskSample Repeat(50ms) > TimeStamp(A) > Sample(ADC5,V) > Send()
Conclusion • TOSThread • Thread-safe • Non-invasive • Overhead is less • Dynamic linking and loading is less – 0.92%