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

下载本文档

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

文档简介

1、软件体系结构3. 数据流体系结构Data Flow Architectures8/6/20221Styles -Moving from Qualities toArchitecturesArchitectural styles help software engineers to reason about architectural qualities.体系结构风格帮助软件工程师推断软件体系结构的质量8/6/20222Styles -Moving from Qualities toArchitecturesA styledescribes a class of architectures描述一

2、类体系结构is found repeatedly in practice在实践中被多次设计、应用is a package of design decisions是若干设计思想的综合has known properties that permit reuse具有已经被熟知的特性,并且可以复用8/6/20223Architectural StylesA style is determined (described) bya set of component types (e.g., data repository, process, object)一组组件类型(例如:数据容器,过程,对象)a se

3、t of connector types/interaction mechanisms (e.g., subroutine call, event, pipe)一组连接件类型/交互机制(例如:过程调用,事件,管道)a topological layout of these components这些组件的拓扑分布8/6/20224Architectural StylesA style is determined (described) bya set of constraints on topology and behavior (e.g., a data repository is not a

4、llowed to change stored values, pipelines are acyclic)一组对拓扑和行为的约束(例如:数据容器不能自己改变数据,管道不能是循环的an informal description of the costs and benefits of the style, e.g.: “Use the pipe and filter style when reuse is desired and performance is not a top priority一些对风格的成本和益处的非正式的描述,例如:如果你需要重用性并且性能不是很重要,那么可以使用管道风格

5、8/6/20225Architectural StylesGarlan and Shaw compiled a catalog of architectural styles in 1995. Others, such as Buschmann, have augmented this.There is no complete list. 没有完备的列表There is no unique, non-overlapping list. 没有无重叠的列表Styles overlap. 风格是彼此重叠的Systems exhibit multiple styles at once. 一个系统通常表

6、现出多种风格8/6/20226Types of Architectural Styles8/6/20227Notes about Architectural StylesWhen we introduce a new style, we will typically first examine its “pure” form.pure architectural style are rarely found in practice纯粹的体系风格在实际中很难遇到systems in practiceregularly deviate from the academic definitions o

7、f these systems. 循规蹈矩地背离了对这些系统的学术定义typically feature many architectural styles simultaneously典型地,融合很多体系风格的特色as an architect you must understand the “pure” styles to understand the strength and weaknesses of the style as well as the consequences of deviating from the style作为一个架构师,你必须理解“纯”的风格。理解它的优点与缺

8、陷,也要理解背离此种风格之后会带来什么结果8/6/20228Data Flow Style(数据流风格)A data flow system is one in whichthe availability of data controls the computation由数据控制计算the structure of the design is dominated by orderly motion of data from process to process系统结构由数据在处理之间的有序移动决定the pattern of data flow is explicit数据流系统的结构是显而易见

9、的In a pure data flow system, there is no other interaction between processes在纯数据流系统中,处理之间除了数据交换,没有任何其他的交互8/6/20229The Data Flow StyleThere are variety of variations on this genera theme:how control is exerted (e.g., push versus pull)如何施加控制(比如:推还是拉)degree of concurrency between processes并行的程度topology

10、8/6/202210Data Flow StylesComponents: Data Flow ComponentsInterfaces are input ports and output ports组件接口是输入端口和输出端口Input ports read data; output ports write data从输入端口读数据,向输出端口写数据Computational model: read data from input ports, compute, write data to output ports计算模型:从入口读数,计算,然后写到出口8/6/202211Data Flo

11、w StylesConnectors: Data StreamsUni-directional(单向)usually asynchronous, buffered (通常是异步的,有缓冲)Interfaces are reader and writer roles接口是reader和writer计算模型: 把数据从writer转向readerSystemsArbitrary graphs(任意拓扑结构)Computational model: functional composition(计算模型: 功能组合)8/6/202212Patterns of Data Flow in Systems

12、In general, data can flow in arbitrary patterns(一般情况,数据的流向无序)Often we are primarilyinterested in nearly linear data flow systems(我们主要研究近似线性数据流)or in very simple, highly constrained cyclic structures(或者是在限度内的循环数据流)8/6/202213Control Flow vs. Data FlowControl Flow (typical case in procedural systems)Do

13、minant question is how locus of control moves through the program主要问题是控制点怎样在程序或系统之间移动Data may accompany the control but is not the driving force数据可能跟着控制走,但是并不起推动系统运转的作用Primary reasoning is about order of computation关注的核心是计算顺序8/6/202214Control Flow vs. Data FlowData FlowDominant question is how data

14、moves through a collection of (atomic) computations主要问题是数据怎样在运算单元之间流动As data moves, control is “activated”数据到了,控制(计算)单元便开始工作We reason about data availability, transformations, latency,我们关心数据是否可用,转换,潜伏8/6/202215Three Examples of Data FlowBatch Sequential(批处理)Pipe-and-Filter(管道)Process Control(控制)8/6/

15、202216Batch Sequential Pattern8/6/202217Characteristics of Batch Sequential SystemsProcessing steps are independent programs每个处理步骤是一个独立的程序Each step runs to completion before next step starts每一步必须在前一步结束后才能开始Data transmitted as a whole between steps数据必须是完整的,以整体的方式传递Typical applications:classical data

16、processingprogram compilation/computer aided software engineering8/6/202218Characteristics of Batch Sequential SystemsArchitectural Heuristicscomponents (processing steps) are independent programsconnectors are some type of media - traditionally magnetic tapeeach step runs to completion before the n

17、ext step begins8/6/202219Example: Batch Sequential SystemsCompilersearly compilers began as essentially batch sequential systemslexical analysis, parsing, semantic analysis, code generationinitially a mechanism to turn higher level source code into object codeComputer Aided Software EngineeringCASE

18、tools initially provided an environment to write and compile source code into object codecompiler, library, linker, make, into an integrated toolearly tools were independent programslater tools shared only filescommon formats, simple sharing mechanisms, scriptseventually tools grew to include design

19、, documentation, configuration control, and even automatic code generation8/6/202220Three Examples of Data FlowBatch Sequential(批处理)Pipe-and-Filter(管道)Process Control(控制)8/6/202221Pipe-and-Filter8/6/202222Pipes and FiltersRole of (“pure”) filtersreads streams of data as input, produces streams of da

20、ta as outputtraditionally byte-orientedperforms stream-to-stream transformationsenrich data by computation and adding information通过计算和增加信息丰富数据refine by distilling data or removing irrelevant data通过浓缩和删除精炼数据transform data by changing its representation通过改变记录方式转化数据8/6/202223Pipes and Filtersincrementa

21、lly transform data from the source to the sink(递增地转化数据)data is processed as it arrives, not gathered then processed数据到来时便被处理,不是收集然后处理(偶有例外)filters are independent entitiesno context in processing streamsno state preservation between instantiationsno knowledge of upstream/downstream filtersthe correc

22、tness of the output should not depend upon the order in which the pipes are connected in a pipe-and-filter network过滤器的先后顺序不影响输出的结果8/6/202224Pipe-and-FilterRole of (“pure”) pipes (SG96)move data from a filter output to a filter input (or to a device or file)data moves in one direction, upstream flow

23、control is allowedpipes form data transmission graphsOverall Operationsystem action is mediated by data delivery数据传送引起系统动作pipe-and-filter systems run until no more data is available and no more computations possible8/6/202225“Pipes” and “Filters” in unixunix processes that transform stdin to stdout

24、are generally called filtersbut when they consume all the input before starting the output, they violate the filter assumptionsort, for exampleunix pipes can treat files as well as filters as data sources and sinksbut files are passive, so you cant make arbitrary combinationsunix assumes that the pi

25、pes carry ASCII character streamsthe good news: anything can connect to anything elsethe bad news: everything must be encoded in ASCII, then shipped, then decoded8/6/202226“Pipes” and “Filters” in unix8/6/202227Issue: Data Pulling and Data PushingQuestion: what is the force that makes the data flow?

26、Three choices, all with force emanating from filters:push: data source pushes data in downstream directionpull: data sink pulls data from upstream directionpush/pull: a filter is actively pulling from upstream, computing, and pushing downstreampassive: dont do either, act as a sink for dataCombinati

27、ons may be complex. If more than one filter is pushing/pulling, synchronization is neededSo: Why cant you pipe a a unix?8/6/202228Batch Sequential vs Pipe & Filter8/6/202229Batch Sequential vs Pipe & Filter (UNIX)BothDecompose task into fixed sequence of computations Interact only through data passe

28、d from one to another把任务分解成为一系列固定顺序的计算单元(组件),组件间只通过数据传递交互8/6/202230Batch Sequential vs Pipe & Filter (UNIX)Batch SequentialPipe/FiltertotalincrementalHigh latency (real-time is hard)Results start immediatelyRandom access to input okProcessing localized in inputNo concurrencyFeedback loops possibleNo

29、n-interactiveOften interactive, awkwardly8/6/202231A Variant on Data FlowIssue: in some systems,Data flows slowly through the systemData does not remain strictly in order8/6/202232Summary: Guidance for Selecting a Data Flow Styletask is dominated by the availability of data任务由数据主导data can be moved predictably from process to process事先知道数据的确切流向pipe-and-filter architectures are good choices for many data flow applicati

温馨提示

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

评论

0/150

提交评论