google云计算系列课程第一讲介绍.ppt
《google云计算系列课程第一讲介绍.ppt》由会员分享,可在线阅读,更多相关《google云计算系列课程第一讲介绍.ppt(37页珍藏版)》请在冰豆网上搜索。
DistributedComputingSeminar,Lecture1:
IntroductiontoDistributedComputing&SystemsBackground,ChristopheBisciglia,AaronKimball,&SierraMichels-SlettvetSummer2007,Exceptwhereotherwisenoted,thecontentsofthispresentationareCopyright2007UniversityofWashingtonandarelicensedundertheCreativeCommonsAttribution2.5License.,CourseOverview,5lectures1Introduction2TechnicalSide:
MapReduce&GFS2Theoretical:
AlgorithmsfordistributedcomputingReadings+QuestionsnightlyReadings:
http:
/http:
/,Outline,IntroductiontoDistributedComputingParallelvs.DistributedComputingHistoryofDistributedComputingParallelizationandSynchronizationNetworkingBasics,ComputerSpeedup,MooresLaw:
“Thedensityoftransistorsonachipdoublesevery18months,forthesamecost”(1965),Image:
TomsHardwareandnotsubjecttotheCreativeCommonslicenseapplicabletotherestofthiswork.,Image:
TomsHardware,Scopeofproblems,Whatcanyoudowith1computer?
Whatcanyoudowith100computers?
Whatcanyoudowithanentiredatacenter?
Distributedproblems,Renderingmultipleframesofhigh-qualityanimation,Image:
DreamWorksAnimationandnotsubjecttotheCreativeCommonslicenseapplicabletotherestofthiswork.,Distributedproblems,Simulatingseveralhundredorthousandcharacters,HappyFeetKingdomFeatureProductions;LordoftheRingsNewLineCinema,neitherimageissubjecttotheCreativeCommonslicenseapplicabletotherestofthework.,Distributedproblems,Indexingtheweb(Google)SimulatinganInternet-sizednetworkfornetworkingexperiments(PlanetLab)Speedingupcontentdelivery(Akamai),Whatisthekeyattributethatalltheseexampleshaveincommon?
Parallelvs.Distributed,Parallelcomputingcanmean:
VectorprocessingofdataMultipleCPUsinasinglecomputerDistributedcomputingismultipleCPUsacrossmanycomputersoverthenetwork,ABriefHistory1975-85,ParallelcomputingwasfavoredintheearlyyearsPrimarilyvector-basedatfirstGraduallymorethread-basedparallelismwasintroduced,Image:
ComputerPicturesDatabaseandCrayResearchCorpandisnotsubjecttotheCreativeCommonslicenseapplicabletotherestofthiswork.,“Massivelyparallelarchitectures”startrisinginprominenceMessagePassingInterface(MPI)andotherlibrariesdevelopedBandwidthwasabigproblem,ABriefHistory1985-95,ABriefHistory1995-Today,Cluster/gridarchitectureincreasinglydominantSpecialnodemachineseschewedinfavorofCOTStechnologiesWeb-wideclustersoftwareCompanieslikeGoogletakethistotheextreme,Parallelization&Synchronization,ParallelizationIdea,Parallelizationis“easy”ifprocessingcanbecleanlysplitintonunits:
ParallelizationIdea
(2),Inaparallelcomputation,wewouldliketohaveasmanythreadsaswehaveprocessors.e.g.,afour-processorcomputerwouldbeabletorunfourthreadsatthesametime.,ParallelizationIdea(3),ParallelizationIdea(4),ParallelizationPitfalls,Butthismodelistoosimple!
Howdoweassignworkunitstoworkerthreads?
Whatifwehavemoreworkunitsthanthreads?
Howdoweaggregatetheresultsattheend?
Howdoweknowalltheworkershavefinished?
Whatiftheworkcannotbedividedintocompletelyseparatetasks?
Whatisthecommonthemeofalloftheseproblems?
ParallelizationPitfalls
(2),Eachoftheseproblemsrepresentsapointatwhichmultiplethreadsmustcommunicatewithoneanother,oraccessasharedresource.Goldenrule:
Anymemorythatcanbeusedbymultiplethreadsmusthaveanassociatedsynchronizationsystem!
WhatisWrongWithThis?
Thread1:
voidfoo()x+;y=x;,Thread2:
voidbar()y+;x+=3;,Iftheinitialstateisy=0,x=6,whathappensafterthesethreadsfinishrunning?
Multithreaded=Unpredictability,Whenwerunamultithreadedprogram,wedontknowwhatorderthreadsrunin,nordoweknowwhentheywillinterruptoneanother.,Thread1:
voidfoo()eax=memx;inceax;memx=eax;ebx=memx;memy=ebx;,Thread2:
voidbar()eax=memy;inceax;memy=eax;eax=memx;addeax,3;memx=eax;,Manythingsthatlooklike“onestep”operationsactuallytakeseveralstepsunderthehood:
Multithreaded=Unpredictability,Thisappliestomorethanjustintegers:
PullingworkunitsfromaqueueReportingworkbacktomasterunitTellinganotherthreadthatitcanbeginthe“nextphase”ofprocessingAllrequiresynchronization!
SynchronizationPrimitives,Asynchronizationprimitiveisaspecialsharedvariablethatguaranteesthatitcanonlybeaccessedatomically.Hardwaresupportguaranteesthatoperationsonsynchronizationprimitivesonlyevertakeonestep,Semaphores,AsemaphoreisaflagthatcanberaisedorloweredinonestepSemaphoreswereflagsthatrailroadengineerswouldusewhenenteringasharedtrack,Onlyonesideofthesemaphorecaneverbered!
(Canbothbegreen?
),Semaphores,set()andreset()canbethoughtofaslock()andunlock()Callstolock()whenthesemaphoreisalreadylockedcausethethreadtoblock.Pitfalls:
Must“bind”semaphorestoparticularobjects;mustrememberto