Top Banner
Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 •Jacob Beal (BBN Technologies) [email protected] Jonathan Bachrach (MIT) [email protected] Cristian Borcea (NJIT) [email protected] Marco Mamei (Univ. Modena Reggio Emilia) [email protected] 1
135

Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) [email protected] Jonathan Bachrach (MIT) [email protected].

Jan 28, 2016

Download

Documents

Shanon Bennett
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Spatial Approaches to Pervasive Computing

Tutorial at IEEE SASO 2008

•Jacob Beal (BBN Technologies)•[email protected]

Jonathan Bachrach (MIT)[email protected]

Cristian Borcea (NJIT)[email protected]

Marco Mamei (Univ. Modena Reggio Emilia)[email protected]

1

Page 2: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Syllabus

Pervasive Computing, Spatial Computing Example Scenarios

Overview of Spatial Approaches Three spatial programming models:

Spatial Programming / Smart Messages TOTA / Field-based Coordination Proto / Amorphous Medium abstraction

2

Page 3: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Wireless devices are filling our environment...

3

Page 4: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Wireless devices are filling our environment...

4

Page 5: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Wireless-enabled embedded systems

>3.3B cell phones vs. 600M Internet-connected PC’s in 2007

>600M cell phones with Internet capability, rising rapidly

New cars come equipped with navigation systems and will soon have wireless interfaces (WiFi/DSRC, cellular, WiMax)

Sensor deployment just starting, but some estimates ~5-10B units by 2015

Military/emergency response wireless robots, unmanned vehicles, unmanned aircraft

5

Page 6: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Networked wireless devices

6

Page 7: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Pervasive computing vision Computing,

communication, and sensing anytime, anywhere

Wireless embedded

systems cooperate to

achieve global tasks

7

Page 8: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Outdoor distributed applications

Tornadoapproaching!

Highway

Parking Area

Shopping mall

Traffic jam!

Local fog patches!

Free parking spot!

50% discount!

8

Page 9: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Example: intrusion detectionLeft HillLeft Hill Right HillRight Hill

Mobile robotwith camera

Motion Sensor

Intrusion detection across hills using motion sensors and autonomous robots with cameras

Number and location of systems are unknown Configuration is not stable over time

Intrusions can appear randomly Robots can move

9

Page 10: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Example: museum guide

I would like to see the Mona Lisa,

avoiding the queues…

I’ve gotten lost! How can I rejoin

my friends?

10

Page 11: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Example: mobile streaming

I want Alice to be able to listen in

on this great conversation

11

Page 12: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Not Very Close to This Vision Yet

Nomadic computing– Devices: laptops– Internet: intermittent connectivity– Work: typical desktop applications

Mobile communication– Devices: PDAs, mobile phones, Blackberries– Internet: continuous connectivity– Work: read email, potentially web

Experimental sensor networks– Devices: Berkeley/Crossbow motes– Internet: Possible through base station– Work: Monitor environment, wildlife 12

Page 13: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Why?

• Hard to program distributed applications over collections of wireless systems Systems: distributed across physical space,

mobile, heterogeneous hardware and software, resource-constrained (battery, bandwidth, memory)

Networks: large scale volatile (ad hoc topologies, dynamic resources), less secure than wired networks

13

Page 14: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Traditional distributed computing does not work well outdoors

End-to-end data transfers may rarely complete Fixed address naming and routing (e.g., IP) are

too rigid Difficult to deploy new applications in existing

networks

Outdoor distributed computing requires novel programming models and system architectures!

14

Page 15: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Spatial computers

Robot Swarms Biological Computing

Modular Robotics

Sensor Networks

Reconfigurable Computing

Cells during Morphogenesis

15

Page 16: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

More formally...

A spatial computer is a collection of computational devices distributed through a physical space in which: the difficulty of moving information between any

two devices is strongly dependent on the distance between them, and

the “functional goals” of the system are generally defined in terms of the system's spatial structure

16

Page 17: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

More formally... A spatial computer is a collection of computational

devices distributed through a physical space in which: the difficulty of moving information between any two

devices is strongly dependent on the distance between them, and

the “functional goals” of the system are generally defined in terms of the system's spatial structure

Notice the ambiguities in the definition17

Page 18: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

• (w. Dan Yamins)

Graphs

Crystalline(e.g. CAs)

Amorphous/Continuous

Promising Solution:Spatial Computing Approaches

18

Page 19: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

• (w. Dan Yamins)

Graphs

Crystalline(e.g. CAs)

Amorphous/Continuous

dens

ity

spac

e co

mpl

exity

jitter

grain size

Promising Solution:Spatial Computing Approaches

19

Page 20: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

• (w. Dan Yamins)

Graphs

Crystalline(e.g. CAs)

Amorphous/Continuous

dens

ity

spac

e co

mpl

exity

jitter

grain size

spatial computing

Promising Solution:Spatial Computing Approaches

20

Page 21: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Desiderata for spatial computing approaches

Take advantage of spatial nature of problems Simple, easy to understand code Scalable to potentially vast numbers of

devices Robust to errors, adapt to changing

environment

21

Page 22: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Syllabus

Pervasive Computing, Spatial Computing Example Scenarios

Overview of Spatial Approaches Three spatial programming models:

Spatial Programming / Smart Messages TOTA / Field-based Coordination Proto / Amorphous Medium abstraction

22

Page 23: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

A taxonomy of approaches

Spatial

DynamicGeometry

Uniform Viral

Non-Spatial

Non-Composable

23

Page 24: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

A taxonomy of approaches

Spatial

DynamicGeometry

Uniform Viral

Non-Spatial

Non-Composable

24

Page 25: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Approaches from local dynamics

• Primitives describe only actions between devices and the neighbors they communicate with.

Advantages: coherent and correct semantics Disadvantages: programmer must figure out

how to marshal local dynamics to produce coherent large-area programs

25

Page 26: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Proto: computing with fieldsPointwise Restriction

Feedback Neighborhood

+restric

t

+

741

delay

48

any-hood

nbr

26

Page 27: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

TOTA: viral tuples

• Middleware to create distributed data structures like gradients and fields.

• Data structures made of tuples injected from a node and virally spread across the network.

• T = (C,P,M)

• API to inject/read tuples• API to define (C,P,M)

GradientC = value; P = propagate breadth-first increasing value by 1 at every hop;M = maintain gradient despite network reconfiguration;

GradientC = value; P = propagate breadth-first increasing value by 1 at every hop;M = maintain gradient despite network reconfiguration;

27

Page 28: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Other viral approaches

Smart Messages (Borcea) Execution migration to nodes of interest Nodes of interest discovered using self-routing

Paintable Computing (Butera) Consistent transfer, view of neighbor data Code for install, uninstall, transfer control and update

RGLL (Sutherland) Code for arrival, tick, collision, departure Communication via collision

28

Page 29: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Approaches from geometry

• Primitives describe large-scale geometric regions (e.g. “all devices on the left hill”)

Advantages: coherent, easy to specify large-scale programs

Disadvantages: generally easy to accidentally specify programs that cannot be executed correctly

29

Page 30: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Regiment• Provide a rich set of operators to work with data

distributed over time and space.• Simple Regions, created from geometric or radio

relationships:• K-hop-neighborhood• K-nearest nodes• All nodes within circle (square, etc.)

• Derived Regions, built from other regions• Union, Intersection• Map, Filter

30

Page 31: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Spatial programming

Left HillLeft Hill Right HillRight Hill

Virtual name space over outdoor networks of embedded systems– Systems named by spatial references using their locations and

properties

– Applications are sequential programs that read/write spatial references (similar to regular variables)

– Read/write trigger transparent program migrations on each referenced system

{{Right_Hill:robot[0]}]}

{Right_Hill:robot[1]}

{{Right_Hill:motion[0]}]}

31

Page 32: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Other geometric approaches

EgoSpaces SpatialViews Spidey Abstract Regions

32

Page 33: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Non-composable approaches

• Algorithms and techniques, generally based on geometry, but not part of a system of composable parts

Advantages: powerful spatial ideas for that are good for inclusion in code libraries

Disadvantages: developed as stand-alone ideas, and may have limited composability

33

Page 34: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Field-based coordination• Contextual information is expressed by means of

distributed data-structures (i.e. fields) spread by agents.

• Agent move and act being driven by these fields (feedback cycle)

34

Page 35: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-healing gradients

35

Page 36: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Other non-composable approaches

Yamins' locally checkable patterns Family of self-stabilizing CA patterns

hood (Whitehouse, et. al.) nesC library for interacting with neighbors

McLurkin's “Stupid Robot Tricks” Swarm behaviors intended mainly for time-wise

multiplexing. Countless one-shot systems...

36

Page 37: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Significant non-spatial approaches

“roll-your-own” (e.g. C/C++) TinyDB

Distributed database queries for sensor networks Kairos

Distributed graph algorithms WaveScript

Distributed streaming language Follow-on to Regiment w/o the spatial primitives

37

Page 38: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Syllabus

Pervasive Computing, Spatial Computing Example Scenarios

Overview of Spatial Approaches Three spatial programming models:

Spatial Programming / Smart Messages TOTA / Field-based Coordination Proto / Amorphous Medium abstraction

38

Page 39: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

39

Outdoor programming example

Left HillLeft Hill Right HillRight Hill

Mobile robotwith camera

Motion Sensor

Intrusion detection across the hills using motion sensors and autonomous mobile robots with cameras

Number and location of systems are unknown Configuration is not stable over time

– Intrusions can appear randomly– Robots can move

Page 40: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

40

Traditional (indoor) programming

• Programs access data through variables• Variables mapped to physical memory locations• Page Table and OS guarantee reference consistency • Access time has an (acceptable) upper bound

ProgramProgram

Virtual Address SpaceVirtual Address Space

Page Table + OSPage Table + OS

Physical MemoryPhysical Memory

Variable accessVariable access

Page 41: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

41

• Applications access distributed data through shared variables

• Runtime system translates variable accesses into message passing (when necessary)

Software distributed shared memory

Distributed ApplicationDistributed Application

Shared virtual Shared virtual address spaceaddress space

Page Table + Page Table + Message PassingMessage Passing

DistributedDistributedPhysical MemoryPhysical Memory

Variable accesses

Page 42: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

42

From indoor to outdoor computing

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

??

??

Page 43: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

43

Spatial Programming (SP) at a glance

• Provides a virtual name space over outdoor networks of embedded systems

• Embedded systems named by their locations and properties

• Runtime system takes care of name resolution, reference consistency, and networking aspects

• Implementation on top of Smart Messages: SP applications execute, sequentially, on each system referenced in their code

Page 44: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

44

radiusradius

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

{lat,long}{lat,long}

Space regions

Virtual representation of a physical space Similar to a virtual address space in a conventional

computer system Defined statically or dynamically

Page 45: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

45

Spatial references

Defined as {space:property} pairs Virtual names for embedded systems Similar to variables in conventional programming Indexes used to distinguish among similar systems

in 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

Page 46: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

46

Relative space regions

Left HillLeft Hill Right HillRight Hill

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

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

Page 47: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

47

From indoor to outdoor computing

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

??

??

Page 48: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

48

Reference consistency

• At first access, a spatial reference is mapped to an

embedded system located in the specified space

• Mappings maintained in per-application Mapping

Table (MT) – similar to a page table

• Subsequent accesses to the same spatial reference will reach the same system (using MT) as long as it is located in the same space region

{space, property, index}{space, property, index} {unique_address, location}{unique_address, location}

Page 49: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

49

Reference consistency example (1)

Left HillLeft Hill Right HillRight Hill

{Left_Hill:robot[0]}.move = ON;{Left_Hill:robot[0]}.move = ON;

r2r2r7r7r5r5

Page 50: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

50

Reference consistency example (2)

Left HillLeft Hill Right HillRight Hill

r2r2r7r7

{Left_Hill:robot[0]}.move = OFF;{Left_Hill:robot[0]}.move = OFF;

Page 51: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

51

Space casting (1)

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

Left HillLeft Hill Right HillRight Hill

r7r7

Page 52: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

52

Space casting (2)

Left HillLeft Hill Right HillRight Hill

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

r7r7

Page 53: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

53

From indoor to outdoor computing

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

Mapping TableMapping Table

??

Page 54: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

54

Bounding the access time

• How to bound the time to access a spatial reference?– Systems may move, go out of space, or disappear

• Solution: associate an explicit timeout with each spatial reference access

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

Page 55: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

55

for(i=0; i<1000; i++) try{ if ({Left_Hill:motion[i], timeout}.detect > Max_motion) Max_motion = {Left_Hill:motion[i], timeout}.detect; Max_id = i; }catch(TimeoutException e) break; intrusionSpace = rangeOf({Left_Hill:motion[Max_id].location}, Range); {intrusionSpace:robot[0]}.camera = ON; {intrusionSpace:robot[0]}.focus = {Left_Hill:motion[Max_id].location};

Spatial programming example- Find the sensor that detectedthe “strongest” motion on Left Hill- Turn on a camera in the proximity of this sensor

Left HillLeft Hill Right HillRight Hill

Page 56: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

56

Spatial Programming implemented on top of Smart Messages

• Next

– Overview of Smart Messages

– Few implementation details

Page 57: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

57

“Dumb” messages vs. “smart” messages

Data migrationData migration

Lunch:Lunch:

AppetizerAppetizerEntreeEntreeDessertDessert

Execution migrationExecution migration

Page 58: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

58

Smart Messages at a glance

• User-defined distributed applications

• Composed of code bricks, data bricks, and

execution control state

• Execute on nodes of interest named by properties

• Migrate between nodes of interest

• Self-route at every node in the path during

migrations

Page 59: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

59

Cooperative node architecture

NetworkNetwork

SMSMPlatformPlatform

AdmissionAdmissionManagerManagerAdmissionAdmissionManagerManager

NetworkNetworkSMSM SMSM

Operating System & I/OOperating System & I/O

CodeCodeCacheCacheCodeCodeCacheCache

VirtualVirtualMachineMachine

VirtualVirtualMachineMachine

Tag Tag SpaceSpace

Tag Tag SpaceSpace

SM ReadySM ReadyQueueQueue

AuthorizationAuthorizationAuthorizationAuthorization

Page 60: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

60

SM execution at a node

• Takes place over a virtual machine

• Non-preemptive, but time bounded

• Ends with a migration, or terminates

• During execution, SMs can– Spawn new SMs

– Create smaller SMs out of their code and data bricks

– Access the tag space

– Block on a tag to be updated (update-based synchronization)

Page 61: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

61

Tag space

• Collection of application tags and I/O tags– Essentially, tags are (name, value) pairs

• Application tags: persistent memory across SM executions

• I/O tags: access to operating system and I/O subsystem

• Tags used for– Content-based naming migrate(tag)

– Inter-SM communication write(tag, data), read(tag)

– Synchronization block(tag, timeout)

– I/O access read(temperature)

Page 62: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

62

Protection domains for tag space

• Owner: SM that creates the tag

• Family: all SMs having a common ancestor with the SM that owns the tag

• Origin: all SMs created on the same node as the family originator of the tag owner

• Code: all SMs carrying a specific code brick

• Others: all the other SMs

FamilyFamily

CodeCodeOriginOrigin

Others

OwnerOwner

Page 63: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

63

Access control example (code-based protection domain)

Node5

Node3 Node4SM2SM2

SM2

C2 Cr

Node1 Node2

CodeBricks

Tag

Owner = SM1[Hash(Cr), RW]

SM1C1 Cr

SM1 SM1SM3

C3 C4

Access permission granted for SM2Access permission denied for SM3

Cr = Same routing used by SM1 and SM2

Page 64: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

64

SM admission

• Ensures progress for all SMs in the network

• Prevents SMs from migrating to nodes that cannot provide enough resources

• SMs specify lower bounds for resource requirements (e.g., memory, bandwidth)

• SMs accepted if the node can satisfy these requirements

• More resources can be granted according to admission policy– If not granted, SMs are allowed to migrate

Page 65: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

65

Application example

n=0while (n<NumTaxis) migrate(Taxi); if (readTag(Available)) writeTag(Available, false); writeTag(Location, myLocation); n++;

n=0n=0

Taxi Taxi

n=0n=0 n=0n=0 n=1n=1 n=1n=1 n=2n=2

need2 taxis

data brick

application code brick

routing code brick

SMSM

Page 66: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

66

migrate() – migrates application to next node of interest– names nodes by tags– implements routing algorithm

sys_migrate()– one hop migration– used by migrate to implement routing

SM migrationmigrate(Taxi)

sys_migrate(2) sys_migrate(3) sys_migrate(4)

TaxiTaxi

1 2 3 4

Page 67: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

67

NetworkNetwork

Routing example

1 2 i

RouteToTaxi = 2 TaxiRouteToTaxi = ?

migrate(Taxi){ while(readTag(Taxi) == null) if (readTag(RouteToTaxi)) sys_migrate(readTag(RouteToTaxi)); else create_SM(DiscoverySM, Taxi); createTag(RouteToTaxi, lifetime, null); block_SM(RouteToTaxi, timeout);}

Page 68: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

68

NetworkNetwork

Routing example

1 2 i

RouteToTaxi = 2 TaxiRouteToTaxi = ?RouteToTaxi = j

migrate(Taxi){ while(readTag(Taxi) == null) if (readTag(RouteToTaxi)) sys_migrate(readTag(RouteToTaxi)); else create_SM(DiscoverySM, Taxi); createTag(RouteToTaxi, lifetime, null); block_SM(RouteToTaxi, timeout);}

Page 69: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

69

NetworkNetwork

Routing example

1 2 i

RouteToTaxi = 2 TaxiRouteToTaxi = ?RouteToTaxi = j

migrate(Taxi){ while(readTag(Taxi) == null) if (readTag(RouteToTaxi)) sys_migrate(readTag(RouteToTaxi)); else create_SM(DiscoverySM, Taxi); createTag(RouteToTaxi, lifetime, null); block_SM(RouteToTaxi, timeout);}

Page 70: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

70

SM self-routing• SMs carry the routing and execute it at each node

• Routing information stored in tag space

• SMs control their routing

– Select routing algorithm (migrate primitive)

• Multiple library implementations

• Implement a new one

– Change routing algorithm during execution in response to

• Adverse network conditions

• Application’s requirements

Page 71: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

71

Spatial programming using Smart Messages

• SP application translates into an SM– Spatial reference access translates into an SM

migration to the mapped node

– Embedded system properties: Tags

• SM self-routes using geographical routing and content-based routing

• Reference consistency− Unique addresses (stored in mapping table) are

unique tags created at nodes

− SM carries the mapping table

Page 72: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

72

Max_motion = {Left_Hill:motion[1], timeout}.detect;

SP to SM translation: example

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(detect);else throw TimeoutException

{Left_Hill,motion,1} {yU78GH5,location}MappingTable

CodeBrick

Left HillLeft Hill Right HillRight Hill

Page 73: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

73

Prototype implementation• SM implemented over modified version of Sun’s

Java K Virtual Machine– Small memory footprint (160KB)

• SM and tag space primitives implemented inside virtual machine as native methods (efficiency)

• I/O tags: GPS location, neighbor discovery, image capture, light sensor, system status

Ad hoc networks ofHP iPAQ PDAs running Linux

Page 74: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

74

Lightweight migration • Traditional process migration difficult

– Strong coupling between execution entity and host

– Needs to take care of operating system state (e.g., open sockets, file descriptors)

• Tag space decouples the SM execution state from the operating system state

• SM migration transfers only– Data bricks explicitly specified by programmer

– Minimal execution control state required to resume the SM at the next instruction (e.g., instruction pointer, operand stack pointer)

Page 75: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

75

Summary

• Spatial Programming makes outdoor

distributed computing simple

– Volatility, mobility, configuration dynamics, ad

hoc networking are hidden from programmer

• Implementation on top of Smart Messages

– Easy to deploy new applications in the network

– Quick adaptation to highly dynamic network

configurations

• Acknowledgments: Liviu Iftode, Porlin Kang

Page 76: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Syllabus

Pervasive Computing, Spatial Computing Example Scenarios

Overview of Spatial Approaches Three spatial programming models:

Spatial Programming / Smart Messages TOTA / Field-based Coordination Proto / Amorphous Medium abstraction

76

Page 77: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Museum case study application

I would like to see the

Monna Lisa, avoiding the

queues…I’ve got lost! How

can I rejoin my friends?

77

Page 78: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The meeting task

• A Group a tourist want to meet somewhere within the building.

• The “classic” solution – general context information– Involve rather complex algorithms to decide what to do– If something changes (e.g. a corridor is closed) the solution

has to be recomputed• Our proposal

– Express context by means of a “red carpet” leading to the meeting room.

– How to represent the “red carpet”?

78

Page 79: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The Co-Fields model• Contextual information is expressed by means of distributed data-

structures spread in the environment (i.e. fields). Agent move and act being driven by these fields

• Agents’ combine perceived fields in a, so called, coordination field that encodes their actual application task. Then, they act being driven by the resulting values and gradient.

• The coordination policy is encoded into fields’ waveform, in the way in which agents combine perceived fields and in the way in which they react to the fields.

Agent actions change fields

Fields drive agent actions

Feedback cycle

79

Page 80: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Meeting in Co-Fields

Field generated by each single tourist

Coordination Field obtained by taking the field with the greatest magnitude – farther agent

80

Page 81: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Benefits• Designing the application becomes trivial. Just compute the coordination

field and move following the gradient downhill.

• The solution is adaptive. If a tourist gets trapped somewhere, then the meeting room automatically get closer to the unlucky tourist.

• Supposing that fields distributed data structures are maintained coherent despite environment dynamism, then the application is robust to closed corridors, etc.

j

nij

X

tXXXcoordv

dt

dx

),,...,,( 21

81

Page 82: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Other applications• Avoid queues

Room Generated Field

Building Plan

Crowd Field

Building Plan

82

Page 83: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA middleware• Distributed tuples injected and spread in

the network implementing the concept of fields.T=(C,P,M)

EVENT INTERFACE

Application

TOTA ENGINE

TOTA API

Operating System

Network

STORED TUPLES

83

Page 84: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

84

Page 85: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

85

Page 86: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

86

Page 87: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

0

87

Page 88: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

0

1

1

88

Page 89: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

0

1

1

2

2

89

Page 90: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

0

1

1

2

2

3

90

Page 91: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

01

2

2

3

1

91

Page 92: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

The TOTA scenarioC = (value = “2”, color = “green”)P = (propagate to all nodes, decrease “value” for the first 2 hops then increase it, change color at every hop)

T=

2

1

1

0

01

2

2

3

2

3

1

92

Page 93: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

TOTA main algorithm

• Propagation is easy– Breadth-first, avoiding backward propagation

• Maintenance is difficult– We do not want to periodically re-propagate– We wish maintenance is localized near the

point where the network changes

93

Page 94: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 1

1

2

33

Given a Hop tuple X, we will call another tuple Y a supporting tuple of X if:1. Y belongs to the same distributed tuple as X2. Y is one-hop distant from X3. the value of Y is equal to the value of X minus one

X is in a safe-state if it has at least a supporting tuple

2 is in a safe-state, since it is supported by 1

Page 95: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 1

1

2

33

NOT SAFE!

Page 96: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 1

1

2

33

NOT SAFE!

NOT SAFE!

Page 97: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 1

1

Page 98: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 2

1

2

23

Page 99: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 2

1

2

23

NOT SAFE!

Page 100: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 2

1

2

23

NOT SAFE!

Page 101: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 2

1

2THERE’S A

HOLE!

Page 102: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Self-MaintenanceEXAMPLE 2

1

2

3

4

PROPAGATE!

Page 103: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.
Page 104: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Coding the meeting example 1/4

public class MeetAgent extends AbstractAgent {

private static final int speed = 30;

private PeerInterface_ApplicationSide peer;

private TotaMiddleware tota;

public MeetAgent(PeerInterface_ApplicationSide peer) {

this.peer = peer;

tota = new TotaMiddleware(peer);

}

104

Page 105: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Coding the meeting example 2/4

public void step(int time) {

tota.step(time);

// inject the meeting tuple

if(time == 0) {

TotaTuple t = new GradientTuple();

t.setContent("<content=meet>"); // this notation is mandatory

tota.inject(t);

}

if(time > 0) {

int[] dir = getDirection();

if(dir != null)

move(dir[0],dir[1]);

}

}

105

Page 106: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Coding the meeting example 3/4

private int[] getDirection() {

// read the local tuple space

GradientTuple mt = new GradientTuple();

mt.setContent("<content=meet>");

// read the local tuple space

Vector local = tota.read(mt);

// look in the local tuple space, the meet tuple with the highest hop counter

int maxi = 0;

GradientTuple maxt = (GradientTuple)local.get(0);

for(int i=1; i<local.size(); i++) {

GradientTuple t = (GradientTuple)local.get(i);

if(maxt.hop < t.hop)

maxt = t;

}

106

Page 107: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Coding the meeting example 4/4

// look in the neighbor tuple spaces for neighbor

// having a lower value of the max tuple

GradientTuple tofollow = null;

Vector remote = tota.readOneHop(mt);

for(int i=0; i<remote.size(); i++) {

GradientTuple t = (GradientTuple)remote.get(i);

if(t.id.equals(maxt.id) && t.hop < maxt.hop) {

if(tofollow==null || (tofollow.hop > t.hop))

tofollow = t;

}

}

return getDirection(tofollow.from);

}

107

Page 108: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

108

Page 109: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Summary

• Field-based data structures are useful to represent context:– in a wide range of scenarios– so that it is easily usable by services

• TOTA tuples are robust to dynamic spatial computer and can be easily programmed

• Download and play with TOTA– http://polaris.ing.unimo.it/tota/download.html

109

Page 110: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Syllabus

Pervasive Computing, Spatial Computing Example Scenarios

Overview of Spatial Approaches Three spatial programming models:

Spatial Programming / Smart Messages TOTA / Field-based Coordination Proto / Amorphous Medium abstraction

110

Page 111: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

111

Example: mobile streaming

Page 112: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

112

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 113: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

113

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 114: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

114

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 115: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

115

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 116: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

116

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 117: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

117

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 118: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

118

Geometric program: channel

Desti-nation

Source

(cf. Butera)

Page 119: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

119

Why use continuous space?

Simplicity Scaling & Portability Robustness

(we'll come back to this in a bit...)

Page 120: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

120

Amorphous medium

Continuous space & timeInfinite number of devicesSee neighbors' past state

Approximate with:Discrete network of devicesSignals transmit state

neighborhood

device

Page 121: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

121

Computing with fields

sourcedestinatio

n

gradient

distance

gradient

<=

+

dilate

width

Page 122: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

122

Computing with fields

sourcedestinatio

n

gradient

distance

gradient

<=

+

dilate

width

37

10

Page 123: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

123

Diving into the details

•Let's build this up using the Proto simulator, •one piece at a time...

•(break to work w. simulator)

Page 124: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

124

Proto(def gradient (src) ...)(def distance (src dst) ...)(def dilate (src n) (<= (gradient src) n))(def channel (src dst width) (let* ((d (distance src dst)) (trail (<= (+ (gradient src) (gradient dst)) d))) (dilate trail width)))

neighborhood

device

DeviceKernel

evaluation

global to localcompilation

discreteapproximation

platformspecificity &optimization

Global Local D

iscrete

Page 125: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

125

Proto's families of primitivesPointwise Restriction

Feedback Neighborhood

+restric

t

+

741

delay

48

any-hood

nbr

Page 126: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

126

Modulation by restriction

sourcedestinatio

ncoord

channel

10

gradcast

10

(5, 7

)

Page 127: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

127

In simulation...

Page 128: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

128

Why use continuous space?

Simplicity Scaling & Portability Robustness

150 devices2000 devices

Page 129: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

129

Example: intrusion detectionLeft HillLeft Hill Right HillRight Hill

Mobile robotwith camera

Motion Sensor

Use channel to stream intruder information

Page 130: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

130

Example: museum traffic control

Page 131: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

131

Weaknesses

Functional programming scares people Programmers can break the abstraction No dynamic allocation of processes No formal proofs available for quality of

approximation in a composed program

(active research on last two)

Page 132: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

132

Summary

Amorphous Medium abstraction simplifies programming of space-filling networks

Proto has four families of space and time operations, compiles global descriptions into local actions that approximate the global

Geometric metaphors allow complex spatial computing problems to be solved with very short programs.

Page 133: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Conclusions

• New and exciting research area!• Many pervasive computing scenarios reflect spatial

computers concepts• Many research approaches exist to programming

pervasive application for spatial computing• Still there is a lot of open issues to be addressed:

– More software engineering– More real-world applications– Better definition and management of “emergent” behaviors and

properties

133

Page 134: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Some References

• C. Borcea and D. Iyer and P. Kang and A. Saxena and L. Iftode, Spatial programming using smart messages: Design and implementation, IEEE International Conference on Distributed Computing Systems. Tokio, Japan, 2004.

• O. Riva, T. Nadeem, C. Borcea, L. Iftode, Context-aware Migratory Services in Ad Hoc Networks, IEEE Transactions on Mobile Computing 6(12):34-33, 2007.

• M. Mamei, F. Zambonelli, Programming Pervasive and Mobile Computing Applications: the TOTA Approach, ACM Transaction on Software Engineering and Methodology, 2008, to appear

• M. Mamei, F. Zambonelli, L. Leonardi, Co-Fields: A Physically Inspired Approach to Distributed Motion Coordination, IEEE Pervasive Computing, 3(2):52-61, 2004.

• J. Bachrach, J. Beal, T. Fujiwara, Continuous Space-Time Semantics Allow Adaptive Program Execution. IEEE SASO 2007, Cambridge (MA) , USA, 2007.

• J. Beal, J. Bachrach, D. Vickery, M. Tobenkin, Fast Self-Healing Gradients, ACM Symposium on Applied Computing, Fortaleza, Brazil, 2008.

134

Page 135: Spatial Approaches to Pervasive Computing Tutorial at IEEE SASO 2008 Jacob Beal (BBN Technologies) jakebeal@bbn.com Jonathan Bachrach (MIT) jrb@csail.mit.edu.

Thanks for your attention!

135