DistributedSystems
AdhocandsensornetworksRikSarkar
UniversityofEdinburgh
Fall2018
Distributed Systems, Edinburgh, 2018
MobileandUbiquitouscompuEng
• Devices(computers)arecarriedbypeople(mobile)– Laptops,phones,watches…
• Theyareeverywhere– Carriedbypeople(mobile)– Embeddedintheenvironment
• Coffeemachines,cameras,sensorsforlightcontrol,elevators…
– Producelargeamountsofdata• Usage,sensing…
Distributed Systems, Edinburgh, 2018
Ubiquitous• Advantages:
– Therearecomputerseverywhere– Everythingis“smart”– PotenEallyusecomputaEonsonthesetomakethemevensmarter
• Challenges:– Therearemorethingstogowrong– Noteasytomakethingsworkwellcoherently– ConsistentplaSormsformanagingubiquitousdevicesdonotexist(yet)
– Devicesdonotinteroperateeasily
Distributed Systems, Edinburgh, 2018
Mobile
• Advantages:– Thesamedeviceiscarriedbytheperson–easytogiveconsistentservice
– InformaEonwhenever,wherevertheyneed– Deviceshavesensors–potenEalforsensingtheenvironmentandadapEng
• Disadvantages:– ConnecEvityischallenge:dataiscostly;networkdoesnotworkthesameway;mobilityinterfereswithcomunicaEon
– LimitedbaXery:can’tdotoomuchcommunicaEon– Howtomakeuseofsensors,notsowellunderstood
Distributed Systems, Edinburgh, 2018
ContextawarecompuEng
• AdaptcomputaEonstothecircumstances– Timeofday– Istheuserpresent?– Isthephoneinhandorinpocket– Scanforwifionlywhenindoors– Turnoffringwhenincinema,mee-ng…– RecognizeacEvityandbringuprelevantinformaEon
– …
Distributed Systems, Edinburgh, 2018
ContextawarecompuEng
• AdaptcomputaEonstothecircumstances• BasiccontextsareeasytoidenEfy,butitisnotalwaysclearhowtoadapt– Turndownvolumeatnight…butwhatifitisanimportantcall?
• Manycontextsareveryhardtodetectreliably
Distributed Systems, Edinburgh, 2018
OthercontextdetecEonexamples
• Indoor/outdoor• UsesoundtodetectuserinameeEng• Detecttransportmode(walking,car,bus,tram..)– Usingaccelerometer
• DetectpresenceofotherusersnearbyfromwifiacEvity
Distributed Systems, Edinburgh, 2018
ContextdetecEon
• Generallyhard• Concernsaboutprivacy:youdonotwanttosendcontextinformaEontoaserver
• PerhapsdistributedcomputaEoncanhelp– Usedatafrommanyphonestodetectcontext– Butagain,donotwanttosendalldatatoserver– Doasmuchofitaspossibleondevice–filter/processdataatsource
Distributed Systems, Edinburgh, 2018
Networkinginmobilesystems
• Difficulty:– Thenetworkgraphchanges– Anodeisnotalwaysconnectedtothesamerouter
• Examplesystem:Mobilead-hocnetworks– Ad-hoc:Unplanned– Devicessimplyconnecttonearbydevicesandroutepackets
– Alsoappliestosensornetworks
Distributed Systems, Edinburgh, 2018
RouEnginadhocwirelessnetworks
• Findroutebetweenpairsofnodeswishingtocommunicate.
• ProacEveprotocols:maintainrouEngtablesateachnodethatisupdatedaschangesinthenetworktopologyaredetected.
– Heavyoverheadwithhighnetworkdynamics(causedbylink/nodefailuresornodemovement).
– NotpracEcalfornetworksthatchangefrequently
Distributed Systems, Edinburgh, 2018
RouEnginadhocwirelessnetworks
• ReacEveprotocols:routesareconstructedondemand.NoglobalrouEngtableismaintained.
• Moreappropriatefornetworkswithhighrateofchanges
– AdhocondemanddistancevectorrouEng(AODV)– DynamicsourcerouEng(DSR)
Distributed Systems, Edinburgh, 2018
DynamicSourceRouEng(DSR)
• NodeSwantstosendamessagetonodeD• SiniEatesaaroutediscovery• Sfloodsthenetworkwithrouterequest(RREQ)message
• Eachnodeappendsitsownidtothemessage
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscoveryinDSR
• DesEnaEonDonreceivingthefirstRREQsendsaroutereply(RREP)
• RREPissentonarouteobtainedbyreversingtherouteinreceivedRREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
RouteDiscovery:RREQ
Distributed Systems, Edinburgh, 2018
When
• Whenalinkfails,anerrormessagewiththelinknameissentbacktoS.
• Sdeletesanyrouteusingthatlinkandstartsdiscovery.
Distributed Systems, Edinburgh, 2018
Routecaching
• Whenanodereceivesorforwardsamessage,itlearnsroutestoallnodesonthepath
• Advantage:– SmaynotneedtosendRREQ– IntermediatenodeonreceivingRREQ,canrespondwithcompleteroute
• Disadvantage:– Cachesmaybestale:StriesmanycachedroutesbeforestarEngadiscovery.Or,intermediatenodesreturnoutdatedinformaEon.
Distributed Systems, Edinburgh, 2018
DSR:SummaryAdvantages:• Routescomputedonlywhenneeded–goodforchanging
networks• Cachingcanmakethingsefficient• DoesnotcreateloopsDisadvantages• EnEreroutemustbecontainedinmessage:canbelongfor
largenetworks• FloodingcausescommunicaEontomanynodes• Stalecachescanbeaproblem• Notsuitablefornetworkswherechangesaretoofrequent
Distributed Systems, Edinburgh, 2018
AdhocOn-DemandDistanceVectorRouEng(AODV)
• MaintainsrouEngtablesatnodessothattherouteneednotbestoredinthemessage
• NoCaches:OnlyonerouteperdesEnaEon
Distributed Systems, Edinburgh, 2018
AODVRouteDiscovery
• SourcefloodsthenetworkDistributed Systems, Edinburgh, 2018
AODVRouteDiscovery
• Othernodescreateparentpointer• AnodeforwardsaRREQonlyonce
Dst NxtHp Dist
S S 1
Dst NxtHp Dist
S S 1 Dst NxtHp Dist
S S 1
Distributed Systems, Edinburgh, 2018
AODVRouteDiscovery
• Othernodescreateparentpointer• AnodeforwardsaRREQonlyonce
Dst NxtHp Dist
S S 1
Dst NxtHp Dist
S E 2
Distributed Systems, Edinburgh, 2018
AODVRouteDiscovery
• RREPisforwardedviareversepath
Dst NxtHp Dist
S E 2
Dst NxtHp Dist
S S 1
Dst NxtHp Dist
S F 3
Distributed Systems, Edinburgh, 2018
AODVRouteDiscovery
• RREPisforwardedviareversepath• Createsaforwardpath
Dst NxtHp Dist
S E 2
D D 1
Dst NxtHp Dist
S S 1
D F 2
Dst NxtHp Dist
S F 3
D D 0
Dst NxtHp Dist
S S 0
D E 3
Distributed Systems, Edinburgh, 2018
Routeexpiry
• ApathexpiresifnotusedforacertainEme.• IfanodeseesthatarouEngtableentryhasnotbeenusedbythisEme,itremovesthisentry
• Evenifthepathitselfisvalid• Goodfornetworkswithfrequentchanges• BadforstaEcandstablenetworks
Distributed Systems, Edinburgh, 2018
Cancreateloops
• AssumeC->Dlinkhasfailed,butAdoesnotknowbecausetheERRmessagewaslost
• CisnowtryingtofindpathtoD• ArespondssinceAthinksithasapath• Createsloop:C-E-A-B-C
Distributed Systems, Edinburgh, 2018
SequencenumbersinAODV
• IfAhasaroutetoD,Akeepsasequencenumber.
• Aincrementsthisnumberperiodically:tellshowoldtheinformaEonis
Distributed Systems, Edinburgh, 2018
Usingsequencenumbers
• Rule:sequencenumbermustincreasealonganyroute
Distributed Systems, Edinburgh, 2018
Sequencenumberruleavoidsloop
• Adoesnotreply,sinceitssequenceno.islessthanthatofC
Distributed Systems, Edinburgh, 2018
AODV
• RouEngtables,messagedoesnotcontainroute
• Freshroutespreferred• Oldunusedroutesexpire• StalerouteslessproblemaEc• Needssequencenumberstopreventloops• BeXerformoredynamic,changingenvironments
Distributed Systems, Edinburgh, 2018
RouEnginadhocnetworks
• ReacEveprotocols:routesareconstructedondemand.NoglobalrouEngtableismaintained.
• Moreappropriatefornetworkswithhighrateofchanges
– AdhocondemanddistancevectorrouEng(AODV)– DynamicsourcerouEng(DSR)
• Needflooding– Inefficientinlargenetworks
Distributed Systems, Edinburgh, 2018
GeographicalrouEng:UsinglocaEon
• GeographicalrouEngusesanode’slocaEontodiscoverpathtothatnode.
Distributed Systems, Edinburgh, 2018
x
y
Greedy Routing: Forward to the neighbor that is nearest to the destination
GeographicalrouEng
• AssumpEons:– NodesknowtheirowngeographicallocaEon– Nodesknowtheir1-hopneighbors– RouEngdesEnaEonsarespecified
geographically(alocaEon,orageographicalregion)
– EachpacketcanholdasmallamountofrouEnginformaEon.
Distributed Systems, Edinburgh, 2018
Sensornetwork
• Sensorsenabledwithwireless– Cancommunicatewithnearbysensors– CommunicaEontoserverrelaEvelycostly
• Lowpower,butlotsofdata– Notworthsendingeverythingtoserver
• Tryusethedatadirectlyinsidethenetwork– In-networkdistributedcompuEng
Distributed Systems, Edinburgh, 2018
Problem:Howtofindtherelevantdata?
• Atouristinaparkasks• “Whereistheelephant?”• Outofallthesensors/cameraswhichoneisclosetoanelephant?
Distributed Systems, Edinburgh, 2018
DatacentricrouEng• TradiEonalnetworkstrytoroutetoanIPaddress• FindpathtothenodewithaparEcularID• Butwhatifwetrytofinddata,notspecificnodes?
• Akerall,deliveringdataistheulEmategoalofrouEngandnetworks
• Datacentricstorage– Storagedependsonthedata(elephant,giraffe,song…)
• DatacentricrouEng(search)– Routetothedata
Distributed Systems, Edinburgh, 2018
DistributedDatabase
• InformaEonProducer– Canbeanywhereinthenetwork– Maybemobile– Manyproducersmaygeneratedataofthesametype
• UserorInformaEonConsumer– Canbeanywhere– Maybemany
Distributed Systems, Edinburgh, 2018
DistributedDatabase:Challenges
• Consumerdoesnotknowwheretheproduceris,andviceversa
• Needtosearch:Mustbefast,efficient
Basicmethods(e.g.usingfloods):• Push:Producerdisseminatesdata• Pull:Consumerlooksforthedata• Push-pull:Bothproducer,consumersearchforeach-other
Distributed Systems, Edinburgh, 2018
Distributedhashtables
• Useahashonthedata:h(song1.mp3)=node#26
• Anyonethathassong1.mp3informsnode#26• AnyonethatneedsSong1.mp3checkswithnode#26
• UsedinpeertopeersystemslikeChord,pastryetc
Distributed Systems, Edinburgh, 2018
GeographicHashTables• Contentbasedhashgivescoordinates:– h(lion)=(12,07)
• Producersendsmsgto(12,07)bygeographicrouEngandstoresdata
• Consumersendsmsgto(12,07)bygeographicrouEngandgetsdata
Distributed Systems, Edinburgh, 2018
GHT
• Whatifthereisnosensorat(12,07)?
• Usethesensornearesttoit
Distributed Systems, Edinburgh, 2018
Faulthandling• Whatifhomenodeadies?• Replicas(nodessurroundingahashlocaEon)haveaEmerthattriggersanewcheck
• Anewnodebecomeshome
Distributed Systems, Edinburgh, 2018
GHT
• Advantages– Simple– Handlesloadbalancingandfaults
• Disadvantages– NotdistancesensiEve:everyonehastogotohashnodeevenifproducerandconsumerareclose
– Ifadataisqueriedorupdatedoken,thatnodehasalotoftraffic–boXleneck
Distributed Systems, Edinburgh, 2018
RumorRouEng
• Producer:Senddataalongacurveorrandomwalk,leavedataorpointersonnodes
• Consumer:Routealonganothercurveorrandomwalk,hopetomeetdataorpointer
Distributed Systems, Edinburgh, 2018
RumorrouEng
• Eachnodemaintainsalistofevents• Addseventsastheyhappen
• Agents:Packetsthatcarryeventsinthenetwork– Aggregateeventsofeachnodetheypassthrough
• Agentsmoveinrandomwalk.From1-hopneighborsselectonethathasnotbeenvisitedrecently
Distributed Systems, Edinburgh, 2018
• D
Distributed Systems, Edinburgh, 2018
Mobile,Ad-hocandSensornetwork
• Adifficultmodel–leastinfrastructure,lowpowernodes,communicaEon/computaEonexpensive
• NotenErelyrealisEc• However,itmakesleastnumberofassumptons
– usefulasabasisfordevelopingdistributedprotocols/algorithms
– Whichcanthenbeenhancedusingavailableinfrastructureinspecificcases
Distributed Systems, Edinburgh, 2018
Emergingtechnologies
• IoT:localcomputaEonandcommunicaEonisimportant– Efficiency– Privacy
• DevicetodevicecommunicaEon– Comingin5G– Ad-hocnetworkstosupplementcellnetworks
Distributed Systems, Edinburgh, 2018