软件体系结构过程调用体系结构CallReturnSystems.ppt
《软件体系结构过程调用体系结构CallReturnSystems.ppt》由会员分享,可在线阅读,更多相关《软件体系结构过程调用体系结构CallReturnSystems.ppt(71页珍藏版)》请在三一文库上搜索。
1、软件体系结构 过程调用体系结构 Call/Return Systems,孙志岗 , ,2,2019/4/16,History,Main program and subroutines Decomposition into processing steps with single-threaded control 单线程控制,划分为若干处理步骤 Functional modules Aggregation of processing steps into modules 把处理步骤集成到模块内 Abstract Data Types Bundle operations and data, hid
2、e representations and other secrets 操作和数据捆绑在一起,隐藏实现和其他秘密, ,3,2019/4/16,History,Objects Methods (bound dynamically), polymorphism (subtypes), reuse (through inheritance) 方法(动态绑定),多态(子类),重用(继承) OO Architectures Objects as separate processes/threads 对象活动与不同的进程/线程 Client-server, tiered styles Components
3、 Multiple interfaces, binary compatibility, advanced middleware (多个接口,二进制兼容,高级中间件), ,4,2019/4/16,Main Program and Subroutine, ,5,2019/4/16,Main Program and Subroutine,Hierarchical decomposition: 逐步分解 Based on definition-use relationship 基于定义使用关系 Uses procedure call as interaction mechanism 用过程调用作为交互
4、机制 Single thread of control: 单线程控制 Supported directly by programming languages 程序设计语言直接支持, ,6,2019/4/16,Main Program and Subroutine,Hierarchical reasoning: 推论 Correctness of a subroutine depends on the correctness of the subroutines it calls 子程序的正确性取决于它调用的子程序的正确性 Subsystem structure implicit: 子系统的结构
5、不清晰 Subroutines typically aggregated into modules 子程序通常合成为模块, ,7,2019/4/16,Main Program and Subroutine, ,8,2019/4/16,Criteria for Modularization,What is a module? Common view: a piece of code. Too limited. Compilation unit, including related declarations and interface (编译单元,包含相关的声明和接口) Parnas: a uni
6、t of work. Why modularize a system, anyway? Management: Partition the overall development effort divide and conquer (分而治之) Evolution: Decouple parts of a system so that changes to one part are isolated from changes to other parts 进化:降低模块间的耦合度,使改变一个模块不会影响其他 Understanding: Permit system to be understo
7、od as composition of mind-sized chunks 理解:系统可以被理解成若干个易于理解的模块的组合 Key issue: what criteria to use for modularization, ,9,2019/4/16,Modularization Problems,Access to internal representation: Vulnerability: Visible representations can be manipulated in unexpected, undesired, and dangerous ways Nonlocali
8、ty: If the way something is used depends on its implementation, you must find all uses to change it (e.g. Y2K) Forced distribution of knowledge: Non-uniform referents: Syntax may reveal structure (If you export a data structure, how does its user iterate through it?), ,10,2019/4/16,Modularization Pr
9、oblems,Coupling: Instance dependence: When multiple instances of a given structure are active, they must remain independent Families of definitions: (众说纷纭) Dynamic binding: If shared definitions involve type variants, function variants must be chosen at run-time, ,11,2019/4/16,Module Decomposition,P
10、arnas Hide secrets. OK, whats a “secret”? Representation of data Properties of a device, other than required properties Mechanisms that support policies Try to localize future change Hide system details likely to change independently 把可能改变的系统细节分别隐藏 Expose in interfaces assumptions unlikely to change
11、 把改变的可能不大的放到接口当中 Use functions to allow for change Theyre easier to change than visible representation, ,12,2019/4/16,Key Word In Context (KWIC),Problem Description: “The KWIC index system accepts an ordered set of lines, each line is an ordered set of words, and each word is an ordered set of chara
12、cters. KWIC索引系统接受一些行,每行有若干字,每个字由若干字符组成 Any line may be circularly shifted by repeatedly removing the first word and appending it at the end of the line. 每行都可以循环移位。重复地把第一个字删除,然后接到行末 The KWIC index system outputs a listing of all circular shifts of all lines in alphabetical order.“ KWIC把所有行的各种移位情况按照字母
13、表顺序输出, ,13,2019/4/16,Key Word In Context (KWIC),Inputs: Sequence of lines Pipes and Filters Architectures for Software Systems Outputs: Sequence of lines, circularly shifted and alphabetized and Filters Pipes Architectures for Software Systems Filters Pipes and for Software Systems Architectures Pip
14、es and Filters Software Systems Architectures for Systems Architectures for Software, ,14,2019/4/16,Design Considerations,Change in Algorithm Eg., batch vs incremental Change in Data Representation Eg., line storage, explicit vs implicit shifts Change in Function Eg., eliminate lines starting with t
15、rivial words Performance Eg., space and time Reuse Eg., sorting, ,15,2019/4/16,Solution 1,Decompose the overall processing into a sequence of processing steps. Read lines; Make shifts; Alphabetize; Print results Copy data in modules 数据在每个模块内拷贝 Determine the representation of data between neighbors.
16、相邻模块间约定好数据格式 Usually use the same representation of data for all modules 通常完全采用相同的数据格式,也最好这样做, ,16,2019/4/16,Solution 1:Modularization,Module 1:Input Read data lines and pass to the next module 按行读取数据,传递给下一模块 Module 2:Circular Shift The first lines coming make it work 第一行数据到来后开始运作 Transmit the old a
17、nd new lines to the next 把原始数据行,和新的移位后的行输出给下一模块 Module 3:Alphabetize Collect data lines, buffer. All done, begin to work 接收行数据,缓存。当数据都到达后,开始排序 Finish, output results 排序完毕,输出结果, ,17,2019/4/16,Solution 1:Modularization,Module 4:Output Called after Alphabetization 排序后被调用 Read sorted data lines, print f
18、ormatted output 读取排序生成的数据,逐行格式化输出, ,18,2019/4/16,Architecture of Solution 1, ,19,2019/4/16,Properties of Solution 1,Concurrent partly 部分并行处理 Use lots of memory 空间消耗很大 Every modules should know the representation of data 每个模块都必须知道输入和输出的数据格式, ,20,2019/4/16,Solution 2,Decompose the overall processing i
19、nto a sequence of processing steps. Read lines; Make shifts; Alphabetize; Print results Each step transforms the data completely. 每一步完全转换数据 Intermediate data stored in shared memory. Arrays of characters with indexes 带索引的字符数组 Relies on sequential processing 串行处理, ,21,2019/4/16,Solution 2:Modularizat
20、ion,Module 1: Input Reads data lines and stores them in “core”. Storage format: 4 chars/machine word; array of pointers to start of each line. Module 2: Circular Shift Called after Input is done. Reads line storage to produce new array of pairs: (index of 1st char of each circular shift, index of or
21、iginal line) Module 3: Alphabetize Called after Circular Shift. Reads the two arrays and produces new index., ,22,2019/4/16,Solution 2:Modularization,Module 4: Output Called after alphabetization and prints nicely formatted output of shifts Reads arrays produced by Modules 1 & 3 Module 5: Master Con
22、trol Handles sequencing of other modules Handles errors, ,23,2019/4/16,Architecture of Solution 2, ,24,2019/4/16,Properties of Solution 2,Batch sequential processing. Uses shared data to get good performance. 用共享数据获得性能 Processing phases handled by control module. So has some characteristics of main
23、program subroutine organization. Depends critically on single thread of control. Shared data structures exposed as inter-module knowledge. 共享数据的结构是所有模块必须知道的 Design of these structures must be worked out before work can begin on those modules. 数据结构的设计必须在其他模块设计开始之前进行, ,25,2019/4/16,Solution 3,Maintain
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 软件 体系结构 过程 调用 CallReturnSystems
链接地址:https://www.31doc.com/p-2603999.html