版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
分布式系統(tǒng)全冊(cè)配套完整課件3分布式系統(tǒng)課程課程范圍教材共13章,我們課程介紹12章;第一章:引言第二章—第九章:原理部分第十章—第十三章:范例基本內(nèi)容Chapter1
IntroductionChapter2
Communication(RPC/RMI/MOM)Chapter3DistributedComputingParadigmChapter4
Processes(虛擬化;代碼遷移的模型;進(jìn)程/處理機(jī)的分配方法)Chapter5NamingChapter6SynchronizationChapter7ConsistencyandReplication(DATA-CENTRIC/CLIENT-CENTRICCONSISTENCYMODELS)Chapter8FaultToleranceChapter9
SecurityChapter10DistributedFileSystemsChapter11
DistributedObject-basedSystemsChapter12
DistributedWeb-BasedSystems
基本要求基本概念;基本原理;應(yīng)用范例;IntroductionChapter11.1DefinitionofaDistributedSystemAdistributedsystemisacollectionofindependentcomputersthatappearstoitsusersasasinglecoherentsystem.硬件角度:各個(gè)計(jì)算機(jī)是自治的,通過(guò)網(wǎng)絡(luò)互聯(lián);軟件角度:用戶看到的是一臺(tái)邏輯計(jì)算機(jī)。(互聯(lián)、協(xié)作、單一視圖)
分布式計(jì)算是指在分布式系統(tǒng)上執(zhí)行的計(jì)算。諸如網(wǎng)絡(luò)服務(wù)和網(wǎng)絡(luò)應(yīng)用等。像WWW、Email、FTP、企業(yè)計(jì)算、聊天室和網(wǎng)絡(luò)游戲等。(并發(fā),并行,分布)
1.1ConceptofaDistributedComputing
分布式計(jì)算的最早形態(tài)出現(xiàn)在80年代末的Intel公司,他們利用局域網(wǎng)上工作站的空閑時(shí)間為芯片設(shè)計(jì)進(jìn)行計(jì)算。隨著Internet的迅速發(fā)展和普及,分布式計(jì)算的研究在90年代后達(dá)到了高潮?;ヂ?lián)網(wǎng)上的應(yīng)用本身就是一種分布式計(jì)算應(yīng)用。
1.1ConceptofaDistributedComputing
產(chǎn)生的背景:應(yīng)用驅(qū)動(dòng)和技術(shù)支撐.一、應(yīng)用驅(qū)動(dòng)1、客觀世界的組織活動(dòng)本身具有分布特性,例如:制造、銷售、銀行、倉(cāng)儲(chǔ)以及互聯(lián)網(wǎng)世界等——業(yè)務(wù)分布。2、性價(jià)比高、資源共享、堅(jiān)定性高和可伸縮性。二、技術(shù)支撐20世紀(jì)80年代中期,兩個(gè)技術(shù)的進(jìn)步在硬件上為分布式系統(tǒng)提供了基礎(chǔ):1、微處理機(jī)的出現(xiàn)(價(jià)格低廉)。2、高速網(wǎng)絡(luò)的出現(xiàn)?;ヂ?lián)網(wǎng)平臺(tái)的特征開(kāi)放性多變性動(dòng)態(tài)性無(wú)統(tǒng)一控制的“真”分布性節(jié)點(diǎn)的高度自治性和不可預(yù)測(cè)性節(jié)點(diǎn)鏈接的開(kāi)放性和靈活性網(wǎng)絡(luò)連接方式的多樣性使用方式的個(gè)性化和多樣性
人、設(shè)備和軟件的多重異構(gòu)性計(jì)算機(jī)技術(shù)的發(fā)展
大型機(jī)終端客戶機(jī)-服務(wù)器微機(jī)-局域網(wǎng)互聯(lián)網(wǎng)按需/普適計(jì)算第一階段第二階段第三階段第四階段初期普及階段更多專家以及一般用戶開(kāi)始使用,用戶要很好地使用需要深入了解計(jì)算機(jī)知識(shí)。對(duì)國(guó)民經(jīng)濟(jì)和社會(huì)發(fā)展的影響目前階段專家階段計(jì)算機(jī)僅供少數(shù)專家和專業(yè)人員使用,社會(huì)公眾很難用上。
公眾認(rèn)識(shí)階段因特網(wǎng)和Web時(shí)代,信息技術(shù)已在公眾中流行起來(lái),但用戶仍然需要知道一些計(jì)算機(jī)和信息技術(shù)的知識(shí)。廣泛普及階段用戶已經(jīng)看不見(jiàn)技術(shù),也不需要知道技術(shù),只要看得到技術(shù)帶來(lái)的好處。其他:云計(jì)算,物聯(lián)網(wǎng)等.時(shí)間(摘自李院士的報(bào)告)計(jì)算環(huán)境演化M-to-11-to-11-to-M專業(yè)人員有專業(yè)要求的人員任何人員MainframePCs/HandheldsLANInternetIoT…….CalculationsInformationServices計(jì)算為中心信息為中心用戶為中心計(jì)算模型:封閉可控開(kāi)放不確定Gartner:2011十大戰(zhàn)略技術(shù)云計(jì)算居首
計(jì)算模式大爆炸系統(tǒng)軟件的作用圖靈機(jī)模型應(yīng)用系統(tǒng)計(jì)算機(jī)硬件/網(wǎng)絡(luò)
系統(tǒng)軟件操作系統(tǒng):主機(jī)OS、桌面OS、網(wǎng)絡(luò)OS、中間件系統(tǒng)、WebOS、VMM、網(wǎng)構(gòu)…編程方面:機(jī)器語(yǔ)言、匯編語(yǔ)言、面向過(guò)程、面向?qū)ο?、面向?gòu)件、Eclipse、Agent…….其他……計(jì)算為中心信息為中心用戶為中心GAP實(shí)虛不變/變化的地方無(wú)論計(jì)算環(huán)境如何變化,系統(tǒng)軟件的2個(gè)基礎(chǔ)作用不變:運(yùn)行時(shí)支撐;設(shè)計(jì)時(shí)支撐;用戶體驗(yàn)已經(jīng)作為系統(tǒng)軟件成功與否的關(guān)鍵因素:運(yùn)行支撐環(huán)境:高效能、高可靠、高可用、可信、低成本、低能耗、界面……;設(shè)計(jì)支撐:抽象層次越來(lái)越高;例1:系統(tǒng)由多個(gè)工作站(終端)和1個(gè)共享處理機(jī)池(poolofprocessor)經(jīng)網(wǎng)絡(luò)聯(lián)結(jié)組成,系統(tǒng)為用戶提供單一的文件系統(tǒng),空閑的工作站和處理機(jī)動(dòng)態(tài)分配。
這個(gè)從系統(tǒng)整體上看以及運(yùn)行起來(lái)看都像一個(gè)典型的單處理機(jī)分時(shí)系統(tǒng),實(shí)際上是一個(gè)分布式系統(tǒng)(分布并行計(jì)算)。例2:一個(gè)在世界各地有數(shù)百個(gè)分支機(jī)構(gòu)的大銀行。每個(gè)分支機(jī)構(gòu)有一臺(tái)主計(jì)算機(jī)存儲(chǔ)當(dāng)?shù)貛つ亢吞幚肀镜厥聞?wù)。此外,每臺(tái)計(jì)算機(jī)還能與其他分支機(jī)構(gòu)的計(jì)算機(jī)及總部的計(jì)算機(jī)對(duì)話。
如果交易不管顧客和帳目在哪里都能夠進(jìn)行,而且用戶也不會(huì)感到當(dāng)前這個(gè)系統(tǒng)與被替代的老的集中式主機(jī)有何不同,那么這個(gè)系統(tǒng)也被認(rèn)為是一個(gè)分布式系統(tǒng)(分布式事務(wù)處理)。
例3:分布式文檔處理,如WWW系統(tǒng)。
通過(guò)URL,實(shí)現(xiàn)對(duì)分布文檔以位置透明的方式訪問(wèn),分布式文檔處理。
分布式計(jì)算的主要缺點(diǎn):多點(diǎn)故障:一臺(tái)(條)或多臺(tái)(條)計(jì)算機(jī)(網(wǎng)絡(luò)鏈路)的故障會(huì)導(dǎo)致分布式系統(tǒng)出現(xiàn)問(wèn)題。安全問(wèn)題:分散式管理使安全策略的實(shí)現(xiàn)和增強(qiáng)變得更為困難。
分布式系統(tǒng)的實(shí)現(xiàn)方式:低級(jí)編程;操作系統(tǒng)(分布式);中間件技術(shù);低級(jí)編程:利用網(wǎng)絡(luò)協(xié)議和操作系統(tǒng)等提供的低級(jí)服務(wù)來(lái)構(gòu)造各種分布式應(yīng)用系統(tǒng)。開(kāi)發(fā)效率低,軟件的質(zhì)量難以保證。操作系統(tǒng)(分布式):兼容現(xiàn)存軟件+適應(yīng)開(kāi)放異構(gòu)性+適應(yīng)應(yīng)用多樣性等方面存在不足。中間件技術(shù):對(duì)廣泛的一類問(wèn)題具有較好的適用性。它可支持廣泛一類應(yīng)用軟件的高效和高質(zhì)量的開(kāi)發(fā)。1.1Adistributedsystemorganizedasmiddleware.
Notethatthemiddlewarelayerextendsovermultiplemachines.1.2GOALS:
1.ConnectingUsersandResources:tomakeiteasyforuserstoaccessremoteresources,andtosharethemwithotherusersinacontrolledway.2.Transparency:tohidethefactthatitsprocessesandresourcesarephysicallydistributedacrossmultiplecomputers.3.Openness:tooffersservicesaccordingtostandardrulethatdescribethesyntaxandsemanticsofthoseservices.(e.g.IDLInterfaceDefinitionLanguage)4.Scalability:insize,geographically,andadministrativelyTransparencyinaDistributedSystemDifferentformsoftransparencyinadistributedsystem.TransparencyDescriptionAccessHidedifferencesindatarepresentationandhowaresourceisaccessedLocationHidewherearesourceislocatedMigrationHidethataresourcemaymovetoanotherlocationRelocationHidethataresourcemaybemovedtoanotherlocationwhileinuseReplicationHidethataresourceisreplicatedConcurrencyHidethataresourcemaybesharedbyseveralcompetitiveusersFailureHidethefailureandrecoveryofaresourcePersistenceHidewhethera(software)resourceisinmemoryorondiskScalabilityProblemsExamplesofscalabilitylimitations.ConceptExampleCentralizedservicesAsingleserverforallusersCentralizeddataAsingleon-linetelephonebookCentralizedalgorithmsDoingroutingbasedoncompleteinformation
Therearebasicallyonlythreetechniquesforscaling:Hidingcommunicationlatencies(asynchronouscommunication)Distribution(e.g.DNS)Replication(leadstoconsistencyproblems)ScalingTechniques(1)1.4Thedifferencebetweenletting:aserveroraclientcheckformsastheyarebeingfilledScalingTechniques(2)1.5AnexampleofdividingtheDNSnamespaceintozones.1.3HardwareConcepts計(jì)算機(jī)系統(tǒng)的分類(按Flynn的分類):1、SISD(SingleInstructionstream,SingleDatastream)單處理機(jī)計(jì)算機(jī)。2、SIMD(SingleInstructionstream,MultipleDatastream),一些超級(jí)計(jì)算機(jī)。3、MISD(MultipleInstructionstream,SingleDatastream)。此類型計(jì)算機(jī)有多條指令流,一條數(shù)據(jù)流。目前計(jì)算機(jī)中沒(méi)有屬于這一類。4、MIMD(MultipleInstructionstream,MultipleDatastream),分布式系統(tǒng)屬于此類型。計(jì)算機(jī)系統(tǒng)的分類(續(xù)):緊耦合型(tightlycoupled)系統(tǒng)——計(jì)算機(jī)之間發(fā)送信息的時(shí)延很短、數(shù)據(jù)傳輸速率高。松耦合型(looselycoupled)系統(tǒng)——機(jī)器間信息傳送延遲大,數(shù)據(jù)傳輸速率也低。1.6DifferentbasicorganizationsandmemoriesindistributedcomputersystemsMultiprocessors(1)Abus-basedmultiprocessor.1.7存儲(chǔ)器相關(guān)(Coherent)Multiprocessors(2)1.8交叉開(kāi)關(guān)交換網(wǎng)絡(luò)HomogeneousMulticomputerSystems1-9GridHypercubeHeterogeneousMulticomputerSystemsa.基于總線b.基于交換并行及分布式計(jì)算機(jī)系統(tǒng)分類:
sequent超級(jí)計(jì)算機(jī)LAN工作站超立方體
EncorRP3Transputer交換交換基于總線:廣播方式;基于交換:路由方式1.4SoftwareConcepts軟件系統(tǒng):緊耦合型(tightlycoupled)系統(tǒng)——單系統(tǒng)映象(single-systemimage)。往往稱為分布式操作系統(tǒng).松耦合型(looselycoupled)系統(tǒng)——松耦合的軟件允許分布式系統(tǒng)的機(jī)器和用戶基本上各自獨(dú)立,但是也在必要的情況下進(jìn)行一定程度的相互作用。往往稱為網(wǎng)絡(luò)操作系統(tǒng).
AnoverviewbetweenDOS(DistributedOperatingSystems)NOS(NetworkOperatingSystems)MiddlewareSystemDescriptionMainGoalDOSTightly-coupledoperatingsystemformulti-processorsandhomogeneousmulticomputersHideandmanagehardwareresourcesNOSLoosely-coupledoperatingsystemforheterogeneousmulticomputers(LANandWAN)OfferlocalservicestoremoteclientsMiddlewareAdditionallayeratopofNOSimplementinggeneral-purposeservicesProvidedistributiontransparencyDistributedOperatingSystems(1.UniprocessorOperatingSystems)DOS在功能上同UOS2.MultiprocessorOperatingSystems?3.MulticomputerOperatingSystemsUniprocessorOperatingSystems單機(jī)操作系統(tǒng)可以有多種結(jié)構(gòu)實(shí)現(xiàn),目的是管理整個(gè)計(jì)算機(jī)系統(tǒng)的資源,并為用戶提供使用上的方便。操作系統(tǒng)的結(jié)構(gòu):模塊結(jié)構(gòu);層次結(jié)構(gòu);微內(nèi)核結(jié)構(gòu);面向?qū)ο蟮?。UniprocessorOperatingSystemsSeparatingapplicationsfromoperatingsystemcodethroughamicrokernel.1.11MultiprocessorOperatingSystems(1)MultiprocessorOperatingSystemsaimtosupporthighperformancethroughmultipleCPUs.AnimportantgoalistomakethenumberofCPUstransparenttotheapplication.Achievingsuchtransparencyisrelativelyeasybecausethecommunicationbetweendifferentpartsofapplicationusesthesameprimitivesasthoseinmultitaskinguniprocessoroperatingsystems.Twoimportantprimitivesaresemaphoresandmonitors(只需保護(hù)數(shù)據(jù)不在同一時(shí)刻受到多個(gè)訪問(wèn))MultiprocessorOperatingSystems(1)Amonitortoprotectanintegeragainstconcurrentaccess.monitorCounter{private:intcount=0;public:intvalue(){returncount;}voidincr(){count=count+1;}voiddecr(){count=count–1;}}MultiprocessorOperatingSystems(2)Amonitortoprotectanintegeragainstconcurrentaccess,butblockingaprocess.monitorCounter{private:intcount=0;intblocked_procs=0;conditionunblocked;public:intvalue(){returncount;}voidincr(){if(blocked_procs==0)count=count+1;elsesignal(unblocked);}voiddecr(){if(count==0){blocked_procs=blocked_procs+1;wait(unblocked);blocked_procs=blocked_procs–1;}elsecount=count–1;}}MulticomputerOperatingSystems(1)Generalstructureofamulticomputeroperatingsystem(throughmessagepassing)松耦合硬件上的緊耦合軟件,系統(tǒng)目標(biāo)是使用戶產(chǎn)生一個(gè)視覺(jué):整個(gè)計(jì)算機(jī)網(wǎng)絡(luò)是一個(gè)分時(shí)系統(tǒng),而不是一個(gè)互不相同的機(jī)器的集合。(沒(méi)有共享存儲(chǔ),只能消息傳遞)1.14MulticomputerOperatingSystems(2)Alternativesforblockingandbufferinginmessagepassing.(fourpossiblysynchronizationpoints.iftheoperatingsystemblocksasenderuntilmessagesarriveateitherS3orS4,itmustguaranteereliablecommunication.morecomplex)1.15MulticomputerOperatingSystems(3)Relationbetweenblocking,buffering,andreliablecommunications.SynchronizationpointSendbufferReliablecomm.guaranteed?Blocksenderuntilbuffernotfull(滿時(shí)阻塞發(fā)送進(jìn)程)YesNotnecessaryBlocksenderuntilmessagesentNoNotnecessaryBlocksenderuntilmessagereceivedNoNecessaryBlocksenderuntilmessagedeliveredNoNecessary同步點(diǎn)與消息傳遞語(yǔ)義理解(消息可靠性)DistributedSharedMemorySystems(1)PagesofaddressspacedistributedamongfourmachinesSituationafterCPU1referencespage10Situationifpage10isreadonlyandreplicationisusedWhenaprocessorreferencesanaddressthatisnotpresentlocally,atrapoccurs,andtheoperatingsystemfetchesthepagecontainingtheaddressandrestartsthefaultinginstruction.DistributedSharedMemorySystems(2)Falsesharingofapagebetweentwoindependentprocesses.1.18要設(shè)計(jì)高效的DSM,頁(yè)的大小設(shè)置是一個(gè)問(wèn)題?太小:可能中斷多,傳送次數(shù)多.太大:也可能傳送次數(shù)多.例如:NetworkOperatingSystem(1)Generalstructureofanetworkoperatingsystem.松耦合硬件上的松耦合軟件(底層硬件和Kernel可以不同)1-19NetworkOperatingSystem(2)每個(gè)用戶都有自己專用的工作站(有盤或無(wú)盤)。但是它一定有自己的操作系統(tǒng)。所有的命令通常在本地運(yùn)行。非透明方式使用,例如:rloginmachinercpmachine1:file1machine2:file2(機(jī)器的選擇完全由人工操作完成)NetworkOperatingSystem(2)Twoclientsandaserverinanetworkoperatingsystem.(提供一個(gè)全局文件系統(tǒng)的方法:文件服務(wù)器)1-20NetworkOperatingSystem(3)Differentclientsmaymounttheserversindifferentplaces.缺點(diǎn):缺乏透明性1.21PositioningMiddlewareAdistributedoperatingsystemisnotintendedtohandleacollectionofindependentcomputers.(異構(gòu))Anetworkoperatingsystemdoesnotprovideaviewofasinglecoherentsystem.PositioningMiddlewareThesolutionistobefoundinanadditionallayerofsoftwarethatisusedinnetworkoperatingsystemstomoreorlesshidetheheterogeneityofthecollectionofunderlyingplatformsbutalsotoimprovedistributiontransparencymiddlewarePositioningMiddlewareGeneralstructureofadistributedsystemasmiddleware.1-22MiddlewareModelsTomakedevelopmentandintegrationofdistributedapplicationsassimpleaspossible,mostmiddlewareisbasedonsomemodel,orparadigm,fordescribingdistributionandcommunication.Somemodelsareasfollows:basedondistributedfilesystem,basedonRPCs—RemoteProcedureCalls,basedondistributedobjects,basedondistributeddocuments,……MiddlewareServices為了力圖實(shí)現(xiàn)訪問(wèn)透明性,Thereareanumberofservicescommontomanymiddlesystems:NamingPersistenceDistributedtransaction……MiddlewareandOpenness為保證開(kāi)放性/互操作性:采用相同的中間件協(xié)議和中間件接口.1.23ComparisonbetweenSystemsItemDistributedOSNetworkOSMiddleware-basedOSMultiproc.Multicomp.DegreeoftransparencyVeryHighHighLowHighSameOSonallnodesYesYesNoNoNumberofcopiesofOS1NNNBasisforcommunicationSharedmemoryMessagesFilesModelspecificResourcemanagementGlobal,centralGlobal,distributedPernodePernodeScalabilityNoModeratelyYesVariesOpennessClosedClosedOpenOpenDistributedComputingParadigmChapter22.1ParadigmandAbstractionImportantcharacteristicsthatdistinguishdistributedapplicationsfromconventionalapplicationswhichrunonasinglemachine:Interprocesscommunication:Adistributedapplicationrequirestheparticipationoftwoormoreindependententities(processes).Todoso,theprocessesmusthavetheabilitytoexchangedataamongthemselves.(多方參與)Eventsynchronization:Inadistributedapplication,thesendingandreceivingofdataamongtheparticipantsofadistributedapplicationmustbesynchronized.2.1ParadigmandAbstractionParadigm:Paradigmmeans“apattern,example,ormodel.”Inthestudyofanysubjectofgreatcomplexity,itisusefultoidentifythebasicpatternsormodels,andclassifythedetailaccordingtothesemodels.一個(gè)用于說(shuō)明如何完成某項(xiàng)特定任務(wù)的抽象模型。2.1ParadigmandAbstractionAbstractions:Arguablythemostfundamentalconceptincomputerscience,abstractionistheideaofdetailhiding.Weoftenuseabstractionwhenitisnotnecessarytoknowtheexactdetailsofhowsomethingworksorisrepresented,becausewecanstillmakeuseofitinitssimplifiedform.Gettinginvolvedwiththedetailoftentendstoobscurewhatwearetryingtounderstand,ratherthanilluminateit.(太細(xì)節(jié)的東西會(huì)影響對(duì)主要問(wèn)題的理解)Abstractionplaysaveryimportantroleinprogrammingbecauseweoftenwanttomodel,insoftware,simplifiedversionsofthingsthatexistintherealworldwithouthavingtobuildtherealthings.(編程就是對(duì)所關(guān)注事情的抽象)Insoftwareengineering,abstractionisrealizedwiththeprovisionoftoolsorfacilitieswhichallowsoftwaretobebuiltwithoutthedeveloperhavingtobecognizantofsomeoftheunderlyingcomplexities.(工具和設(shè)施提供抽象)科研過(guò)程更是如此.2.1OverviewofpresentedParadigmsMessagepassingRemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:Point-to-point;Publish/SubscribeDistributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplicationsMessagepassing
RemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:Point-to-point;Publish/SubscribeDistributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplications2.2TheMessagePassingParadigm2.2TheMessagePassingParadigm
Messagepassingisthemostfundamentalparadigmfordistributedapplications.Aprocesssendsamessagerepresentingarequest.Themessageisdeliveredtoareceiver,whichprocessestherequest,andsendsamessageinresponse.Inturn,thereplymaytriggerafurtherrequest,whichleadstoasubsequentreply,andsoforth.2.2TheMessagePassingParadigmMessagepassingparadigmAnIllustration:進(jìn)程B
進(jìn)程A
SendM1receiveReceiveM2SendSendM3receive2.2TheMessagePassingParadigmThebasicoperations:send,andreceive.Forconnection-orientedcommunication,theoperationsconnect
anddisconnectarealsorequired.Withtheabstractionprovidedbythismodel,theinterconnectedprocessesperforminputandoutputtoeachother,inamannersimilartofileI/O.TheI/Ooperationsencapsulatethedetailofnetworkcommunicationattheoperating-systemlevel.(抽象形態(tài))Thesocketapplicationprogramminginterfaceisbasedonthisparadigm.hfdgdgttp:///products/jdk/1.2/docs/api/index.html/2.3RemoteProcedureCallMessagepassingRemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:Point-to-point;Publish/Subscribe
Distributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplications2.3RemoteProcedureCallTheRemoteProcedureCall(RPC)modelprovidessuchanabstraction.Usingthismodel,interprocesscommunicationsproceedasprocedure,orfunction,calls,whicharefamiliartoapplicationprogrammers.Aremoteprocedurecallinvolvestwoindependentprocesses,whichmayresideonseparatemachines.Aprocess,A,wishingtomakearequesttoanotherprocess,B,issuesaprocedurecalltoB,passingwiththecallalistofargumentvalues.Asinthecaseoflocalprocedurecalls,aremoteprocedurecalltriggersapredefinedactioninaprocedureprovidedbyprocessB.Atthecompletionoftheprocedure,processBreturnsavaluetoprocessA.
2.3RemoteProcedureCallRemoteProcedureCallparadigmProcessAProcessBProc1(arg1,arg2)返回值2.3RemoteProcedureCall2.3RemoteProcedureCallRPCallowsprogrammerstobuildnetworkapplicationsusingaprogrammingconstructsimilartothelocalprocedurecall,providingaconvenientabstractionforbothinterprocesscommunicationandeventsynchronization.Sinceitsintroductionintheearly1980s,theRPCmodelhasbeenwidelyinuseinnetworkapplications.TherearetwoprevalentAPIsforRemoteProcedureCalls.TheOpenNetworkComputingRemoteProcedureCall,evolvedfromtheRPCAPIoriginatedfromSunMicrosystemsintheearly1980s.TheOpenGroupDistributedComputingEnvironment(DCE)RPC.BothAPIsprovideatool,rpcgen,fortransformingremoteprocedurecallstolocalprocedurecalls.2.3RemoteProcedureCall拍賣系統(tǒng)實(shí)例:拍賣者程序?yàn)榫古恼咛峁?個(gè)遠(yuǎn)程過(guò)程:
1.竟拍者注冊(cè)過(guò)程;2.竟拍者投標(biāo)過(guò)程;每個(gè)竟拍者程序提供以下遠(yuǎn)程過(guò)程:1.允許拍賣者向竟拍者宣布拍賣開(kāi)始;2.允許拍賣者向竟拍者通告最新標(biāo)價(jià);3.允許拍賣者向竟拍者宣布拍賣結(jié)束.2.4Client-ServerParadigmMessagepassingRemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:Point-to-point;Publish/Subscribe
Distributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplicationsPerhapsthebestknownparadigmfornetworkapplications,theclient-servermodel,assignsasymmetricrolestotwocollaboratingprocesses(非對(duì)稱).Oneprocess,theserver,playstheroleofaserviceproviderwhichwaitspassivelyforthearrivalofrequests.Theother,theclient,issuesspecificrequeststotheserverandawaitsitsresponse.
2.4Client-ServerParadigmclient–server
paradigm.1.25Client和server分別扮演服務(wù)請(qǐng)求者和服務(wù)提供者2.4Client-ServerParadigmAnExampleClientandServer(1)Theheader.hfileusedbytheclientandserver.AnExampleClientandServer(2)Asampleserver.AnExampleClientandServer(3)Aclientusingtheservertocopyafile.1-27bSimpleinconcept,theclient-servermodelprovidesanefficientabstractionforthedeliveryofnetworkservices.Operationsrequiredincludethoseforaserverprocesstolistenandtoacceptrequests,andforaclientprocessto
issuerequestsandacceptresponses.Byassigningasymmetricrolestothetwosides,eventsynchronizationissimplified:theserverprocesswaitsforrequests,andtheclientinturnwaitsforresponses.ManyInternetservicesareclient-serverapplications.Theseservicesareoftenknownbytheprotocolthattheapplicationimplements.WellknownInternetservicesincludeHTTP,FTP,DNS,finger,gopher,etc.2.4Client-ServerParadigmProcessingLevelThegeneralorganizationofanInternetsearchengineintothreedifferentlayers1-28Client-ServerArchitectures客戶機(jī)器只包含用戶界面層的程序服務(wù)器包含其他部分(類似啞終端,服務(wù)器負(fù)載重)另一種可能的Client-Server模型的體系結(jié)構(gòu)如下MultitieredArchitectures(1)Alternativeclient-serverorganizations(a)–(e).1-29MultitieredArchitectures(2)Anexampleofaserveractingasaclient.1-30服務(wù)器有時(shí)會(huì)擔(dān)任客戶機(jī)的角色,現(xiàn)成多層體系結(jié)構(gòu)ModernArchitectures
多層是按縱向劃分,也可以按橫向劃分(horizontaldistribution)
(例如:服務(wù)器負(fù)載均衡)
AnexampleofhorizontaldistributionofaWebservice.1-312.5.Peer-to-PeerParadigmMessagepassingRemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:Point-to-point;Publish/Subscribe
Distributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplicationsP2P——網(wǎng)絡(luò)上的所有節(jié)點(diǎn)都可以“平等”共享其他節(jié)點(diǎn)的計(jì)算資源:服務(wù)器到服務(wù)器、服務(wù)器到PC機(jī)、PC機(jī)到PC機(jī),PC機(jī)到WAP手機(jī),所有網(wǎng)絡(luò)節(jié)點(diǎn)上的設(shè)備都可以建立P2P對(duì)話。2.5.Peer-to-PeerParadigmInsystemarchitectureandnetworks,peer-to-peerisanarchitecturewherecomputerresourcesandservicesaredirectexchangedbetweencomputersystems.(資源與服務(wù)可直接交換)Theseresourcesandservicesincludetheexchangeofinformation,processingcycles,cachestorage,anddiskstorageforfiles.Insuchanarchitecture,computersthathavetraditionallybeenusedsolelyasclientscommunicatedirectlyamongthemselvesandcanactasbothclientsandservers,assumingwhateverroleismostefficientforthenetwork.(根據(jù)效率確定角色)/whatis/index.html2.5.Peer-to-PeerParadigm
Theparticipatingprocessesplayequalroles,withequivalentcapabilitiesandresponsibilities(hencetheterm“peer”).Eachparticipantmayissuearequesttoanotherparticipantandreceivearesponse.(角色平等)2.5.Peer-to-PeerParadigm
Whereastheclient-serverparadigmisanidealmodelforacentralizednetworkservice,thepeer-to-peerparadigmismoreappropriateforapplicationssuchasinstantmessaging,peer-to-peerfiletransfers,videoconferencing,andcollaborativework.Itisalsopossibleforanapplicationtobebasedonboththeclient-servermodelandthepeer-to-peermodel.(c/s適合集中式網(wǎng)絡(luò)服務(wù),P2P適合分散式服務(wù))
Awell-knownexampleofapeer-to-peerfiletransferserviceisNorsimilarsiteswhichallowfiles(primarilyaudiofiles)tobetransmittedamongcomputersontheInternet.Itmakesuseofaserverfordirectoryinadditiontothepeer-to-peercomputing.(P2P文件傳輸服務(wù),服務(wù)器作為集中目錄)2.5.Peer-to-PeerParadigmnapster是P2PParadigm一個(gè)里程碑,它提供一個(gè)平臺(tái),供用戶上傳、檢索和下載作品;并具有強(qiáng)大的搜索功能,可以將在線用戶的MP3音樂(lè)信息進(jìn)行自動(dòng)搜尋并分類整理,以備其他用戶查詢。1999年,國(guó)際五大唱片公司起訴Napster,指其涉及侵權(quán)歌曲數(shù)百萬(wàn)首,要求每支盜版歌曲賠償10萬(wàn)美元。2000年2月,法院判定Napster敗訴;2002年6月,Napster宣告破產(chǎn)。2001年提供音樂(lè)免費(fèi)下載服務(wù)的Napster公司被國(guó)際傳媒巨頭貝塔斯曼集團(tuán)收購(gòu)。2.5.Peer-to-PeerParadigmP2P:centralizeddirectoryoriginal“Napster”design1)whenpeerconnects,itinformscentralserver:IPaddresscontents2)Alicequeriesfor“HeyJude”3)AlicerequestsfilefromBobcentralizeddirectoryserverpeersAliceBob111123Ref:ComputerNetworking,JimF.KuroseandKeithW.RossP2P:problemswithcentralizeddirectorySinglepointoffailurePerformance
bottleneckCopyrightinfringement(版權(quán)問(wèn)題)
Filetransferisdecentralized(分散的),butlocatingcontentsishighlycentralizedQueryflooding:GnutellaGnutella在napster之后出現(xiàn)的一種用于網(wǎng)絡(luò)交換文件的完全分布式的p2p通信協(xié)議。所有利用Gnutella協(xié)議運(yùn)行的客戶端程序的計(jì)算機(jī)都被稱為在Gnutella網(wǎng)絡(luò)上。在Gnutella網(wǎng)絡(luò)上,每個(gè)結(jié)點(diǎn)連接其他幾臺(tái)計(jì)算機(jī),信息同時(shí)可能從很多來(lái)源接收。設(shè)一個(gè)用戶連接4臺(tái)計(jì)算機(jī),每臺(tái)計(jì)算機(jī)又連接4臺(tái)計(jì)算機(jī),用戶能與計(jì)算機(jī)的總數(shù)為4+4*4=20個(gè)用戶進(jìn)行信息交流。消息只沿著網(wǎng)絡(luò)傳遞2次(稱為生存時(shí)間或者叫TTL)。假定TTL為3,則它能進(jìn)行信息交流的計(jì)算機(jī)的總數(shù)4+4*4+4*4*4=84。因此,能與用戶交流的計(jì)算機(jī)的數(shù)量與它的搜尋請(qǐng)求的TTL值和隨TTL增長(zhǎng)的計(jì)算機(jī)數(shù)目成指數(shù)增加的關(guān)系。Queryflooding:Gnutellafullydistributed—nocentralserverpublicdomainprotocolmanyGnutellaclientsimplementingprotocoloverlaynetwork:graphedgebetweenpeerXandYifthere’saTCPconnectionallactivepeersandedgesisoverlaynetworkEdgeisnotaphysicallinkGivenpeerwilltypicallybeconnectedwith<10overlayneighbors(每個(gè)節(jié)點(diǎn)的相鄰連接數(shù)小于10)Ref:ComputerNetworking,JimF.KuroseandKeithW.RossGnutella:protocolQueryQueryHitQueryQueryQueryHitQueryQueryQueryHitFiletransfer:HTTP
Querymessage
sentoverexistingTCP
connectionspeersforward
QuerymessageQueryHit
sentover
reverse
pathRef:ComputerNetworking,JimF.KuroseandKeithW.RossThepeer-to-peerparadigmcanbeimplementedwithfacilitiesusinganytoolthatprovidemessage-passing,orwithahigher-leveltoolsuchasonethatsupportsthepoint-to-pointmodeloftheMessageSystemparadigm.(P2P可以通過(guò)基于消息傳遞或消息系統(tǒng)的方式實(shí)現(xiàn)Forwebapplications,thewebagentisaprotocolpromotedbytheXNSORG(theXNSPublicTrustOrganization)forpeer-to-peerinterprocesscommunication(
面向WEB的P2P協(xié)議)。
“ProjectJXTAisasetofopen,generalizedpeer-to-peerprotocolsthatallowanyconnecteddevice(cellphone,toPDA,PCtoserver)onthenetworktocommunicateandcollaborate.開(kāi)源項(xiàng)目JXTAJava標(biāo)準(zhǔn)版本,是由BillJoy引領(lǐng)開(kāi)發(fā)的P2P計(jì)算平臺(tái)。
2.5.Peer-to-PeerParadigm即時(shí)通信軟件,如ICQ、QQ、MSN等。2個(gè)或多個(gè)用戶可以通過(guò)文字、語(yǔ)音或文件進(jìn)行交流,甚至還可以與手機(jī)通信;實(shí)現(xiàn)共享文件資源的軟件,如Napster、Gnutella和PPStream等。用戶可以直接從任意一臺(tái)安裝同類軟件的PC上下載或上載文件,并檢索、復(fù)制共享的文件;游戲軟件。目前的許多網(wǎng)絡(luò)游戲都是通過(guò)對(duì)等網(wǎng)絡(luò)方式實(shí)現(xiàn)的;存儲(chǔ)軟件,如Farsite。用于在網(wǎng)絡(luò)上將存儲(chǔ)對(duì)象分散存儲(chǔ)。數(shù)據(jù)搜索及查詢軟件,如Infrasearch、Pointera。用來(lái)在對(duì)等網(wǎng)絡(luò)中完成信息檢索;協(xié)同計(jì)算軟件,如Netbatch??蛇B接幾千或上萬(wàn)臺(tái)PC,利用其空閑時(shí)間進(jìn)行協(xié)同計(jì)算;協(xié)同處理軟件,如Groove??捎糜谄髽I(yè)管理。2.5.Peer-to-PeerParadigm(一些應(yīng)用)對(duì)等網(wǎng)絡(luò)尚無(wú)統(tǒng)一的標(biāo)準(zhǔn)。2000年8月成立了P2P工作組,成員包括Intel、IBM和HP公司等。發(fā)展對(duì)等網(wǎng)絡(luò)的其他主要障礙還有版權(quán)問(wèn)題、網(wǎng)絡(luò)帶寬問(wèn)題、管理問(wèn)題和安全問(wèn)題等。如何連接電話、手機(jī)和家電、工業(yè)設(shè)備等,也是對(duì)等網(wǎng)絡(luò)需要解決的問(wèn)題。2.5.Peer-to-PeerParadigm2.6.
The
MessageSystemParadigmMessagepassingRemoteProcedureCallClient-serverPeer-to-PeerMessagesystem:
Point-to-point;Publish/SubscribeDistributedobjects:Remotemethodinvocation
NetworkservicesObjectRequestBroker
Objectspace
ComponentBasedTechnologiesMobileagentsCollaborativeapplicationsAmessagesystemservesasanintermediaryamongseparate,independentprocesses.Itactsasaswitchformessages,throughwhichprocessesexchangemessagesasynchronously,inadecoupledmanner.
(作為獨(dú)立的中介實(shí)現(xiàn)消息以非偶合的方式異步交換)
Asenderdepositsamessagewiththemessagesystem,whichforwardsittoamessagequeueassociatedwitheachreceiver.Onceamessageissent,thesenderisfreetomoveontoothertasks.2.6.
TheMessageSystemParadigm2.6.
TheMessageSystemParadigmMessageSystemparadigmsender
receiver
MessageSystem
消息隊(duì)列…Message
消息隊(duì)列…進(jìn)程以非偶合的方式進(jìn)行通信。也可以通過(guò)一個(gè)Message-OrientedMiddleware實(shí)現(xiàn)消息的異步交換。兩種類型:
Point-to-pointmessagemodel;Publish/subscribemessagemodel;1.ThePoint-To-PointMessageModelComparedtothebasicmessage-passingmodel,thisparadigmprovidestheadditionalabstractionforasynchronousoperations.Inthismodel,amessagesystemforwardsamessagefromthesendertothereceiver’smessagequeue.Unlikethebasicmessagepassingmodel,themiddlewareprovidesamessagedepository,andallowsthesendingandthereceivingtobedecoupled.Viathemiddleware,asenderdepositsamessageinthemessagequeueofthereceivingprocess.Areceivingprocessextractsthemessagesfromitsmessagequeue,andhandleseachoneaccordingly.2.ThePublish/SubscribeMessageModelThepublish
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 跨學(xué)科視角下的小學(xué)生綜合計(jì)算能力培養(yǎng)策略研究總結(jié)
- DB6528T 210-2024板椒聯(lián)合收獲機(jī)作業(yè)技術(shù)規(guī)程
- DB6103T 82-2025夏大豆擴(kuò)行縮株栽培技術(shù)規(guī)范
- 專業(yè)常年法律顧問(wèn)聘任合同模板
- 個(gè)人投資入股合作合同協(xié)議
- 專利許可合同
- 買賣合同終止及賠償協(xié)議
- 專兼職律師服務(wù)合同格式范本
- 個(gè)人咖啡店轉(zhuǎn)讓合同范本
- 產(chǎn)品設(shè)計(jì)與制造合同范本
- 耶魯綜合抽動(dòng)嚴(yán)重程度量表正式版
- 2024年浙江省公務(wù)員錄用考試《行測(cè)》題(A類)
- 2024版《安全生產(chǎn)法》考試題庫(kù)附答案(共90題)
- 疥瘡病人的護(hù)理
- 2024年江西省中考英語(yǔ)試題含解析
- 公務(wù)員2012年國(guó)考《申論》真題卷及答案(地市級(jí))
- 新員工三級(jí)安全教育考試試題參考答案
- 35kV輸變電工程(變電站、輸配電線路建設(shè))技術(shù)方案
- 數(shù)學(xué)史簡(jiǎn)介課件可編輯全文
- 化學(xué)廢水水池清理施工方案
- 離婚協(xié)議書常用范本2024年
評(píng)論
0/150
提交評(píng)論