SlideShare a Scribd company logo
Loosely-coupled Distributed Reactive
      Programming in Mobile Ad Hoc Networks
      Andoni Lombide Carreton, Stijn Mostinckx,
      Tom Van Cutsem and Wolfgang De Meuter




      Department of Computer Science
      Vrije Universiteit Brussel

      48th International Conference on Objects, Models, Components, Patterns -- TOOLS 2010
      June 28 - July 2 2010
      Malàga, Spain

Tuesday 29 June 2010
The mobile ticket trader application




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks




                                              Mobile devices




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                              Mobile devices




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                                   Mobile devices




                                        Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                                    Mobile devices




              Spontaneous interactions



                                         Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks
                       Scarce infrastructure
                                                          Mobile devices




              Spontaneous interactions



                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks
                       Scarce infrastructure
                                                          Mobile devices



 Representation of physical objects




              Spontaneous interactions



                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions




                                          Distributed
                                   Event-driven Architecture

          Scarce infrastructure


                                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

          Scarce infrastructure


                                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

          Scarce infrastructure

                                      ecent ralized
                                    D                          Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                       Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                      Res
                                                            ilien
          Scarce infrastructure                                  t
                                      ecent ralized
                                    D                                Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                         Mobile devices



      Spontaneous interactions
                                              Event streams

                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                        Res
                                                              ilien
          Scarce infrastructure                                    t
                                      ecent ralized
                                    D                                  Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                                   Mobile devices


                                              Event streams
      Spontaneous interactions
                                                                       as ting
                                                               ro adc
                                            overy             B
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                        Res
                                                              ilien
          Scarce infrastructure                                    t
                                      ecent ralized
                                    D                                            Intermittent connectivity




Tuesday 29 June 2010
Distributed Event-driven Architecture

      • Spontaneous discovery of nearby peers
        and their ticket offers


      • Disconnection/reconnection


      • Location of interesting peers changed


      • Own location changed


      • Price of interesting ticket offers changed




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                       “do m immediately”



                             obj.m()

                       obj




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                              “do m eventually”



                           obj<-m()




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                              “do m eventually”



                           obj<-m()




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




                         when: future becomes: { |value|
                           // process reply
                         }


Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




                         when: future becomes: { |value|
                           // process reply
                         }


Tuesday 29 June 2010
Publishing & discovering objects by topic


                                     ticketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                      ticketVendor




              deftype TicketVendor   deftype TicketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
    when: ticketVendor disconnected: {
       // React on disappearance
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
    when: ticketVendor disconnected: {
       // React on disappearance
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
                                                          covery
    when: ticketVendor disconnected: {
       // React on disappearance
                                              Ad H oc Dis
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
                                                          covery
    when: ticketVendor disconnected: {
       // React on disappearance
                                              Ad H oc Dis
    }
    when: ticketVendor reconnected: {                      alized
       // React on reappearance                   D ecentr
    }}
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




                       Res
                          ilien
                               t
          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Ambient References




                                                                      ting
                       werchterVendors
                                                                   as
                                                             ro adc
                                                            B


             def werchterVendors := ambient: TicketVendor where: { |tv|
                tv.event == “Rock Werchter”
             };

             whenAll: werchterVendors<-getLocation()@Expires(5.seconds)
               becomes: { |locations|
                 // Update the map GUI with the locations
               }
Tuesday 29 June 2010
Ambient References




                                                                      ting
                       werchterVendors
                                                                   as
                                                             ro adc
                                                            B


             def werchterVendors := ambient: TicketVendor where: { |tv|
                tv.event == “Rock Werchter”
             };

             whenAll: werchterVendors<-getLocation()@Expires(5.seconds)
               becomes: { |locations|
                 // Update the map GUI with the locations
               }
Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
                       def Coordinate := isolate: {
                         def latitude := 0;
                         def longitude := 0;

                            def distanceTo(anotherCoordinate) {
                               // Compute via Haversine formula
                            };

                            def @Mutator update(newLatitude, newLongitude) {
                               latitude := newLatitude;
                               longitude := newLongitude;
                            };
                       };

                       def GPS_Location := makeReactive(Coordinate.new());

                       GPS.addLocationObserver: { |lat, lon|
                                                                   GPS_Location
                          GPS_Location.update(lat, lon)
                       };
Tuesday 29 June 2010
AmbientTalk/R
                       def Coordinate := isolate: {
                         def latitude := 0;
                         def longitude := 0;

                            def distanceTo(anotherCoordinate) {
                               // Compute via Haversine formula
                            };

                            def @Mutator update(newLatitude, newLongitude) {
                               latitude := newLatitude;
                               longitude := newLongitude;
                            };                                      Event streams
                       };

                       def GPS_Location := makeReactive(Coordinate.new());

                       GPS.addLocationObserver: { |lat, lon|
                                                                   GPS_Location
                          GPS_Location.update(lat, lon)
                       };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                               vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude
                                                                                         vendorLocation

                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude
                                                                                         vendorLocation

                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations



                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations

                        GPS_Location

                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations

                        GPS_Location

                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations



                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
       def findOffers(event, maxPrice, maxDistance) {
         // Subscribe to ticket offers
         def @All allNearbyOffers := ambientBehavior: TicketOfferT timeout: 2000;

            // Filter out interesting ticket offers
            allNearbyOffers.filter: { |offer|
              (offer.eventName == event).and: {
               (offer.price <= maxPrice).and: {
                 GPS_Location.distanceTo(offer.location) <= maxDistance }}};
       };
                                               • Disconnection/reconnection


                                               • Location of interesting peers changed
def werchterVendors :=
  findOffers(“Rock Werchter”, 120, 500);
                                               • Own location changed
gui.updateWithOffers(werchterVendors);

                                               • Price of interesting ticket offers changed
Tuesday 29 June 2010
Reactive Queries




                        werchterVendors




     def werchterVendors := ambient: TicketVendor where: { |tv|
        tv.event == “Rock Werchter”
     };

     def locations := werchterVendors<-getLocation()@Refresh(2.seconds);

     locations.each:
       { |coordinates| GUI.showLocationOnMap(coordinates) };

Tuesday 29 June 2010
Reactive Queries




                        werchterVendors




     def werchterVendors := ambient: TicketVendor where: { |tv|
        tv.event == “Rock Werchter”
     };

     def locations := werchterVendors<-getLocation()@Refresh(2.seconds);

     locations.each:
       { |coordinates| GUI.showLocationOnMap(coordinates) };

Tuesday 29 June 2010
Limitations and Future Work

      • AmbientTalk/R yields a higher computational overhead than plain
        AmbientTalk.


      • Event message order preservation not guaranteed on very fine-grained levels
        over different communication partners.


      • No real-time guarantees.


      • Event consumers can only create and cancel their distributed dependencies:
        they cannot limit the number of propagated events.




Tuesday 29 June 2010
Conclusion

      • Decentralized publish/subscribe architecture based on UDP broadcasting
        allows spontaneous and loosely-coupled group interactions.


      • Reactive interpreter allows reacting to and processing of events without
        relying on “callback-spaghetti”.


      • Ambient behaviors and reactive queries reconcile both programming styles.


      • Event propagation happens with asynchronous messages among distributed
        event loops: no concurrency issues and resilient to intermittent network
        connectivity.




                http://soft.vub.ac.be/soft/research/amopcop
Tuesday 29 June 2010

More Related Content

PDF
Visual Dataflow Coordination2010
PDF
Future Internet Tutorial - Requirements and Challenges - IWT 2011
PPT
Stefan Decker Keynote at CSHALS
PPTX
Embedded & Tangible Interaction Design
PPT
RBI paper, CHI 2008
PPTX
Telecom trends 261112
PDF
5 context aware services
PPTX
Network of Excellence in Internet Science (Multidisciplinarity and its Implic...
Visual Dataflow Coordination2010
Future Internet Tutorial - Requirements and Challenges - IWT 2011
Stefan Decker Keynote at CSHALS
Embedded & Tangible Interaction Design
RBI paper, CHI 2008
Telecom trends 261112
5 context aware services
Network of Excellence in Internet Science (Multidisciplinarity and its Implic...

What's hot (20)

PDF
Towards the Integration of Spatiotemporal User-Generated Content and Sensor Data
PDF
Recasting The Net
PPTX
Presentatie The Internet of Things iBestuur Congres 2013 door Ben van Lier
PDF
Sara de freitas the gamification of everyday life - seserv se workshop june...
PDF
Issues of Information Semantics and Granularity in Cross-Media Publishing
PDF
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
PDF
SNViz: Analysis-oriented Visualization for the Internet of Things
POT
Tangible media ppt
PDF
The interactive and multimedia library
PDF
BEN Event - Guijarro
PDF
Cyber Worlds 2011 submission
PDF
Tangible &amp; Embodied Interaction @RSE11
PPT
Context Awareness in Mobile Computing
PPTX
Ws_INREDIS_Publicaciones_científicas_2009-2010
PDF
Future network architecture: requirements and challenges
PDF
ISMAR09 Paper
PDF
05 Living Labs and Smart Cities Alvaro Oliveira
PPT
Tangible User Interface Showcase
PPTX
Annotating Microblog Posts with Sensor Data for Emergency Reporting Applications
PPTX
When where why cloud
Towards the Integration of Spatiotemporal User-Generated Content and Sensor Data
Recasting The Net
Presentatie The Internet of Things iBestuur Congres 2013 door Ben van Lier
Sara de freitas the gamification of everyday life - seserv se workshop june...
Issues of Information Semantics and Granularity in Cross-Media Publishing
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
SNViz: Analysis-oriented Visualization for the Internet of Things
Tangible media ppt
The interactive and multimedia library
BEN Event - Guijarro
Cyber Worlds 2011 submission
Tangible &amp; Embodied Interaction @RSE11
Context Awareness in Mobile Computing
Ws_INREDIS_Publicaciones_científicas_2009-2010
Future network architecture: requirements and challenges
ISMAR09 Paper
05 Living Labs and Smart Cities Alvaro Oliveira
Tangible User Interface Showcase
Annotating Microblog Posts with Sensor Data for Emergency Reporting Applications
When where why cloud
Ad

Similar to Distributed Reactive Programming Tools2010 (19)

PDF
Piet Demeester - Future Internet
PDF
Io t features_and_architecture_2009
PPTX
Pervasive computing and its Security Issues
PPT
introduction of pervasive computing .ppt
PPTX
Ubiquitous Computing and Context-Aware Services
PPTX
Ubiquitious Computing: UX When There is No UI
PDF
Flyer co summit 2012 smarcos flyer indra
PDF
SMARCOS INDRA WP6 Poste Vehicles Domain Final
PDF
ISA11 - Mike Kuniavsky - Designing Smart Things
PPTX
Future Internet Enterprise Systems
PDF
Future Internet: Visions, Requirements, Key Ingredients, and Ongoing Research
PDF
Research Talk at Bell Labs - IoT System Architecture and Interactions
PPTX
Cyber security assocham
PDF
Maya
PDF
Rethinking Technology Edge - Valgeo 2011
PDF
Valgeo2011 rethinking tech edge
PDF
Iis Scenarios Revisited Curry Leuven0610
PDF
On Future Research Areas for ICT-enabled Governance
PDF
Cassandra framework a service oriented distributed multimedia
Piet Demeester - Future Internet
Io t features_and_architecture_2009
Pervasive computing and its Security Issues
introduction of pervasive computing .ppt
Ubiquitous Computing and Context-Aware Services
Ubiquitious Computing: UX When There is No UI
Flyer co summit 2012 smarcos flyer indra
SMARCOS INDRA WP6 Poste Vehicles Domain Final
ISA11 - Mike Kuniavsky - Designing Smart Things
Future Internet Enterprise Systems
Future Internet: Visions, Requirements, Key Ingredients, and Ongoing Research
Research Talk at Bell Labs - IoT System Architecture and Interactions
Cyber security assocham
Maya
Rethinking Technology Edge - Valgeo 2011
Valgeo2011 rethinking tech edge
Iis Scenarios Revisited Curry Leuven0610
On Future Research Areas for ICT-enabled Governance
Cassandra framework a service oriented distributed multimedia
Ad

Distributed Reactive Programming Tools2010

  • 1. Loosely-coupled Distributed Reactive Programming in Mobile Ad Hoc Networks Andoni Lombide Carreton, Stijn Mostinckx, Tom Van Cutsem and Wolfgang De Meuter Department of Computer Science Vrije Universiteit Brussel 48th International Conference on Objects, Models, Components, Patterns -- TOOLS 2010 June 28 - July 2 2010 Malàga, Spain Tuesday 29 June 2010
  • 2. The mobile ticket trader application Tuesday 29 June 2010
  • 3. Pervasive Computing and Mobile Ad Hoc Networks Tuesday 29 June 2010
  • 4. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Tuesday 29 June 2010
  • 5. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Tuesday 29 June 2010
  • 6. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Intermittent connectivity Tuesday 29 June 2010
  • 7. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 8. Pervasive Computing and Mobile Ad Hoc Networks Scarce infrastructure Mobile devices Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 9. Pervasive Computing and Mobile Ad Hoc Networks Scarce infrastructure Mobile devices Representation of physical objects Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 10. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions Distributed Event-driven Architecture Scarce infrastructure Intermittent connectivity Tuesday 29 June 2010
  • 11. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Scarce infrastructure Intermittent connectivity Tuesday 29 June 2010
  • 12. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Scarce infrastructure ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 13. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 14. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions Event streams overy o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 15. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Event streams Spontaneous interactions as ting ro adc overy B o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 16. Distributed Event-driven Architecture • Spontaneous discovery of nearby peers and their ticket offers • Disconnection/reconnection • Location of interesting peers changed • Own location changed • Price of interesting ticket offers changed Tuesday 29 June 2010
  • 17. Event Loop Concurrency in AmbientTalk Tuesday 29 June 2010
  • 18. Event Loop Concurrency in AmbientTalk “do m immediately” obj.m() obj Tuesday 29 June 2010
  • 19. Event Loop Concurrency in AmbientTalk “do m eventually” obj<-m() Tuesday 29 June 2010
  • 20. Event Loop Concurrency in AmbientTalk “do m eventually” obj<-m() Tuesday 29 June 2010
  • 21. Event Loop Concurrency in AmbientTalk ? future Tuesday 29 June 2010
  • 22. Event Loop Concurrency in AmbientTalk ? future when: future becomes: { |value| // process reply } Tuesday 29 June 2010
  • 23. Event Loop Concurrency in AmbientTalk ? future when: future becomes: { |value| // process reply } Tuesday 29 June 2010
  • 24. Publishing & discovering objects by topic ticketVendor Tuesday 29 June 2010
  • 25. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor Tuesday 29 June 2010
  • 26. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor Tuesday 29 June 2010
  • 27. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance when: ticketVendor disconnected: { // React on disappearance } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 28. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance when: ticketVendor disconnected: { // React on disappearance } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 29. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance covery when: ticketVendor disconnected: { // React on disappearance Ad H oc Dis } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 30. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance covery when: ticketVendor disconnected: { // React on disappearance Ad H oc Dis } when: ticketVendor reconnected: { alized // React on reappearance D ecentr }} Tuesday 29 June 2010
  • 31. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 32. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 33. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 34. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 35. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 36. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 37. Asynchronous communication ticketVendor Res ilien t when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 38. Ambient References ting werchterVendors as ro adc B def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; whenAll: werchterVendors<-getLocation()@Expires(5.seconds) becomes: { |locations| // Update the map GUI with the locations } Tuesday 29 June 2010
  • 39. Ambient References ting werchterVendors as ro adc B def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; whenAll: werchterVendors<-getLocation()@Expires(5.seconds) becomes: { |locations| // Update the map GUI with the locations } Tuesday 29 June 2010
  • 40. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 41. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 42. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 43. AmbientTalk/R def Coordinate := isolate: { def latitude := 0; def longitude := 0; def distanceTo(anotherCoordinate) { // Compute via Haversine formula }; def @Mutator update(newLatitude, newLongitude) { latitude := newLatitude; longitude := newLongitude; }; }; def GPS_Location := makeReactive(Coordinate.new()); GPS.addLocationObserver: { |lat, lon| GPS_Location GPS_Location.update(lat, lon) }; Tuesday 29 June 2010
  • 44. AmbientTalk/R def Coordinate := isolate: { def latitude := 0; def longitude := 0; def distanceTo(anotherCoordinate) { // Compute via Haversine formula }; def @Mutator update(newLatitude, newLongitude) { latitude := newLatitude; longitude := newLongitude; }; Event streams }; def GPS_Location := makeReactive(Coordinate.new()); GPS.addLocationObserver: { |lat, lon| GPS_Location GPS_Location.update(lat, lon) }; Tuesday 29 June 2010
  • 45. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 46. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 47. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 48. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 49. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude vendorLocation gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 50. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude vendorLocation gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 51. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 52. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations GPS_Location vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 53. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations GPS_Location vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 54. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 55. Ambient Behaviors def findOffers(event, maxPrice, maxDistance) { // Subscribe to ticket offers def @All allNearbyOffers := ambientBehavior: TicketOfferT timeout: 2000; // Filter out interesting ticket offers allNearbyOffers.filter: { |offer| (offer.eventName == event).and: { (offer.price <= maxPrice).and: { GPS_Location.distanceTo(offer.location) <= maxDistance }}}; }; • Disconnection/reconnection • Location of interesting peers changed def werchterVendors := findOffers(“Rock Werchter”, 120, 500); • Own location changed gui.updateWithOffers(werchterVendors); • Price of interesting ticket offers changed Tuesday 29 June 2010
  • 56. Reactive Queries werchterVendors def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; def locations := werchterVendors<-getLocation()@Refresh(2.seconds); locations.each: { |coordinates| GUI.showLocationOnMap(coordinates) }; Tuesday 29 June 2010
  • 57. Reactive Queries werchterVendors def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; def locations := werchterVendors<-getLocation()@Refresh(2.seconds); locations.each: { |coordinates| GUI.showLocationOnMap(coordinates) }; Tuesday 29 June 2010
  • 58. Limitations and Future Work • AmbientTalk/R yields a higher computational overhead than plain AmbientTalk. • Event message order preservation not guaranteed on very fine-grained levels over different communication partners. • No real-time guarantees. • Event consumers can only create and cancel their distributed dependencies: they cannot limit the number of propagated events. Tuesday 29 June 2010
  • 59. Conclusion • Decentralized publish/subscribe architecture based on UDP broadcasting allows spontaneous and loosely-coupled group interactions. • Reactive interpreter allows reacting to and processing of events without relying on “callback-spaghetti”. • Ambient behaviors and reactive queries reconcile both programming styles. • Event propagation happens with asynchronous messages among distributed event loops: no concurrency issues and resilient to intermittent network connectivity. http://soft.vub.ac.be/soft/research/amopcop Tuesday 29 June 2010