justin. outline introduction the challenge of preemption tosthreads architecture implementation ...

16
TOSTHREAD: THREAD-SAFE AND NON-INVASIVE PREEMPTION IN TINYOS Justin

Upload: imogene-joseph

Post on 14-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

TOSTHREAD: THREAD-SAFE AND NON-INVASIVE PREEMPTION IN TINYOS

Justin

Page 2: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Outline Introduction The Challenge of Preemption

TOSThreads Architecture Implementation Evaluation

Page 3: Justin. 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

DisadvantageDevelop higher-level services and application

○ Compression

Page 4: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

The Challenge of Preemption Challenge:

Ability to call kernel code (code interact with hardware)

Common techniquesCooperative threading – using yieldKernel locking – using mutexMessage passing

Page 5: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

TOSThreads Architecture TinyOS – two classes of execution

Synchronous (tasks)Asynchronous (interrupts)

TOSThreads – third classUser-level application threads

Goals Minimun TinyOS kernel modification

Page 6: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

TOSThreads Architecture

Original TinyOS

Page 7: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Implementation Platform independent

Thread schedulerThread and system call structureDynamic linking and loading

Platform dependentContext switch (assembly language)Post-amble for interrupt handler

Page 8: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Flexible User/Kernel Boundary Blocking system call API Dynamic Linker and Loader

System CallTask

Application-level thread 1,2,3…

Send RecvSense File

Kernel-level thread

TinyOS Original code

Page 9: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Kernel-level thread

TinyOS Original code

App-level thread 1

App-level thread 2

App-level thread 3

Thread Scheduler

TinyOS Modification Boot sequence

HardwareInitialize

TaskScheduler

Page 10: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Microbenchmark

Overhead can be tolerated

Page 11: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Energy analysis SSF application (Sense, Store and Forward)

Sense and write to flash per 5 minsSend via radio per 12hours

Page 12: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Tenet A linear dataflow programs consisting of a

sequence of tasklets.

Repeat(1000ms) > Sample(ADC1,T) > LEQ(A,T,50) > DeleteDataIf(A) > Send()

Page 13: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Tenet Tenet – C

Implement in TOSThread and TinyLD

Page 14: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Tenet Tenet – C

Implement in TOSThread and TinyLD

Repeat(100ms) > ReadBlock(A,1024) > Avg(B,A) > MeanDev(C,A) > Send()

Repeat(50ms) > TimeStamp(A) > Sample(ADC5,V) > Send()

TaskLong

TaskSample

Page 15: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Evaluation - Tenet

Page 16: Justin. Outline  Introduction  The Challenge of Preemption  TOSThreads Architecture  Implementation  Evaluation

Conclusion TOSThread

Thread-safeNon-invasive

Overhead is less Dynamic linking and loading is less – 0.92%