Programming Networks of Vehicles
Total Page:16
File Type:pdf, Size:1020Kb
UCAM-CL-TR-761 Technical Report ISSN 1476-2986 Number 761 Computer Laboratory Programming networks of vehicles Jonathan J. Davies November 2009 15 JJ Thomson Avenue Cambridge CB3 0FD United Kingdom phone +44 1223 763500 http://www.cl.cam.ac.uk/ c 2009 Jonathan J. Davies This technical report is based on a dissertation submitted September 2008 by the author for the degree of Doctor of Philosophy to the University of Cambridge, Churchill College. Technical reports published by the University of Cambridge Computer Laboratory are freely available via the Internet: http://www.cl.cam.ac.uk/techreports/ ISSN 1476-2986 Programming networks of vehicles Jonathan J. Davies Abstract. As computers become smaller in size and advances in communications tech- nology are made, we hypothesise that a new range of applications involving computing in road vehicles will emerge. These applications may be enabled by the future arrival of general-purpose computing platforms in vehicles. Many of these applications will involve the collection, processing and distribution of data sampled by sensors on large numbers of vehicles. This dissertation is primarily concerned with addressing how these applications can be designed and implemented by programmers. We explore how a vehicular sensor platform may be built and how data from a variety of sensors can be sampled and stored. Applications exploiting such platforms will in- fer higher-level information from the raw sensor data collected. We present the design and implementation of one such application which involves processing vehicles’ location histories into an up-to-date road map. Our experience shows that there is a problem with programming this kind of applica- tion: the number of vehicles and the nature of computational infrastructure available are not known until the application is executed. By comparison, existing approaches to programming applications in wireless sensor networks tend to assume that the nature of the network architecture is known at design-time. This is not an appropriate assumption to make in vehicular sensor networks. Instead, this dissertation proposes that the func- tionality of applications is designed and implemented at a higher level and the problem of deciding how and where its components are to be executed is left to a compiler. We call this ‘late physical binding’. This approach brings the benefit that applications can be automatically adapted and optimised for execution in a wide range of environments. We describe a suite of transfor- mations which can change the order in which components of the program are executed whilst preserving its semantic integrity. These transformations may affect several of the application’s characteristics such as its execution time or energy consumption. The practical utility of this approach is demonstrated through a novel programming lan- guage based on Java. Two examples of diverse applications are presented which demon- strate that the language and compiler can be used to create non-trivial applications. Performance measurements show that the compiler can introduce parallelism to make more efficient use of resources and reduce an application’s execution time. One of the applications belongs to a class of distributed systems beyond merely processing vehicular sensor data, suggesting that the late physical binding paradigm has broader application to other areas of distributed computing. 3 4 Contents Preface 11 Publications 13 1 Introduction 15 1.1 In-vehicle computing .............................. 15 1.2 Applications ................................... 16 1.3 Challenges .................................... 18 1.4 Dissertation outline ............................... 18 2 Background 21 2.1 Computing in vehicles ............................. 21 2.1.1 Data processing in vehicles ....................... 22 2.1.2 Sensors .................................. 23 2.1.3 Communications ............................ 23 2.1.4 Vehicular networks ........................... 24 2.2 Distributed computing ............................. 30 2.2.1 The von Neumann architecture .................... 30 2.2.2 Loosely-coupled systems ........................ 31 2.2.3 Task assignment ............................ 43 2.3 Programming sensor networks ......................... 46 5 Contents 2.3.1 Distributed database .......................... 48 2.3.2 Active sensor networking ........................ 50 2.3.3 Other approaches ............................ 55 2.4 Summary .................................... 55 3 A vehicular sensor platform 57 3.1 Managing sensor data .............................. 57 3.2 A sensor platform ................................ 58 3.2.1 Requirements .............................. 58 3.2.2 Vehicle .................................. 59 3.2.3 Sensor infrastructure .......................... 59 3.2.4 External communications ........................ 64 3.2.5 Power .................................. 64 3.2.6 User interaction ............................. 66 3.2.7 Data collected .............................. 68 3.3 Further work .................................. 68 3.4 Summary .................................... 71 4 Scalable, distributed, real-time map generation 73 4.1 Inferring a road map from location data ................... 74 4.1.1 Producing road maps .......................... 74 4.1.2 Automatically generating a directed graph .............. 74 4.1.3 Complexity ............................... 81 4.1.4 Evaluation ................................ 81 4.2 Maintaining a model of the road network ................... 86 4.2.1 Map regeneration ............................ 86 4.2.2 Retaining associated metadata ..................... 87 4.2.3 Cost of execution ............................ 89 4.3 Involving multiple vehicles ........................... 89 4.3.1 Scalability ................................ 89 4.3.2 System architecture ........................... 91 4.4 Further work .................................. 92 4.5 Summary .................................... 92 6 Contents 5 Automatic task assignment 95 5.1 The problem of early physical binding ..................... 95 5.2 Automatic task assignment ........................... 96 5.2.1 Task graph ............................... 97 5.2.2 Resource graph ............................. 98 5.2.3 Assignment function .......................... 98 5.2.4 Cost function .............................. 98 5.3 Application design process ...........................100 5.4 Applicability ...................................100 5.4.1 Vehicular networks ...........................101 5.5 Task graph optimisation ............................102 5.5.1 Types of task ..............................102 5.5.2 Denotational semantics .........................104 5.5.3 Generalising to n-ary tasks, n> 2 ...................105 5.5.4 Fault tolerance .............................106 5.5.5 Examples: aggregation operators ...................106 5.5.6 Datatypes ................................108 5.5.7 Task graph transformations ......................110 5.5.8 Redundancy ...............................128 5.5.9 Optimising transformations for n-ary tasks ..............128 5.5.10 Example of using transformations: computing π ...........130 5.6 Expressiveness of task graphs .........................133 5.6.1 Pair and unpair tasks ..........................134 5.6.2 Task graph edges ............................141 5.7 Related work ..................................142 5.7.1 Task graph transformations ......................142 5.7.2 MapReduce ...............................143 5.7.3 SpatialViews ..............................146 5.8 Further work ..................................147 5.9 Summary ....................................148 7 Contents 6 Language and Compiler 149 6.1 Language ....................................149 6.1.1 Datatype definitions ..........................150 6.1.2 Task graph definition ..........................153 6.1.3 Resource graph definition .......................155 6.1.4 Initial mapping definition .......................155 6.1.5 Cost function definition ........................156 6.2 Compiler .....................................157 6.2.1 Task graph optimisation and assignment ...............158 6.2.2 Compiler implementation .......................160 6.2.3 Front end ................................160 6.3 Further work ..................................161 6.4 Summary ....................................162 7 Examples 163 7.1 Ray tracing ...................................163 7.1.1 Datatypes ................................164 7.1.2 Initial task graph ............................168 7.1.3 Execution ................................169 7.2 Automatic road map generation ........................171 7.2.1 Design ..................................172 7.2.2 Implementation .............................174 7.2.3 Evaluation ................................177 7.3 Summary ....................................186 8 Conclusion 187 8.1 Further work ..................................190 A Vehicle-oriented communications technologies 193 B Sensor networks 195 B.1 Sensor-equipped devices ............................195 B.2 Examples of sensor network applications ...................197 B.3 Characteristics of sensor networks .......................198 B.4 Node discovery .................................199 8 Contents B.5 Routing .....................................199 B.5.1 Data-centric routing protocols .....................200 B.5.2 Hierarchical routing protocols .....................202 B.5.3 Location-based routing protocols ...................202