ubiquitous resources abstraction using a file system interface on sensor nodes

21
Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes Till Riedel, Christian Decker TecO, University of Karlsruhe Institut for Telematics Telecooperation Office (TecO) www.teco.edu

Upload: till-riedel

Post on 19-Jun-2015

543 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

Ubiquitous Resources Abstraction using a File System Interface

on Sensor Nodes

Till Riedel, Christian DeckerTecO, University of KarlsruheInstitut for TelematicsTelecooperation Office (TecO)www.teco.edu

Page 2: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 2

Outline

AnalysisDesign of a Resource AbstractionEvaluationApplications

Page 3: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 3

Embedded Sensor Devices in Ubicomp

Limited computing power, 8-bit microcontroller Few kilobytes … 512 kilobytes of Flash memory Customized radio protocols Battery powered Extensible by various sensors

Motes Particles Telos

Page 4: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 4

Analysis

Big variety of sensors

Growing APIs

Experiences with developers Hesitate to develop code for „new“ sensors Stick to the stuff they know Use example program

Page 5: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 5

Ubicomp Development – State-of-the-Art

Lightweight OS (e.g. TinyOS) OS shields resources, e.g. sensors No direct access Communication through events -> event dispatching

Library based access models Abstract access functions Direct access, virtually no overhead

But… shielding/abstraction causes still confusion

Page 6: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 6

File System for Sensor Nodes

Design principles Developer in the center Support developer to

follow the simplest way Easy-to-understand

interfaces -> generic

Support in two ways Uniform representation of

all resources Uniform access model

Direct Resources Mediated Resources

Application

HardwareS

enso

rs

Mem

ory

Co

mm

-un

icat

ion

Aud

ioV

olum

e

Bat

tery

Sta

tus

Sho

ckD

etec

tion

NameSpace

File SystemOperations

TypeSystem

...

Act

uato

rs

Mem

ory

Mic

roph

one

LED

s

Rad

ioF

ront

end

File System

Page 7: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 7

File System Interface

Operation Explanation

size_t read (int fd, void* buf, size_t n)

Reads n data bytes from the resource identified by fd to buf; returns number of bytes or -1 if error occurred

size_t write (int fd, void* buf, size_t n)

writes n data bytes from buf to the resource fd; returns number of bytes or -1 if an error occurred

int open(char* resource_path) Returns a descriptor for the resource; -1 if it is not valid.

int close(int fd) Frees the descriptor of a resource; -1 if fd is not valid

int getType(int fd) Returns the type of a resource fd; -1 if fd is not valid.

int mount (char* resource_path, int type, (*pFunc) read, (*pFunc) write)

Creates a resource in the name space. Type and function pointers to their specific read and write operations are given. -1 is returned if the resource_path already exists.

int umount(char* resource_path) Removes a resource; -1 is returned if it is not valid.

Page 8: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 8

Namespace and Ressources

Storage Table

0

1

...

n-1

n

name

audio

audiovolume

...

light

[free]

Mount Table

0

1

2

3

4

5

6

7

8

9

/dev

/light

/audio

/usr

/file1

/subdir

/file2

/audiolib

/audiovolume

[free]

Name Space Table

read*

readMic

calcVol

...

readLight

write*

setRate

setRange

...

nop

type

6

.

3

0

1

...

2047

2048

name

file1

file2.frag

[free]

file2

readFile

writeFile

1

type read* write*

Page 9: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 9

File System – Access Model

Name space Hierarchical Textual representation of

resources Combine freely resource

and specific behavior

Streams Access functions “read”, “write” Sequential access

enforced by state Pass data between streams

-> Stacking of streams

writeread state type rfcom

write(fd,...)

fd=open(”/com/rf”)

file descriptor

writeread state type

rf_read rf_write 2130

rf driver

Page 10: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 10

Hardware

TecO Particle Computer 18f6720 PIC microcontroller 128KB FlashROM, 4KB RAM,

512KB external Flash

Resources Memory – 512KB Flash Power supply – AAA battery Wireless communication Sensors – acceleration, light, force, temperature, audio,

ball switch Actuators – LEDs, speaker

Page 11: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 11

Optimization

Paralallize write operations (Flash Buffer, Flash, EEPROM)

13 ms Flash, 4 ms EEPROM, assynchronously programmable

Mimimize writes on Flash/EEPROMonly 50.000-100.000 erase/write cycles per page

Minimize read times for sensor devicessupport relatively high sampling rates / bytewise sampling

Minimize RAM consumption only 4K of RAM available

Page 12: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 12

Performance

Access overhead

cycles PIC18F6720

Table look up functionDereferencing statePassing ParametersFunction pointer callAccessing ParametersWriting the bufferReturning

15 cycles4 cycles

10 cycles26 cycles10 cycles15 cycles13 cycles

3 µs0.8 µs

2 µs5.2 µs

2 µs3 µs

2.6 µs

Overhead of file system readOverhead of simple Library call

93 cycles26 cycles

18.6 µs5.2 µs

Relative overhead 67 cycles 13.2 µs

Page 13: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 13

Performance

Memory Consumption

File library 2 byte on flash per resource (129 per page) 12 byte per file descriptor (3 byte state)

Non-Persistent ressources▫6 byte + name in RAM

+ Library Code in internal flash ▫about 12 KB (10%)▫6K without persistent storage

Page 14: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 14

Integration of persistent storage

Simple flash FS Sequential append-only files Non-blocking operation Uncontrolled extrusion

Page 15: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 15

Application - Integration

FTP Proxy Seamless transfer of data

between backend infrastructure and sensor nodes

Composition of name spaces using URI scheme

Programming is file copy Sensor logging is downloading

Bridge

Particle

FTP Proxy

Network

PC

ste;1;33^C

CompiledProgram

Page 16: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 16

POSIX interface

Applications can be easily ported

libc standard I/O fprintf stdout

compliant C Programming Environment

Page 17: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 17

Application - Shell

File system as interactive runtime environment

“cat audiovolume“

ParticleFS

Microphone

Mediated Resources

cat

audioVolume

Direct Resources

Command Shell

audio

Application

Reources

Hardware

Page 18: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 18

Application - Shell

File system as interactive runtime environment Standard output as context Popping stack elements from pipe stack

Page 19: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 19

Asynchronous Interaction

Service

Client

/service/result

Simple IPC mechanism

Page 20: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 20

Dynamic Loadable Modules

No linking of function calls needded

Specify fixed location for file descriptor table open mount

Functionality instantly available after mount

Hot code replacement

Page 21: Ubiquitous Resources Abstraction using a File System Interface on Sensor Nodes

TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 21

Thank you.