软件体系结构_第1页
软件体系结构_第2页
软件体系结构_第3页
软件体系结构_第4页
软件体系结构_第5页
已阅读5页,还剩34页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

软件体系结构3 数据流体系结构DataFlowArchitectures 孙志岗sun sun 2 2020 4 18 Styles MovingfromQualitiestoArchitectures Architecturalstyleshelpsoftwareengineerstoreasonaboutarchitecturalqualities 体系结构风格帮助软件工程师推断软件体系结构的质量 sun 3 2020 4 18 Styles MovingfromQualitiestoArchitectures Astyledescribesaclassofarchitectures描述一类体系结构isfoundrepeatedlyinpractice在实践中被多次设计 应用isapackageofdesigndecisions是若干设计思想的综合hasknownpropertiesthatpermitreuse具有已经被熟知的特性 并且可以复用 sun 4 2020 4 18 ArchitecturalStyles Astyleisdetermined described byasetofcomponenttypes e g datarepository process object 一组组件类型 例如 数据容器 过程 对象 asetofconnectortypes interactionmechanisms e g subroutinecall event pipe 一组连接件类型 交互机制 例如 过程调用 事件 管道 atopologicallayoutofthesecomponents这些组件的拓扑分布 sun 5 2020 4 18 ArchitecturalStyles Astyleisdetermined described byasetofconstraintsontopologyandbehavior e g adatarepositoryisnotallowedtochangestoredvalues pipelinesareacyclic 一组对拓扑和行为的约束 例如 数据容器不能自己改变数据 管道不能是循环的aninformaldescriptionofthecostsandbenefitsofthestyle e g Usethepipeandfilterstylewhenreuseisdesiredandperformanceisnotatoppriority一些对风格的成本和益处的非正式的描述 例如 如果你需要重用性并且性能不是很重要 那么可以使用管道风格 sun 6 2020 4 18 ArchitecturalStyles GarlanandShawcompiledacatalogofarchitecturalstylesin1995 Others suchasBuschmann haveaugmentedthis Thereisnocompletelist 没有完备的列表Thereisnounique non overlappinglist 没有无重叠的列表Stylesoverlap 风格是彼此重叠的Systemsexhibitmultiplestylesatonce 一个系统通常表现出多种风格 sun 7 2020 4 18 TypesofArchitecturalStyles sun 8 2020 4 18 NotesaboutArchitecturalStyles Whenweintroduceanewstyle wewilltypicallyfirstexamineits pure form purearchitecturalstylearerarelyfoundinpractice纯粹的体系风格在实际中很难遇到systemsinpracticeregularlydeviatefromtheacademicdefinitionsofthesesystems 循规蹈矩地背离了对这些系统的学术定义typicallyfeaturemanyarchitecturalstylessimultaneously典型地 融合很多体系风格的特色asanarchitectyoumustunderstandthe pure stylestounderstandthestrengthandweaknessesofthestyleaswellastheconsequencesofdeviatingfromthestyle作为一个架构师 你必须理解 纯 的风格 理解它的优点与缺陷 也要理解背离此种风格之后会带来什么结果 sun 9 2020 4 18 DataFlowStyle 数据流风格 Adataflowsystemisoneinwhichtheavailabilityofdatacontrolsthecomputation由数据控制计算thestructureofthedesignisdominatedbyorderlymotionofdatafromprocesstoprocess系统结构由数据在处理之间的有序移动决定thepatternofdataflowisexplicit数据流系统的结构是显而易见的Inapuredataflowsystem thereisnootherinteractionbetweenprocesses在纯数据流系统中 处理之间除了数据交换 没有任何其他的交互 sun 10 2020 4 18 TheDataFlowStyle Therearevarietyofvariationsonthisgeneratheme howcontrolisexerted e g pushversuspull 如何施加控制 比如 推还是拉 degreeofconcurrencybetweenprocesses并行的程度topology sun 11 2020 4 18 DataFlowStyles Components DataFlowComponentsInterfacesareinputportsandoutputports组件接口是输入端口和输出端口Inputportsreaddata outputportswritedata从输入端口读数据 向输出端口写数据Computationalmodel readdatafrominputports compute writedatatooutputports计算模型 从入口读数 计算 然后写到出口 sun 12 2020 4 18 DataFlowStyles Connectors DataStreamsUni directional 单向 usuallyasynchronous buffered 通常是异步的 有缓冲 Interfacesarereaderandwriterroles接口是reader和writer计算模型 把数据从writer转向readerSystemsArbitrarygraphs 任意拓扑结构 Computationalmodel functionalcomposition 计算模型 功能组合 sun 13 2020 4 18 PatternsofDataFlowinSystems sun 14 2020 4 18 ControlFlowvs DataFlow ControlFlow typicalcaseinproceduralsystems Dominantquestionishowlocusofcontrolmovesthroughtheprogram主要问题是控制点怎样在程序或系统之间移动Datamayaccompanythecontrolbutisnotthedrivingforce数据可能跟着控制走 但是并不起推动系统运转的作用Primaryreasoningisaboutorderofcomputation关注的核心是计算顺序 sun 15 2020 4 18 ControlFlowvs DataFlow DataFlowDominantquestionishowdatamovesthroughacollectionof atomic computations主要问题是数据怎样在运算单元之间流动Asdatamoves controlis activated 数据到了 控制 计算 单元便开始工作Wereasonaboutdataavailability transformations latency 我们关心数据是否可用 转换 潜伏 sun 16 2020 4 18 ThreeExamplesofDataFlow BatchSequential 批处理 Pipe and Filter 管道 ProcessControl 控制 sun 17 2020 4 18 BatchSequentialPattern sun 18 2020 4 18 CharacteristicsofBatchSequentialSystems Processingstepsareindependentprograms每个处理步骤是一个独立的程序Eachsteprunstocompletionbeforenextstepstarts每一步必须在前一步结束后才能开始Datatransmittedasawholebetweensteps数据必须是完整的 以整体的方式传递Typicalapplications classicaldataprocessingprogramcompilation computeraidedsoftwareengineering sun 19 2020 4 18 CharacteristicsofBatchSequentialSystems ArchitecturalHeuristicscomponents processingsteps areindependentprogramsconnectorsaresometypeofmedia traditionallymagnetictapeeachsteprunstocompletionbeforethenextstepbegins sun 20 2020 4 18 Example BatchSequentialSystems Compilersearlycompilersbeganasessentiallybatchsequentialsystemslexicalanalysis parsing semanticanalysis codegenerationinitiallyamechanismtoturnhigherlevelsourcecodeintoobjectcodeComputerAidedSoftwareEngineeringCASEtoolsinitiallyprovidedanenvironmenttowriteandcompilesourcecodeintoobjectcodecompiler library linker make intoanintegratedtoolearlytoolswereindependentprogramslatertoolssharedonlyfilescommonformats simplesharingmechanisms scriptseventuallytoolsgrewtoincludedesign documentation configurationcontrol andevenautomaticcodegeneration sun 21 2020 4 18 ThreeExamplesofDataFlow BatchSequential 批处理 Pipe and Filter 管道 ProcessControl 控制 sun 22 2020 4 18 Pipe and Filter sun 23 2020 4 18 PipesandFilters Roleof pure filtersreadsstreamsofdataasinput producesstreamsofdataasoutputtraditionallybyte orientedperformsstream to streamtransformationsenrichdatabycomputationandaddinginformation通过计算和增加信息丰富数据refinebydistillingdataorremovingirrelevantdata通过浓缩和删除精炼数据transformdatabychangingitsrepresentation通过改变记录方式转化数据 sun 24 2020 4 18 PipesandFilters incrementallytransformdatafromthesourcetothesink 递增地转化数据 dataisprocessedasitarrives notgatheredthenprocessed数据到来时便被处理 不是收集然后处理 偶有例外 filtersareindependententitiesnocontextinprocessingstreamsnostatepreservationbetweeninstantiationsnoknowledgeofupstream downstreamfiltersthecorrectnessoftheoutputshouldnotdependupontheorderinwhichthepipesareconnectedinapipe and filternetwork过滤器的先后顺序不影响输出的结果 sun 25 2020 4 18 Pipe and Filter Roleof pure pipes SG96 movedatafromafilteroutputtoafilterinput ortoadeviceorfile datamovesinonedirection upstreamflowcontrolisallowedpipesformdatatransmissiongraphsOverallOperationsystemactionismediatedbydatadelivery数据传送引起系统动作pipe and filtersystemsrununtilnomoredataisavailableandnomorecomputationspossible sun 26 2020 4 18 Pipes and Filters inunix unixprocessesthattransformstdintostdoutaregenerallycalledfiltersbutwhentheyconsumealltheinputbeforestartingtheoutput theyviolatethefilterassumptionsort forexampleunixpipescantreatfilesaswellasfiltersasdatasourcesandsinksbutfilesarepassive soyoucan tmakearbitrarycombinationsunixassumesthatthepipescarryASCIIcharacterstreamsthegoodnews anythingcanconnecttoanythingelsethebadnews everythingmustbeencodedinASCII thenshipped thendecoded sun 27 2020 4 18 Pipes and Filters inunix sun 28 2020 4 18 Issue DataPullingandDataPushing Question whatistheforcethatmakesthedataflow Threechoices allwithforceemanatingfromfilters push datasourcepushesdataindownstreamdirectionpull datasinkpullsdatafromupstreamdirectionpush pull afilterisactivelypullingfromupstream computing andpushingdownstreampassive don tdoeither actasasinkfordataCombinationsmaybecomplex Ifmorethanonefilterispushing pulling synchronizationisneededSo Whycan tyoupipeafiletoafileinunix sun 29 2020 4 18 BatchSequentialvsPipe Filter sun 30 2020 4 18 BatchSequentialvsPipe Filter UNIX BothDecomposetaskintofixedsequenceofcomputationsInteractonlythroughdatapassedfromonetoanother把任务分解成为一系列固定顺序的计算单元 组件 组件间只通过数据传递交互 sun 31 2020 4 18 BatchSequentialvsPipe Filter UNIX sun 32 2020 4 18 AVariantonDataFlow Issue insomesystems DataflowsslowlythroughthesystemDatadoesnotremainstrictlyinorder sun 33 2020 4 18 Summary GuidanceforSelectingaDataFlowStyle taskisdominatedbytheavailabilityofdata任务由数据主导datacanbemovedpredictablyfromprocesstoprocess事先知道数据的确切流向pipe and filterarchitecturesaregoodchoicesformanydataflowapplicationsbecausetheypermitreuseandreconfigurationoffiltersgen

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论