Spatial Programming Spatial Programming using Smart Messages: using Smart Messages:
Design and Design and ImplementationImplementation
Cristian BorceaCristian Borcea, Chalermek , Chalermek Intanagonwiwat, Porlin Kang, Ulrich Intanagonwiwat, Porlin Kang, Ulrich
Kremer, and Liviu IftodeKremer, and Liviu IftodeDepartment of Computer ScienceDepartment of Computer Science
Rutgers UniversityRutgers University
22
Distributed object Distributed object tracking over a largetracking over a large
geographical areageographical area
Cars collaborating Cars collaborating for a safer and for a safer and
more fluid trafficmore fluid traffic
Computers Go Outdoors, Computers Go Outdoors, Embedded Everywhere in the Embedded Everywhere in the
Physical WorldPhysical World
33
Traditional (Indoor) Traditional (Indoor) Distributed ComputingDistributed Computing
Computation is distributed for performance or Computation is distributed for performance or fault tolerance fault tolerance
Relatively easy to programRelatively easy to program– Nodes are computationally equivalentNodes are computationally equivalent
– Networking is robust and has acceptable delaysNetworking is robust and has acceptable delays
– Configuration is stableConfiguration is stable
44
Outdoor Distributed ComputingOutdoor Distributed Computing
Computation is physically distributedComputation is physically distributed
– Nodes distributed across the physical spaceNodes distributed across the physical space
– Location-aware computingLocation-aware computing
Hard to programHard to program
– Nodes are functionally heterogeneous and Nodes are functionally heterogeneous and
potentially mobilepotentially mobile
– Ad hoc wireless networks of embedded systemsAd hoc wireless networks of embedded systems
– Volatile configurationsVolatile configurations
55
ExampleExample
Mobile sprinkler Mobile sprinkler with temperature with temperature sensorsensor
Left HillLeft Hill Right HillRight Hill
Hot spotHot spot
““Water the hottest spot on the Left Hill”Water the hottest spot on the Left Hill” Number and location of mobile sprinklers Number and location of mobile sprinklers
are unknownare unknown Configuration is not stable over timeConfiguration is not stable over time
– Sprinklers moveSprinklers move
– Temperature changesTemperature changes
66
Traditional Distributed Traditional Distributed Computing Computing
Does Not Work Well OutdoorsDoes Not Work Well Outdoors End-to-end data transfers may hardly completeEnd-to-end data transfers may hardly complete Fixed address naming and routing (e.g., IP) are Fixed address naming and routing (e.g., IP) are
too rigidtoo rigid Difficult to deploy new applications in existing Difficult to deploy new applications in existing
networksnetworks Outdoor distributed computing requires novel Outdoor distributed computing requires novel
abstractions and programming modelsabstractions and programming models– How to write outdoor distributed applications?How to write outdoor distributed applications?
– How to deploy new applications in existing networks?How to deploy new applications in existing networks?
77
OutlineOutline
MotivationMotivation Spatial Programming (SP) ModelSpatial Programming (SP) Model SP Implementation using Smart MessagesSP Implementation using Smart Messages SP ApplicationSP Application ConclusionsConclusions
88
Traditional (Indoor) ProgrammingTraditional (Indoor) Programming
Programs access data through variablesPrograms access data through variables Variables mapped to physical memory locationsVariables mapped to physical memory locations Page Table and OS guarantee reference Page Table and OS guarantee reference
consistency consistency Access time has an (acceptable) upper boundAccess time has an (acceptable) upper bound
ProgramProgram
Virtual Address SpaceVirtual Address Space
Page Table + OSPage Table + OS
Physical Memory
Variable accessVariable access
99
From Indoor to Outdoor From Indoor to Outdoor ComputingComputing
Virtual Address SpaceVirtual Address Space Space RegionSpace Region
VariablesVariables Spatial ReferencesSpatial References
Variables mapped to Variables mapped to physical memoryphysical memory
Spatial references mappedSpatial references mappedto systems embedded in to systems embedded in the physical spacethe physical space
Reference consistencyReference consistency
Bounded access timeBounded access time
??
??
1010
Spatial Programming (SP) at a Spatial Programming (SP) at a GlanceGlance
Provides a Provides a virtual name spacevirtual name space over outdoor over outdoor
networks of embedded systemsnetworks of embedded systems
Embedded systems named by their locations and Embedded systems named by their locations and
propertiesproperties
Runtime system takes care of name resolution, Runtime system takes care of name resolution,
reference consistency, and networking aspectsreference consistency, and networking aspects
1111
radiusradius
Hill = new Space({lat, long}, radius);Hill = new Space({lat, long}, radius);
{lat,long}{lat,long}
Space RegionsSpace Regions
Virtual representation of a physical spaceVirtual representation of a physical space Similar to a virtual address space in a Similar to a virtual address space in a
conventional conventional
computer systemcomputer system Defined statically or dynamicallyDefined statically or dynamically
1212
Spatial ReferencesSpatial References
Defined as Defined as {space:property}{space:property} pairs pairs Virtual names for embedded systemsVirtual names for embedded systems Similar to variables in conventional programmingSimilar to variables in conventional programming
Indexes used to distinguish among similar Indexes used to distinguish among similar
systems systems
in the same space regionin the same space region
{Hill:robot[0]}{Hill:robot[0]}
{Hill:robot[1]}{Hill:robot[1]}
{Hill:motion[0]}{Hill:motion[0]}
HillHill
r2r2r7r7
m5m5
1313
Reference ConsistencyReference Consistency
At first access, a spatial reference is mapped to At first access, a spatial reference is mapped to
an embedded system located in the specified an embedded system located in the specified
space space Mappings maintained in per-application Mapping Mappings maintained in per-application Mapping
Table (MT) – similar to a page tableTable (MT) – similar to a page table
Subsequent accesses to the same spatial Subsequent accesses to the same spatial reference will reach the same system (using MT) reference will reach the same system (using MT) as long as it is located in the same space region as long as it is located in the same space region
{space, property, index}{space, property, index}{unique_address, location}{unique_address, location}
1414
Reference Consistency ExampleReference Consistency Example
Left HillLeft Hill Right HillRight Hill
{Left_Hill:robot[0]}.move = ON;{Left_Hill:robot[0]}.move = ON;
r2r2 r7r7r5r5
{Left_Hill:robot[0]}.move = OFF;{Left_Hill:robot[0]}.move = OFF;
1515
Space CastingSpace Casting
{Left_Hill:robot[0]}{Left_Hill:robot[0]}
Left HillLeft Hill Right HillRight Hill
{Right_Hill:(Left_Hill:robot[0])}{Right_Hill:(Left_Hill:robot[0])}
r7r7
1616
Bounding the Access TimeBounding the Access Time
How to bound the time to access a spatial How to bound the time to access a spatial reference?reference?– Systems may move, go out of space, or disappearSystems may move, go out of space, or disappear
Solution: associate an explicit timeout with the Solution: associate an explicit timeout with the spatial reference accessspatial reference access
try{try{ {Hill:robot[0], timeout}.{Hill:robot[0], timeout}.move = ON;move = ON;}catch(TimeoutException e){}catch(TimeoutException e){ // the programmer decides the next action// the programmer decides the next action}}
1717
for(i=0; i<1000; i++)for(i=0; i<1000; i++) try{try{
if (if ({Left_Hill:Hot[i], timeout}.{Left_Hill:Hot[i], timeout}.temp > Max_temp)temp > Max_temp)Max_temp = Max_temp = {Left_Hill:Hot[i], timeout}{Left_Hill:Hot[i], timeout}.temp;.temp;Max_id = i;Max_id = i;
}catch(TimeoutException e) }catch(TimeoutException e) break;break; {Left_Hill:Hot[Max_id], timeout}{Left_Hill:Hot[Max_id], timeout}.water = ON;.water = ON;
Spatial Programming Spatial Programming ExampleExample
Water the hottest spot on the Left HillWater the hottest spot on the Left Hill
Mobile sprinkler Mobile sprinkler with temperature with temperature sensorsensor
Left HillLeft Hill Right HillRight Hill
Hot spotHot spot
1818
OutlineOutline
MotivationMotivation Spatial Programming (SP) ModelSpatial Programming (SP) Model SP Implementation using Smart MessagesSP Implementation using Smart Messages SP ApplicationSP Application ConclusionsConclusions
1919
Smart Messages at a GlanceSmart Messages at a Glance Smart Message (SM)Smart Message (SM)
– User defined distributed application similar to a User defined distributed application similar to a mobile agentmobile agent
– Executes on nodes of interest named by propertiesExecutes on nodes of interest named by properties– Migrates between nodes of interest using self-Migrates between nodes of interest using self-
routingrouting Self-RoutingSelf-Routing
– Application-level routing executed at every nodeApplication-level routing executed at every node– Applications can change routing during executionApplications can change routing during execution
Cooperative NodesCooperative Nodes– Execution environment (Virtual Machine)Execution environment (Virtual Machine)– Memory addressable by names (Tag Space)Memory addressable by names (Tag Space)– Code cacheCode cache
2020
Smart Messages PrototypeSmart Messages Prototype
Modified version of Sun’s Java K Virtual Modified version of Sun’s Java K Virtual
MachineMachine– Small memory footprint (160KB)Small memory footprint (160KB)
SM and tag space primitives implemented SM and tag space primitives implemented
inside virtual machine as native methods inside virtual machine as native methods
(efficiency)(efficiency) Implemented I/O tags: GPS location, neighbor Implemented I/O tags: GPS location, neighbor
discovery, image capture, light sensor, discovery, image capture, light sensor,
system statussystem status
2121
Spatial Programming Spatial Programming Implementation Using Smart Implementation Using Smart
Messages Messages SP application translates into an SMSP application translates into an SM
– Spatial reference access translates into an SM Spatial reference access translates into an SM migration to the mapped nodemigration to the mapped node
– Embedded system properties: TagsEmbedded system properties: Tags
SM self-routes using geographical routing and SM self-routes using geographical routing and content-based routing content-based routing
Reference consistencyReference consistency− Unique addresses (stored in mapping table) are Unique addresses (stored in mapping table) are
unique tags created at nodesunique tags created at nodes
− SM carries the mapping tableSM carries the mapping table
2222
Max_temp = {Left_Hill:Hot[1], timeout}.temp;Max_temp = {Left_Hill:Hot[1], timeout}.temp;
SP to SM Translation: ExampleSP to SM Translation: Example
Left HillLeft Hill Right HillRight Hill
Spatial Reference AccessSpatial Reference Access
Smart MessageSmart Message
ret = migrate_geo(location, timeout);ret = migrate_geo(location, timeout);if (ret == LocationUnreachable)if (ret == LocationUnreachable) ret = migrate_tag(yU78GH5, timeout);ret = migrate_tag(yU78GH5, timeout);if ((ret == OK) && (location == Left_Hill))if ((ret == OK) && (location == Left_Hill)) return readTag(temp);return readTag(temp);else throw TimeoutException else throw TimeoutException
{Left_Hill,Hot,1}{Left_Hill,Hot,1} {yU78GH5,location}{yU78GH5,location}MappingMappingTableTable
CodeCode
2323
SP Application: Intrusion SP Application: Intrusion DetectionDetection
Code Size breakdown for SM Code Size breakdown for SM (Application + SP Library)(Application + SP Library)
Code Size breakdown for Code Size breakdown for SP librarySP library
Ad hoc network: HP iPAQs with 802.11 cards and GPS devicesAd hoc network: HP iPAQs with 802.11 cards and GPS devices
user nodeuser nodelight sensorlight sensorcamera nodecamera node
regular noderegular node
monitoredmonitoredspacespace
2424
Execution Time BreakdownExecution Time Breakdown
2525
ConclusionsConclusions
Spatial Programming makes outdoor Spatial Programming makes outdoor
distributed computing simpledistributed computing simple
– Volatility, mobility, configuration dynamics, ad-hoc Volatility, mobility, configuration dynamics, ad-hoc
networking are hidden from programmernetworking are hidden from programmer
Implementation on top of Smart Messages Implementation on top of Smart Messages
– Easy to deploy new applications in the networkEasy to deploy new applications in the network
– Quick adaptation to highly dynamic network Quick adaptation to highly dynamic network
configurationsconfigurations
Top Related