1.分布式系统定义Adistributedsystemisacollectionofautonomouscomputingelementsthatappearstoitsusersasasinglecoherentsystem.(独立的计算机的集合,对这个系统的用户来说,系统就像一台计算机一样)。2.分布式系统的目标MakingresourceavailableDistributiontransparency(分布的透明性)Openness(开放性)Scalability(可扩展性)包含三个方面:Size:Numberofusersand/orprocesses(solution:强大的服务器)Geographical:MaximumdistancebetweennodesAdministrative:Numberofadministrativedomains3.为什么需要分布式Economics(经济性)微处理器能提供比大型机更好的性价比Speed(速度)分布式系统能提供比大型机更强的计算能力Inherentdistribution(固有的分布性)有一些应用包含空间上分离的机器Reliability(可靠性)当某台机器崩溃时,整个系统仍能正常工作Incrementalgrowth(可扩展性)计算能力逐步增加4.分布式系统透明性含义分布式系统的透明性(TransparencyinaDistributedSystem)定义:对用户和应用程序员屏蔽分布式系统组件的分散性,系统被认为是一个整体,而不是独立的组件集合。透明性对用户和应用程序员隐藏了与手头任务无直接关系的资源,并匿名使用,使得分布的某些特性对应用程序员具有不可见性,这样应用程序员只要关心特定应用的设计问题。(1)网络透明性:用户察觉不出是以网络的方式工作,所有的工作对象是在单台机器上完成。(2)操作系统透明性:使用不同操作系统的机器和用户可以自由的协同工作,不同操作系统带来的不同被掩盖。(3)语言透明性:使用不同语言编写的程序或者模块能够自由交互工作,相互调用。(4)数据复制与分片透明性:分片的数据像未分片的数据一样工作,修改数据时复制在多处的数据自动更新。实现方式Access(访问)HidedifferencesindatarepresentationandhowaresourceisaccessedLocation(位置)HidewherearesourceislocatedMigration(迁移)HidethataresourcemaymovetoanotherlocationRelocation(重定位)HidethataresourcemaybemovedtoanotherlocationwhileinuseReplication(复制)HidethataresourcemaybesharedbyseveralcompetitiveusersConcurrency(并发)HidethataresourcemaybesharedbyseveralcompetitiveusersFailure(故障)Hidethefailureandrecoveryofaresource透明度(DegreeofTransparency):AimingatfulldistributiontransparencymaybetoomuchUsersmaybelocatedindifferentcontinentsCompletelyhidingfailuresofnetworksandnodesis(theoreticallyandpractically)impossibleYoucannotdistinguishaslowcomputerfromafailingoneYoucanneverbesurethataserveractuallyperformedanoperationbeforeacrashFulltransparencywillcostperformance,exposingdistributionofthesystemKeepingWebcachesexactlyup-to-datewiththemasterImmediatelyflushingwriteoperationstodiskforfaulttolerance5.分布式系统开放性含义Beabletointeractwithservicesfromotheropensystems,irrespectiveoftheunderlyingenvironment:Systemsshouldconformtowell-definedinterfacesSystemsshouldsupportportabilityofapplicationsSystemsshouldeasilyinteroperateAtleastmakethedistributedsystemindependentfromheterogeneityoftheunderlyingenvironment6.分布式操作系统、网络操作系统和基于中间件的系统定义分布式操作系统:配置在分布式系统上的操作系统,能够直接对分布式系统中的各种资源进行动态分配,并能有效地控制和协调分布式系统中各任务的并行执行,同时还向用户提供了一个方便的、透明的使用整个分布式系统的界面。网络操作系统:是在网络环境下实现对网络资源的管理和控制的操作系统,是用户与网络资源之间的接口。网络操作系统是建立在独立的操作系统之上,为网络用户提供使用网络系统资源的桥梁。在多个用户争用系统资源时,网络操作系统进行资源调剂管理,它依靠各个独立的计算机操作系统对所属资源进行管理,协调和管理网络用户进程或程序与联机操作系统进行交互。基于中间件的系统:??系统名称系统描述主要目标DOS紧耦合,管理多处理器系统和同构式多计算机系统隐藏和管理硬件资源NOS松耦合,管理异构式多计算机系统向远程客户端提供本地服务Middleware位于NOS通用服务实现层之上的附加层,屏蔽了底层的异构性和具体的通信协议细节,为应用程序员提供方便的编程模型。提供分布透明性7.分布式系统类型(1)DistributedcomputingsystemsClusterComputingEssentiallyagroupofhigh-endsystemsconnectedthroughaLAN:Homogeneous:sameOS,near-identicalhardwareSinglemanagingnodeGridComputingThenextstep:lotsofnodesfromeverywhere:HeterogeneousDispersedacrossseveralorganizationsCaneasilyspanawide-areanetwork(2)DistributedinformationsystemsThevastamountofdistributedsystemsinusetodayareformsoftraditionalinformationsystems,thatnowintegratelegacysystems.Atransactionisacollectionofoperationsonthestateofanobjectthatsatisfiesthefollowingproperties(ACID)Atomicity(原子性)Consistency(一致性)Isolation(隔离性)Durability(持久性)TransactionProcessingMonitorInmanycases,thedatainvolvedinatransactionisdistributedacrossseveralservers.ATPMonitorisresponsibleforcoordinatingtheexecutionofatransaction.(3)DistributedpervasivesystemsEmergingnext-generationofdistributedsystemsinwhichnodesaresmall,mobile,andoftenembeddedinalargersystem,characterizedbythefactthatthesystemnaturallyblendsintotheuser’senvironment.UbiquitouscomputingsystemsMobilecomputingsystemsSensor(andactuator)networks8.分布式系统中的机制与策略Requiressupportfordifferentpolicies:Whatlevelofconsistencydowerequireforclient-cached(客户端缓存)data?Whichoperationsdoweallowdownloadedcodetoperform?WhichQoSrequirementsdoweadjustinthefaceofvaryingbandwidth(带宽)?Whatlevelofsecrecy(保密)dowerequireforcommunication?Ideally,adistributedsystemprovidesonlymechanisms:Allow(dynamic)settingofcachingpoliciesSupportdifferentlevelsoftrustformobilecodeProvideadjustableQoSparametersperdatastreamOfferdifferentencryption(加密)algorithms9.分布式系统架构风格(1)Organizeintologicallydifferentcomponents,anddistributethosecomponentsoverthevariousmachines(2)Decouplingprocessesinspace(“anonymous”)andalsotime(“asynchronous”)hasledtoalternativestyles10.分布式系统组织形式(1)CentralizedBasicClient–ServerModelCharacteristics:Thereareprocessesofferingservices(servers)Thereareprocessesthatuseservices(clients)ClientsandserverscanbeondifferentmachinesClientsfollowrequest/replymodelwrttousingservices(2)DecentralizedStructuredP2P:nodesareorganizedfollowingaspecificdistributeddatastructureUnstructuredP2P:nodeshaverandomlyselectedneighborsHybridP2P:somenodesareappointedspecialfunctionsinawell-organizedfashion(3)Hybird11.客户-服务器模式和对等模式12.MiddlewareInmanycases,distributedsystems/applicationsaredevelopedaccordingtoaspecificarchitecturalstyle.Thechosenstylemaynotbeoptimalinallcases→needto(dynamically)adaptthebehaviorofthemiddleware13.BitTorrentOncea