Programming Computers Embedded in the Physical World
←
→
Page content transcription
If your browser does not render page correctly, please read the page content below
Please do not remove this page Programming Computers Embedded in the Physical World Iftode, Liviu; Borcea, Cristian; Kochut, Andrzej; et.al. https://scholarship.libraries.rutgers.edu/discovery/delivery/01RUT_INST:ResearchRepository/12643388890004646?l#13643536300004646 Iftode, Borcea, C., Kochut, A., Intanagonwiwat, C., & Kremer, U. (2003). Programming Computers Embedded in the Physical World. Rutgers University. https://doi.org/10.7282/T3SN0DMT This work is protected by copyright. You are free to use this resource, with proper attribution, for research and educational purposes. Other uses, such as reproduction or publication, may require the permission of the copyright holder. Downloaded On 2021/11/17 01:38:26 -0500
∗ Programming Computers Embedded in the Physical World Liviu Iftode Cristian Borcea Andrzej Kochut Chalermek Intanagonwiwat Ulrich Kremer Department of Computer Science Division of Computer and Information Sciences University of Maryland, College Park Rutgers University College Park, MD 20740 Piscataway, NJ 08854 {iftode, kochut}@cs.umd.edu {borcea, intanago, uli}@cs.rutgers.edu Abstract processing power that allows them to perform local computations, (2) are able to communicate with other Future ubiquitous computing environments will con- devices using short-range radio, (3) are spatially dis- sist of massive, ad hoc networks of embedded systems tributed and mobile, and (4) work unattended and may deployed in the physical space. Programming such fail frequently. environments requires new abstractions and comput- NES will consist of a huge number of small-size de- ing models. This paper presents Spatial Programming vices deployed in the physical space. These nodes may (SP), a novel paradigm for programming ubiquitous join or leave at any moment (becoming unreachable computing environments. SP offers access to data and due to mobility, energy depletion, failures, or disposal) services distributed on nodes spread across the physical leading to dynamic and volatile network topologies. space in a similar fashion to access to memory using Therefore scale and volatility will be the main issues references. SP programs access network resources using in NES. In many scenarios, it will not be feasible to a high level abstraction, termed spatial reference, which deploy more powerful nodes that act as base stations, names these resources using their spatial properties and thus NES will have to function in a complete decen- content-based names. An underlying system takes care tralized manner. of mapping spatial references onto target nodes in the All these characteristics make NES programmability network. Thus, SP hides the complexity of the under- a challenging task. Traditional distributed program- lying network from the programmer, while offering a ming models, such as message passing are not suitable simple and intuitive programming model. for NES. Aspects of mobility, volatility and scale make it difficult to program applications as a series of inter- actions with devices identified by fixed addresses (as 1. Introduction it is assumed in the message passing model). Instead, we want to gather information or perform actions on Recent advances in technology made it feasible to devices that have certain properties, content, or loca- create networks of embedded systems (NES). Such net- tion. Thus, we are no longer interested in contacting a works will represent the infrastructure for future ubiq- particular device, but any device that may be useful to uitous computing environments [24, 20]. For instance, perform the task. Simpler programming abstractions sensors monitoring the environment [12, 10, 11], robots and more flexible programming models are needed to with intelligent cameras collaborating to track a given let the programmers design and write their applications object [1], or cars on a highway cooperating to adapt without concerning about the underlying network de- to traffic conditions [2] will become a daily reality. Al- tails. though extremely heterogeneous, nodes in NES will In this paper, we propose Spatial Programming have a common set of characteristics: (1) incorporate (SP), a novel paradigm for programming ubiquitous ∗ This work is supported in part by the NSF under the ITR computing environments that emphasizes the notions Grant Number ANI-0121416 of space and content. In SP, space is a first order pro-
gramming concept that needs to be exposed to applica- camera camera tions. Also, SP shields the complexity of programming volatile, ad hoc networks by presenting a high level uni- form abstraction, termed spatial reference, for naming camera camera and accessing network resources. A spatial reference names network resources using their geographical lo- camera camera cation and content, while an underlying system takes camera care of mapping it onto a target node in the network. The mappings between spatial references and nodes in campus the physical world are similar to the mappings from town virtual memory to physical memory in a conventional computer system. Figure 1. Motivating Example Although both geographical routing [14, 17, 18] and content-based naming and routing [4, 9, 13] have been extensively studied, a simple and intuitive program- tification for the desired object. During this process, ming model that allows the user to express the compu- the application uses partial results computed at other tation in terms of these abstractions is still missing. In nodes and it needs to be able to reach nodes already our model, programmers write simple sequential pro- visited in order to execute various computations there. grams and access transparently the network resources The task stated above is difficult and tedious to pro- (i.e., using spatial references) in a similar fashion to the gram using traditional programming models. The pro- access to memory using variables. SP is independent grammer would have to explicitly manage the commu- of the underlying system, thus allowing for multiple nication between devices and to program all the details implementations. Each implementation has to provide involved in reaching the area of interest and contacting an SP compiler that is responsible for translating the the target nodes located there. Additionally, the net- high-level sequential program into a series of actions work dynamics (caused by node failures or new cameras that will be performed by the underlying system. being deployed) may cause the application to fail since The rest of this papers is organized as follows. Sec- fixed addressing schemes treat exceptions as failures. tion 2 presents an example that motivates Spatial Pro- Expressing the same task in our model is straight- gramming. Section 3 describes the design principles of forward. SP paradigm defines a simple abstraction, SP. Section 4 shows the basic programming constructs called spatial reference, that presents a unified view for SP and illustrates them with an example. Section 5 of space and network to applications. A spatial ref- discusses the related work. The current status and fu- erence is a reference to a node in SP, represented as ture plans are presented in Section 6. a tuple {space:tag}. The tag represents a content- based name for the node. The space is a geographical 2. Motivating Example scope for this content-based name of the node. The source code for the program that realizes the As an example that motivates Spatial Programming, desired task is presented in Figure 2. Cameras take we present the task of performing object tracking over a images continuously, but their processor can execute a large area using a set of spatially distributed intelligent single identification task at a time by focusing on one cameras (they are battery powered and use wireless for object. The application computes the object identifi- communication). In Figure 1, we have two spaces, cam- cation on N free cameras (i.e., they are not currently pus and town, a number of cameras presented as nodes focusing on any object) using spatial references and marked with camera, and a black square that repre- partial results accumulated during execution (lines 3- sents the object of interest. Each device is capable of 5). The expression {campus:camera} is a reference to determining its location (i.e., using GPS or other lo- a camera that is located in campus. The array sub- calization methods [16, 22, 7]) and remains static after script [i] is used to refer to different cameras with the deployment. However devices may fail, or be deployed same space-content description. Only the camera that far from other devices preventing them from partici- provides the best partial result is instructed to focus pating in the computation. The user requires that the on the desired object for a potentially complete identi- images should be taken from N different cameras that fication. Once a new camera provides a better result, are present in the area of interest (campus in this ex- it will become the active camera (i.e., the one that ample). The application has to dynamically determine focuses on the object) while the old one will become the location of the camera that provides the best iden- free (lines 6-10). The application may access the in-
1 object_tracking(object){ 2 partialIdentification = 0; max_id = 0; 3 for(i=0; i partialIdentification){ 7 {campus:camera[max_id]}.focus = NONE; 8 {campus:camera[i]}.focus = object; 9 partialIdentification = result; 10 max_id = i; 11 } 12 } 13 if (completeIdentification({campus:camera[max_id]})) 14 return {campus:camera[max_id]}.location; 15 } Figure 2. SP Code Example formation and services on the target nodes using the tion programmer however, should not have to perform dot notation (e.g., {campus:camera[i]}.focus). Detailed any specific network-related operations to obtain the descriptions for all SP constructs used in this example requested resources. An underlying system has to take are presented in Section 4. The application finishes care of name resolution, access to resources, routing, by checking the images acquired by the camera that and communication. provided the best overall partial result. If a complete The application that refers to a node with given identification is found, the function returns the location spatial and content properties should be guaranteed of that camera (lines 13-14). to contact the same node each time it makes subse- quent successful references to the same space-content 3. Design Principles description. Therefore, the underlying system needs to maintain bindings between these references and the Networks of embedded systems (NES) are by defi- nodes addressed by them. These bindings are main- nition very large, volatile, and spread across the physi- tained in a per-application binding table, which plays a cal space. To achieve their objectives, the applications similar role as a page table in a traditional computer running over such networks need to execute within cer- system. Once a reference to a network resource is per- tain geographical regions. These applications are inter- formed, the corresponding spatial reference is bound to ested in content and properties, not in the nodes that a particular node in that space. The binding is persis- provide them. Also, they need to be able to adapt for tent for the duration of the SP program execution. We the uncertainty encountered in NES, where the topolo- call this feature reference consistency and it allows the gies and the resources available are unknown a priori. programmer to visit repeatedly nodes and locations as Spatial Programming (SP) is a novel programming long as the spatial reference is valid. paradigm that attempts to address these issues. SP Since NES are extremely volatile, SP should make is based on four main design principles: (1) exposing it easy for the programmer to deal with network con- space as a first order programming concept, (2) decou- figuration dynamics. This dynamics involves constant pling the access to network resources from networking change in the location of nodes as well as intermittent details, (3) maintaining reference consistency, and (4) network connectivity. For example, a reference made supporting programming for uncertainty. to a node may become invalid if this node has moved Applications should be able to access resources lo- away from the area of interest. Another possibility is cated on the nodes participating in NES by referring that a node failure leads to unavailability of requested to them in the same fashion a program addresses the resources. In such situations, the underlying system memory using variables. The reference should involve should allow the application to adapt to adverse net- spatial characteristics of the resource (i.e., the geo- work conditions. graphical region of the node containing the resource), For most types of applications it is important to and content characteristics of the resource (i.e., con- guarantee execution completion within a predefined tent that has to be present on the node). The applica- time period. In such a dynamic environment as NES,
where many operations depend on location-based and application may need to achieve its objectives within content-based routing, a lookup operation for a refer- a fixed time interval. Although we cannot offer real ence may take a substantial amount of time. To bound time guarantees in these highly dynamic networks, SP the execution time, each reference specifies a timeout makes it possible to specify a soft deadline for look- value after which the attempt to access it is aborted ing up a spatial reference (i.e., the maximum time that and the application is informed. Thus, the application may be spent for that operation). If the target node is will be able to decide about its further actions. not reached, the underlying system raises a timeout vi- olation exception and the application will decide about 4. Spatial Programming Constructs further actions. Resource Naming. In SP, applications can name and access any resource located on a node Spatial Programming requires a set of programming referenced by a spatial reference. In order constructs that can be added as extensions to any pro- to access these resources, the dot notation is gramming language. The main SP construct provides used. The construct {space:tag}.resource instructs transparent access to network resources as well as an the system to access the resource located on the exception mechanism that allows applications to adapt node referenced by {space:tag}. In the example to network configuration dynamics. The other con- from Figure 1, {campus:camera[i]}.focus represents structs offer the possibility to create/remove network the object observed by this camera. Similarly, resources during execution, to define relative spaces dy- {campus:camera[i]}.location may represent the loca- namically, and to change the space for a given spatial tion of this node in space. reference. 4.1. Accessing Network Resources 4.2. Creating/Removing Network Resources In SP, network resources can be accessed using a Besides accessing resources that already exist at quintuple {space:tag[instance], timeout}.resource that nodes, a program may need to dynamically cre- specifies: (1) the spatial information for a node of in- ate/remove its own resources. The primitives terest, (2) the content-based name for this node, (3) that offer this functionality are: create({space:tag[i], the instance of a particular node with these spatial timeout}.resource) and remove({space:tag[i], time- and content-based properties, (4) an upper bound on out}.resource). The binding for the spatial refer- the access time for the desired resource, and (5) the ence {space:tag[i]} must exist when these functions are resource name at the node. called. For instance, an application may need to cre- Spatial References. A spatial reference is a ate new resources in order to store data in the network {space:tag} tuple that refers to a node located in space (i.e., similar to creating files in a file system), or it may and named by content using tag. The space is a geo- even create new services on nodes of interest (e.g., an graphical scope for the content-based name of the node image recognition service on a camera node). being addressed. Spatial references allow transparent access to resources located on the referenced nodes. In 4.3. Defining New Spaces the example presented in Figure 1 we have two spaces, campus and town, and each node hosts a camera tag. To allow for flexible specifications of spaces, SP sup- The reference {campus:camera} represents one of the ports basic operations on spaces. The application may intelligent cameras that are in the campus. use statically defined spaces (such as campus or town) Spatial Reference Instances. To make it pos- or create new composed spaces using union, difference sible to refer to more than one node with the same or intersection operators. In our example from Fig- spatial and content properties we introduce the notion ure 1, the reference {(town - campus):camera} returns of reference instance. The reference instance denotes a camera node located in town, but not in campus. a particular index of the node that is referenced by Defining relative spaces based on the position of the spatial-content description. For example, in Fig- a node referenced by a spatial reference can be ure 1, {campus:camera[0]} and {campus:camera[1]} de- useful for many applications. Therefore we define note two different camera nodes located in campus. rangeOf({space:tag[i]}, range) as the circular space Access Timeout. In such a volatile environment, with the center at the position of the node referenced it is difficult to estimate how long it takes to access a by {space:tag[i]} (this position along with a unique network resource (i.e., even the existence of a certain identifier of the node are maintained in the associ- resource in a given space is unknown). Nevertheless, an ated binding) and the radius equals range. Using
1 void MonitorAndExtinguish(Space area){ range 2 for(i=0; i
and to specify constraints that have to be satisfied by nodes. SMs consist of code and data sections as well a program execution, including resources, time, and as a lightweight execution state. They migrate through quality of result constraints. SP can serve as a possible the network, searching for nodes of interest, and exe- target language for a Spatial Views compiler, but not cute at each node in the path. The SM execution is vice versa. embodied in tasks described in terms of migration and A research complementary to ours is TAG [21], computation phases. SMs name the nodes of interest which defines an SQL-like language for sensor net- by their properties and self-route to them using other works. Both SP and TAG provide simple program- nodes as stepping stones. Nodes in the network sup- ming constructions that shield the programmer from port SMs by providing (1) a name-based memory for the underlying network. The are two main differences inter-SM communication, synchronization and interac- between SP and TAG. First, SP focuses on a flexible tion with the local host, and (2) a virtual machine for abstraction that allows programming for uncertainty SM execution. in highly dynamic networks, while TAG focuses on a SP constructs can be added either as language ex- set of queries executed efficiently in the network. Sec- tensions or as library calls. The main component of ond, the programmer has the control over execution in this implementation is an SP to SM translator, which SP, while TAG depends entirely on the compiler (i.e., essentially will translate every access to a spatial ref- essentially SP offers an imperative language and TAG erence into an SM migration and will generate code offers a declarative language). to handle the bindings created during execution. The Spatial Programming shares the idea of using spatial binding table will be carried by SMs as mobile data. information with various forms of geographical rout- Necessary components of the implementation are geo- ing [17, 14, 18], but it differs from them in its main graphical and content based routing that can be devel- goal, transparent computing over networks distributed oped using the flexible self-routing mechanism provided within the physical space. by SM. Content-based naming has been recently presented In the following, we briefly outline future ideas for for both Internet [4, 23, 9] and sensor networks [13]. improving the SP design and implementation. We plan The spatial references used in SP are similar abstrac- to further investigate what other features should be tions to these content-based names, but they incorpo- added to the SP to make it even more flexible and rate the spatial information and present a uniform view easier to use in such complex environments as NES. of space and network to applications. Another differ- We also plan to analyze the tradeoffs between various ence is that SP targets ubiquitous computing environ- design choices that we face in implementing SP. ments and is independent of the underlying implemen- tation. For networks of resource constrained devices, such Recent work on large networks of embedded systems as sensor networks, a more traditional implementation has focused on network protocols for wired and wire- may yield better performance. Therefore we plan to less sensor networks [11, 13], system architectures for have an SP implementation on top of Directed Diffu- fixed-function sensor networks [12], and energy efficient sion [13]. data collection for mobile sensor networks designed to The decision whether to implement the SP con- support wildlife tracking [15]. Sensor networks can rep- structs as programming language extensions or as li- resent a platform for SP. Since they are deployed across brary calls has to be evaluated both in terms of perfor- large geographical regions, SP provides a viable solu- mance and ease of programming. tion to alleviate the task of writing programs for them. There are situations when a parallel access to spa- tial references is possible (there are no dependencies 6. Status and Future Work among them) and desirable in order to increase the per- formance. Therefore a future additions to SP might be At this time, we are in the process of implement- constructs that allow the user to specify such parallel ing SP using Smart Messages (SM) [6], which repre- activities (i.e., parbegin/parend, parfor). sent a suitable platform for SP. The main advantage In our current design, if an access to a bound spa- of using SMs is that they overcome the scale, hetero- tial reference fails, an exception is raised and the ap- geneity, and connectivity issues encountered in NES by plication regains the control. Two improvements are placing the intelligence in migratory execution units, possible: (1) a re-bind operation can be performed if while requiring only a minimal system support from the application accepts a similar node (same space and nodes. Another advantage of an SM implementation content-based name) and, (2) a transparent tracking of is the possibility to dynamically install new services at the mobile node that moved into another space.
References [13] C. Intanagonwiwat, R. Govindan, and D. Estrin. Di- rected Diffusion: A Scalable and Robust Communica- [1] Sandia National Laboratories. http://www.sandia.gov tion Paradigm for Sensors Networks. In Proceedings /media/NewsRel/NR2000/avalanch.htm. of the Sixth annual ACM/IEEE International Con- [2] Sensoria Corporation. http://www.sensoria.com. ference on Mobile Computing and Networking (Mo- [3] S. Adhikari, A. Paul, and U. Ramachandran. D- biCom), pages 56–67, August 2000. Stampede: Distributed Programming System for [14] Jinyang Li, John Janotti, Douglas De Couto, David R. Ubiquitous Computing. In Proceedings of the 22nd In- Karger and Robert Morris. A Scalable Location Ser- ternational Conference on Distributed Computing Sys- vice for Geographic Ad Hoc Routing. In Proceedings tems (ICDCS)., pages 209–216, July 2002. of the Sixth annual ACM/IEEE International Con- [4] W. Adjie-Winoto, E. Schwartz, H. Balakrishnan, and ference on Mobile Computing and Networking (Mo- J. Lilley. The Design and Implementation of an In- biCom), pages 120–130, August 2000. tentional Naming System. In Proceedings of the 17th [15] P. Juang, H. Oki, Y. Wang, M. Martonosi, L.-S. Peh, ACM Symposium on Operating Systems Principles and D. Rubenstein. Energy-Efficient Computing for (SOSP), pages 186–201, 1999. Wildlife Tracking: Design Tradeoffs and Early Expe- [5] G. Banavar, J. Beck, E. Gluzberg, J. Munson, J. Suss- riences with ZebraNet. In Proceedings of the Tenth man, and D. Zukowski. Challenges: An Application International Conference on Architectural Support for Model for Pervasive Computing. In Proceedings of the Programming Languages and Operating Systems (AS- Sixth annual ACM/IEEE International Conference on PLOS), October 2002. Mobile Computing and Networking (MobiCom), pages [16] E. Kaplan, editor. Understanding GPS: Principles and 266–274, August 2000. Applications. Artech House, 1996. [6] C. Borcea, D. Iyer, P. Kang, A. Saxena, and [17] B. Karp and H. Kung. Greedy Perimeter Stateless L. Iftode. Cooperative Computing for Distributed Em- Routing for Wireless Networks. In Proceedings of the bedded Systems. In Proceedings of the 22nd Interna- Sixth annual ACM/IEEE International Conference on tional Conference on Distributed Computing Systems Mobile Computing and Networking (MobiCom), pages (ICDCS)., pages 227–236, July 2002. 243–254, August 2000. [7] L. Girod, V. Bychkovskiy, J. Elson, and D. Estrin. [18] Y.-B. Ko and N. H. Vaidya. Location-Aided Rout- Locating Tiny Sensors in Time and Space: A Case ing(LAR) in Mobile Ad Hoc Networks. In Proceedings Study. In Proceedings of the International Conference of the Fourth annual ACM/IEEE International Con- on Software/Hardware Codesign (ICCD 2002). Invited ference on Mobile Computing and Networking (Mobi- Paper, October 2002. Com), pages 66–75, October 1998. [8] R. Grimm, J. Davis, B. Hendrickson, E. Lemar, [19] U. Kremer, L. Iftode, J. Hom, and Y. Ni. Spatial A. MacBeth, S. Swanson, T. Anderson, B. Bershad, Views: Iterative Spatial Programming for Networks of G. Borriello, S. Gribble, and D. Wetherall. Systems Embedded Systems. Technical Report DCS-TR-493, Directions for Pervasive Computing. In Proceedings of Rutgers University, June 2002. the 8th Workshop on Hot Topics in Operating Systems [20] M. Satyanarayanan. Pervasive Computing: Vision and (HotOS-VIII), May 2001. Challenges. IEEE Personal Communications, August [9] M. Gritter and D. Cheriton. An Architecture for Con- 2001. tent Routing Support in the Internet. In Proceedings [21] S. Madden, M. Franklin, J. Hellerstein, and W. Hong. of the 3rd USENIX Symposium on Internet Technolo- TAG: a Tiny AGgregation Service for Ad-Hoc Sensor gies and Systems (USITS), March 2001. Networks. In Proceedings of the 5th Symposium on Op- [10] J. Heideman, F. Silva, C. Intanagonwiwat, R. Govin- erating Systems Design and Implementation (OSDI). dan, D. Estrin, and D. Ganesan. Building Efficient To Appear., December 2002. Wireless Sensor Networks with Low-Level Naming. In [22] N. B. Priyantha, A. K. L. Miu, H. Balakrishnan, and Proceedings of the 18th ACM Symposium on Operating S. Teller. The Cricket Compass for Context-Aware Systems Principles (SOSP), pages 146–159, October Mobile Applications. In Proceedings of the 7th an- 2001. nual ACM/IEEE International Conference on Mobile [11] W. R. Heinzelman, J. Kulik, and H. Balakrishnan. Computing and Networking (MobiCom), pages 1–14, Adaptive Protocols for Information Dissemination in 2001. Wireless Sensor Networks. In Proceedings of the Fifth [23] A. Vahdat, M. Dahlin, T. Anderson, and A. Aggar- annual ACM/IEEE International Conference on Mo- wal. Active Names: Flexible Location and Trans- bile Computing and Networking (MobiCom), pages port of Wide-Area Resources. In Proceedings of the 174–185, August 1999. Second USENIX Symposium on Internet Technologies [12] J. Hill, R. Szewczyk, A. Woo, S. Hollar, D. Culler, and Systems (USITS), pages 151–164, October 1999. and K. Pister. System Architecture Directions for [24] M. Weiser. The computer for the twenty-first century. Networked Sensors. In Proceedings of the Ninth In- Scientific American, September 1991. ternational Conference on Architectural Support for Programming Languages and Operating Systems (AS- PLOS), pages 93–104, November 2000.
You can also read