U. C. Berkeley Dissertation
Total Page:16
File Type:pdf, Size:1020Kb
Application Specific Virtual Machines: Operating System Support for User-Level Sensornet Programming by Philip Alexander Levis B.S. (Brown University) 1999 A dissertation submitted in partial satisfaction of the requirements for the degree of Doctor of Philosophy in Computer Science in the GRADUATE DIVISION of the UNIVERSITY OF CALIFORNIA, BERKELEY Committee in charge: Professor David Culler, Chair Professor Eric Brewer Professor Scott Shenker Professor Paul Wright Fall 2005 The dissertation of Philip Alexander Levis is approved. Chair Date Date Date Date University of California, Berkeley Fall 2005 Application Specific Virtual Machines: Operating System Support for User-Level Sensornet Programming Copyright c 2005 by Philip Alexander Levis Abstract Application Specific Virtual Machines: Operating System Support for User-Level Sensornet Programming by Philip Alexander Levis Doctor of Philosophy in Computer Science University of California, Berkeley Professor David Culler, Chair We propose using application specific virtual machines (ASVMs) to reprogram deployed wireless sensor networks. ASVMs provide a way for a user to define an application-specific boundary between virtual code and the VM engine. This allows programs to be very concise (tens to hundreds of bytes), making program installation fast and inexpensive. Additionally, concise programs interpret few instructions, imposing very little interpretation overhead. We evaluate ASVMs against current proposals for network programming runtimes and show that ASVMs are more energy efficient by as much as 20%. We also evaluate ASVMs against hand built TinyOS applications and show that while interpretation imposes a significant execution overhead, the low duty cycles of realistic applications make the actual cost effectively unmeasurable. Professor David Culler Dissertation Committee Chair 1 Contents Contents i List of Figures vii List of Tables xi Acknowledgements xii 1 Introduction 1 1.1 Sensor Networks . 2 1.2 Problem Statement . 5 1.3 Thesis . 6 1.4 Mate´ Overview . 7 1.5 Contributions . 9 1.6 Assumptions . 9 1.7 Summary and Outline . 10 2 Background 12 2.1 Application Domains . 12 2.1.1 Periodic Sampling . 13 2.1.2 Phenomenon Detection . 14 2.1.3 Fire Rescue . 16 2.1.4 Application Analysis . 17 2.2 Hardware Platforms . 18 2.2.1 An Example Platform: mica2 . 20 i 2.2.2 Microcontroller . 20 2.2.3 Radio . 22 2.2.4 An Example Platform: Telos revB . 23 2.2.5 Hardware Trends . 24 2.3 TinyOS . 25 2.3.1 Components and Interfaces . 26 2.3.2 Parameterized Interfaces . 29 2.3.3 Concurrency Model . 29 2.3.4 Networking . 31 2.3.5 TinyOS Analysis . 32 2.4 Architectural Requirements . 33 2.5 A Flexible Network Encoding . 34 3 Three Program Layers 36 3.1 The Three Layer Model . 36 3.1.1 One layer: TinyOS . 38 3.1.2 Two layers: SNACK and Regions . 38 3.1.3 Two layers: SOS . 39 3.1.4 Two layers: Sensorware and TinyDB . 40 3.1.5 Three layers: Java and CLR . 40 3.1.6 Analysis . 41 3.2 Decomposing the Three Layers . 42 3.2.1 User Language . 43 3.2.2 Network Encoding . 43 3.2.3 Node Runtime . 44 3.3 A Performance Model . 45 3.3.1 Propagation Energy . 45 3.3.2 Execution Energy . 46 3.3.3 Energy Analysis . 47 3.4 Defining the Network Encoding and Runtime . 48 3.4.1 The Network Encoding . 48 3.4.2 The Underlying Runtime . 49 ii 3.4.3 Runtime Transformation . 50 3.4.4 Runtime Execution . 50 3.4.5 Runtime Propagation . 50 3.4.6 Performance Model . 51 3.5 Mate´ Bytecodes As a Network Encoding . 51 3.6 Related Work . 52 4 The Mate´ Architecture 55 4.1 Application Specific Virtual Machine Architecture . 57 4.2 ASVM Template . 57 4.2.1 Execution Model . 57 4.2.2 Data Model . 58 4.2.3 Scheduler . 59 4.2.4 Concurrency Manager . 61 4.2.5 Capsule Store . 62 4.2.6 Error Handling . 62 4.3 ASVM Extensions . 62 4.3.1 Operations . 63 4.3.2 Handlers . 64 4.4 Concurrency Management . 64 4.4.1 Implicit Synchronization . 64 4.4.2 Synchronization Model . 65 4.4.3 Synchronization Algorithm . 66 4.4.4 Deadlock-free . 67 4.4.5 Implementation . 68 4.5 Program Encoding . 69 4.5.1 Bytecodes . 70 4.5.2 Compilation and Assembly . 72 4.6 Building an ASVM . 72 4.6.1 Languages . 74 4.6.2 Libraries . 74 4.6.3 Toolchain . 77 iii 4.6.4 Example Scripts: Bombilla . 77 4.7 Evaluation . 80 4.7.1 Efficiency . 80 4.7.2 Conciseness . 83 4.7.3 Whole System Evaluation . 87 4.7.4 Cost/Benefit Tradeoff . 93 4.7.5 Analysis . 94 4.8 Related Work . 95 5 Code Propagation 98 5.1 Trickle Algorithm ..