ubiquitous resources abstraction using a file system interface on sensor nodes
TRANSCRIPT
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
TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 2
Outline
AnalysisDesign of a Resource AbstractionEvaluationApplications
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
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
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
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
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.
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*
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
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
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
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
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
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
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
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
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
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
TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 19
Asynchronous Interaction
Service
Client
/service/result
Simple IPC mechanism
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
TecO KuVs FG System Software für Pervasive Computing 2005, October 12, 2005 21
Thank you.