![Page 1: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/1.jpg)
Maté: A Tiny Virtual Machine for Sensor
NetworksPhilip Levis and David Culler
Presented by: Michele Romano
![Page 2: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/2.jpg)
Outline
• Sensor Networks• Virtual Machines• Maté Details• Evaluation• Conclusion
![Page 3: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/3.jpg)
Sensor Networks
• Composed of 1000’s of tiny devices (Motes) with limited resources
![Page 4: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/4.jpg)
Berkeley Mote Specifications
![Page 5: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/5.jpg)
TinyOS
• OS designed for sensor networks• Split-phase non-blocking execution• Not suited well to non-expert
programmers
![Page 6: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/6.jpg)
Reprogramming Motes
Reprogramming is desirable as:• Environmental conditions change• Analysis techniques evolve
Examples: • Great Duck Island• Building instrumentation
![Page 7: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/7.jpg)
Reprogramming Motes
To change the behaviour of a TinyOS program, either:
1. Hardcode a state transitionOR2. Modify source code, recompile a
TinyOS image and place image on mote
![Page 8: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/8.jpg)
Sensor Networks Challenges• Energy
– Recharging is difficult or impossible– Deterministic network lifetime desirable
• Communication– Lossy wireless networks– Bandwidth conservation
• Programming– Motes unreachable in deployed networks– Difficult for a non-programmer to program
TinyOS
![Page 9: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/9.jpg)
System Requirements
• Small• Expressive• Concise• Resilient• Efficient• Tailorable• Simple
![Page 10: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/10.jpg)
Virtual Machine
• Easier programming• Short VM programs• A VM can provide a safe program
execution environment
![Page 11: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/11.jpg)
Maté VM Overview
• Bytecode interpreter that runs on TinyOS
• Single TinyOS component that sits on top of several system components
• Code fits in capsules of 24 instructions• Built-in ad-hoc routing algorithm AND
mechanisms for writing new ones
![Page 12: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/12.jpg)
Code Capsules
• There are four types of capsules– Message send capsules– Message receive capsules– Timer capsules– Subroutine capsules
![Page 13: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/13.jpg)
Maté Architecture
![Page 14: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/14.jpg)
Instruction Set
There are three classes of Maté instructions:
8 instructions reserved for users to define
basic 00iiiiii i = instruction
s-class 01iiixxx i = instruction, x=argument
x-class 1ixxxxxx i = instruction, x=argument
![Page 15: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/15.jpg)
Code Execution
• Execution of code begins in response to an event
• These three contexts can run concurrently
• Each instruction is executed as a TinyOS task
![Page 16: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/16.jpg)
Code Security
• Bound checks prevent overrun and underrun
• Heap addressing is not a problem because there is only a single shared variable
• Unrecognized instructions result in no-ops
![Page 17: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/17.jpg)
Code Infection
Reprogramming is easy:• Each capsule contains a type and
version number• When a capsule with a more recent
version is received, it is installed• forw or forwo is used to broadcast
the capsule for network neighbours to install
![Page 18: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/18.jpg)
Maté Evaluation
Ad-hoc routing algorithm was implemented to measure:
1. Rate of instruction2. CPU overhead3. Network infection rates
![Page 19: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/19.jpg)
1. Rate of InstructionTest
Maté Bytecode vs. Native Code
Operation Maté Clock Cycles
Native Clock Cycles
Cost
Simple: and 469 14 33.5:1
Downcall: rand 435 45 9.5:1
Quick Split: sense
1342 396 3.4:1
Long Split: sendr
685+~20000 ~20000 1.03:1
![Page 20: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/20.jpg)
2. CPU Overhead
• Given the energy cost of an execution and the energy cost of installation:– Mate is preferable for a small number
of executions– For large number of executions,
Native code is preferable
![Page 21: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/21.jpg)
3. Network Infection
Percentage of Motes Running New Program Over Time
![Page 22: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/22.jpg)
Case Study
Great Duck Island Application• Spends most of its time in deep
sleep mode – draws 50 μA• Reads several sensors and sends a
packet• Maté proves to save energy if only
run for 5 days or less
![Page 23: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/23.jpg)
Conclusion
• Maté met all of the defined requirements
• Maté can conserve energy in domains of frequent reprogramming
• VM can provide user-land guarantees
![Page 24: Maté: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Michele Romano](https://reader031.vdocument.in/reader031/viewer/2022032522/56649d6b5503460f94a4a275/html5/thumbnails/24.jpg)
References
• http://www.cs.berkeley.edu/~pal/research/mate.html
• http://www.cs.berkeley.edu/~pal/pubs/brown-7-02.pdf
• http://www.cs.virginia.edu/~qc9b/fall03cs851/mate_damon_jo.ppt