Programming Computers Embedded in the Physical World Liviu Iftode, Andrzej Kochut University of...

Preview:

Citation preview

Programming Computers Embedded in the Physical

World

Liviu Iftode, Andrzej KochutUniversity of Maryland

Cristian Borcea, Chalermek Intanagonwiwat, Ulrich Kremer

Rutgers University

2

Distributed Computing Goes Outdoors

– How to program an unknown number of mobile systems to execute a user-defined application in a certain geographical area?– Traditional distributed computing hard to apply– The programming model must be simple to use

– Networking aspects should be hidden from programmer

Left Hill Right Hill

3

An Insightful Analogy (1)

Application accesses data through variables Variables mapped to physical memory locations OS guarantees reference consistency Access time has an (acceptable) upper bound

Application

Virtual address space

Page table

Physical memory

Variable access

4

Shared virtual memory makes distributed programming easy– Application accesses distributed data through shared

variables– Runtime system translates variable accesses into message

passing

An Insightful Analogy (2)

Distributed Application

Shared virtual address space

Page table + Message passing

Physical memories

Variable accesses

5

From Indoor to Outdoor Computing

Virtual Address SpaceSpace Region

Variables Spatial References

Variables mapped to physical memory

Spatial references mapped to systems embedded in the physical space

Reference consistency

Bounded access time

?

?

6

Space Regions

radius

Hill = new Space({lat, long}, radius);

{lat,long}

7

Spatial References

– Refer to systems embedded in physical space– Defined as {space:property} pairs– Indexes used to distinguish among similar systems in the same space region

- Distinct indexes must map to distinct systems– Same index must map to the same system (reference consistency)

{Hill:robot[0]}

{Hill:robot[1]}

{Hill:motion}

Hill

8

Reference Consistency

At first access, a spatial reference is mapped to an embedded system located in the specified space

Mapping maintained in a Binding Table

Subsequent accesses to the same spatial reference uses the Binding Table to locate the corresponding embedded system

{space, property, index} {network_address, location}

9

Bounding the Access Time How to bound the time to access a spatial

reference?

– Discover an unmapped system for a new spatial

reference

– Mapped systems may move, go out of space, or

disappear

Solution: associate an explicit timeout with the

spatial reference access

try{ {Hill:robot[0], timeout}.camera = ON;}catch(TimeoutException e){ // the programmer decides the next action}

10

Spatial Programming (SP)

Programs outdoor distributed applications using

spatial references

Shields programmers from networking details

Space is a first order programming concept

Embedded systems named by their expected

locations and properties

Network dynamics tolerated through timeouts

11

for(i=0;i<1000;i++) try{

if ({Left_Hill:Hot[i], timeout}.temp > Max_temp)Max_temp = {Left_Hill:Hot[i], timeout}.temp;Max_id = i;

}catch(TimeoutException e) break; {Left_Hill:Hot[Max_id]}.water = ON;

Spatial Programming Example

Application: Water the hottest spot on the Left Hill

Mobile sprinkler with temperature sensor

Left Hill Right Hill

Hot spot

12

Smart Messages (SM)

Smart Messages: distributed programming

platform based on execution migration (similar to

mobile agents)

– Composed of multiple code and data bricks

– Carry their own routing as a code brick (self-routing)

Cooperative nodes

– Virtual Machine: execution environment for SMs

– Tag Space: name-addressed memory persistent across

SM executions

– Code Cache: most recently used SM code bricks

13

Spatial Programming Implementation using Smart

Messages SP application translates into an SM Embedded system properties: Tags SM self-routing

– Content-based routing using tags

– Geographical routing

Reference consistency: unique tags are created on the mapped systems and stored as network addresses in the Binding Table

Spatial reference access translates into an SM migration to the mapped node

14

Max_temp = {Left_Hill:Hot[1], timeout}.temp;

SP using SMs: Example

Mobile sprinkler with temperature sensors

Left Hill Right Hill

Hot spot

Spatial Reference Access

Smart Message

ret = migrate_geo(location, timeout);if ret == LocationUnreachable ret = migrate_tag(yU78GH5, timeout);if (ret == OK) && (location == Left_Hill) return readTag(temp);else throw TimeoutException

{Left_Hill,Hot,1} {yU78GH5,location}BT

CodeBrick

15

Prototype Implementation

SP library over SM implemented in Java

Testbed: HP iPAQs equipped with 802.11 cards

and running Linux

16

Conclusions

Spatial Programming makes outdoor distributed

computing simple to program

Volatility, mobility, configuration dynamics, ad-

hoc networking are hidden from programmer

Spatial Programming implemented using Smart

Messages

17

Thank you!

http://discolab.rutgers.edu/sm

18

Space Composition

Left Hill Right Hill

{(Left_Hill + Right_Hill):robot[0]}

19

Relative Spaces

Left Hill Right Hill

{rangeOf({Left_Hill:robot[0]}, radius):robot[0]}

20

Space Casting

Left Hill Right Hill

Left Hill Right Hill

{Right_Hill:robot[0]}

{Left_Hill:{Right_Hill:robot[0]}}

Recommended