软件体系结构 信息共享体系结构 Shared Information 孙志岗 sun@hit.edu.cn
Where are we? 2019/2/23 © sun@hit.edu.cn
Families of Architectural Styles 2019/2/23 © sun@hit.edu.cn
Families of Architectural Styles 2019/2/23 © sun@hit.edu.cn
Families of Architectural Styles 2019/2/23 © sun@hit.edu.cn
Families of Architectural Styles 2019/2/23 © sun@hit.edu.cn
Shared Information Systems Style represents a large variety of systems 这种风格描绘很多种系统 many variants depending on nature of shared data 共同特点是共享数据 Style addresses mechanisms for: 风格说明其运行机制是 collecting, manipulating and preserving large bodies of data 收集、操作、保存大量的数据 Databases are a natural example, but not the only one 数据库是一个典型的例子,但不是仅有的例子 we’ll see others in this lecture 2019/2/23 © sun@hit.edu.cn
Shared Information Systems High level view what are the apparent features of this style? 风格的明显特点是什么? what are some issues regarding this style? 这种这个风格有什么可研究的问题? 2019/2/23 © sun@hit.edu.cn
Shared Information Systems Advantages easy to add consumers and producers of data 很容易增加数据的生产者和消费者 How about modifier? Issues synchronization(同步) configuration and schema management(配置和管理) atomicity(原子性) consistency(一致性) persistence(持久性) performance(性能) 2019/2/23 © sun@hit.edu.cn
Shared Information Systems Lineage Earliest repositories appear in batch sequential systems 早期的仓库出现在批处理系统 mainframes, drums, magnetic tapes, disc drives resources manually managed 人工调配资源 Pressure for on-line access to data 迫切需要数据即时存取 requirement to make access to data easy and instant 简捷地数据存取 help to drive the shift from batch-sequential to interactive processing 促进了从批处理到交互式处理的转变 2019/2/23 © sun@hit.edu.cn
Shared Information Systems Lineage Today shared information systems appear everywhere from the smallest business, to the most advanced scientific applications 从最小的商业应用到最顶尖的科学应用,信息共享无处不在 many applications provide access mechanisms to shared data 很多应用提供对共享数据的存取机制 the Web has become a giant distributed repository Web成为庞大的分布式仓库 2019/2/23 © sun@hit.edu.cn
Evolution of Shared Information Systems Batch Sequential Systems flat file access (I/O) 书P72图,P74图 2019/2/23 © sun@hit.edu.cn
Early File Access In the earliest systems, code had to be written to position the media, read the data, and do any associated “house cleaning” operations. 早期的系统,很难编写代码来完成定位存储介质、读数据等操作 2019/2/23 © sun@hit.edu.cn
Early File Access Advances in OS development focused on the abstraction of devices the demand to use external data helped to drive the development of more capable file systems flat file systems - one level of directories that contain only files hierarchical file systems - directories that can contain files and more directories language and OS support for many file types and file access methods 问题: 开发者必须知道文件的确切结构,自己决定如何访问、检索文件 多任务下还要考虑互斥 纯文件的bbs->web+db论坛,dablio服务器 2019/2/23 © sun@hit.edu.cn
Evolution of Shared Information Systems Datapool (Shared Memory) Example: Enabled by availability of RAM and languages to permit the sharing of common data (E.g., FORTRAN COMMON BLOCK) Processes are not necessarily sequential Gets messy without implementation rules - what are the issues? 2019/2/23 © sun@hit.edu.cn
Repository Architecture Database开始爆炸,版本众多 2019/2/23 © sun@hit.edu.cn
Unified Schemas for Integrating Databases Abstraction: multiplex the databases; put filters on the query/update to match diverse views 抽象: 复合多个数据库; 在查询/更新操作中 增加过滤器来匹配 不同的视图 schemas固定,用户必须事先想好 2019/2/23 © sun@hit.edu.cn
Multi-databases 2019/2/23 © sun@hit.edu.cn
Evolving Database Architectures Batch processing: Standalone programs (独立的程序) results were passed from one to another on magtape (结果通过磁带从一个程序传到另一个程序) batch sequential model (批处理风格) Interactive processing: concurrent operation and faster updates preclude batching, so updates are out of synch with reports. 并行操作、更快的更新速度,但是使更新和报告难以保持同步。 Repository model with external control (仓库风格) Problem: information became distributed among many different DBs. 新问题:信息分布到很多不同的数据库 2019/2/23 © sun@hit.edu.cn
Evolving Database Architectures Unified schemas: create one virtual database by defining (passive) consistent conversion mappings to multiple DBs 建立一个虚拟数据库,定义到多个数据库的静态映射 Multi-database: DBs have many users; passive mappings don‘t suffice; use active agents. 数据库有很多用户;静态映射不满足要求;使用活动的代理。 “Layered” hierarchy 层次风格 2019/2/23 © sun@hit.edu.cn
Computer Aided Software Engineering Initially just translation from source to object code: compiler, library, linker, make 起初,就是做从源代码到目标代码的转换 Grew to include design record, documentation, analysis, configuration control, incrementality 开始包含分析、设计、调试、测试、文档、配置管理、增量编译等功能 Integration demanded for 20 years, but not here yet. 集成已经作了20年,但还没有结束 2019/2/23 © sun@hit.edu.cn
CASE vs. DBMS As compared to databases, CASE has: more types of data 更多的数据类型 fewer instances of each type 更少的数据类型实例 slower query rates 更慢的查询频率 larger, more complex, less discrete information 更大,更复杂,更集中的信息 but not shorter lifetime 生命周期没有更短 2019/2/23 © sun@hit.edu.cn
Traditional Compiler 2019/2/23 © sun@hit.edu.cn
Example: Modern Canonical Compiler 2019/2/23 © sun@hit.edu.cn
Canonical Compiler 2019/2/23 © sun@hit.edu.cn
Software Tools with Shared Representation 2019/2/23 © sun@hit.edu.cn
Evolution of CASE Environments Evolution is much like databases: Interaction: batch --> interactive 交互:批处理交互式 Granularity: complete processing -->incremental 粒度:完全处理增量 Coverage: compilation --> full life cycle 覆盖:编译全生命周期 Like databases, started with batch sequential style 从批处理风格开始 Integration needs led to repositories with rigid control, then to open systems in layers 对集成性的要求,促成了仓库风格被应用,让系统开始分层 2019/2/23 © sun@hit.edu.cn
Varieties of Repositories Discriminate on control strategy(在控制策略上的区别) Predetermined by designer (设计者预先定义好) Compilers Driven by types of information in input stream 输入流的信息类型决定 Database transaction system Driven by availability of new information from other parts of the system (系统其他部分的新信息决定) Scratchboard (刮板) Opportunistic: driven by state of computation 机会主义:计算的状态决定 Blackboard 2019/2/23 © sun@hit.edu.cn
Repository (Blackboard) 要有一个模块来控制哪个ks工作 2019/2/23 © sun@hit.edu.cn
The Blackboard Model Knowledge Sources Blackboard Data Structure Problem-appropriate knowledge partitioned into separate, independent computations 把问题分成几个部分,每个部分独立计算 React to changes in blackboard 响应黑板上的变化 Blackboard Data Structure Global database containing entire state of problem solution 全局数据库包含解域的全部状态 Only means by which knowledge sources interact 知识源互相作用的唯一媒介 Control Knowledge sources respond “opportunistically” 让知识源响应偶然事件 2019/2/23 © sun@hit.edu.cn
The Blackboard Model 2019/2/23 © sun@hit.edu.cn
Blackboard Architecture Key ideas knowledge shared and distributed among some number of cooperating processes 知识在一些协作的processes之间共享和分布 opportunistic processing of data 机会主义地处理数据 The Blackboard Architecture have 3 major components knowledge sources (知识源) blackboard (黑板) control (控制) Historical examples: Hearsay I, Hearsay II, HASP/SAIP, CRYSALIS, ATOME Originally most were from signal processing/interpretation domains (信号处理、专家系统、模式识别领域经常采用) 2019/2/23 © sun@hit.edu.cn
Blackboard Architecture 2019/2/23 © sun@hit.edu.cn
Blackboard Problem Characteristics no direct algorithmic solution 没有直接的算法可解 multiple approaches to solving the problem 多种方法都可能解决问题 various domain expertise required to solve the problem 需要多个领域的专门知识协作解决 uncertainty error and variability in data and solution 数据和解决方法可能错误或变化 moderate to low “signal-to-noise-ratio” in data 数据中信噪比的变化 Uncertainty interferes with algorithmic solutions 算法接口的变化 2019/2/23 © sun@hit.edu.cn
Blackboard Problem Characteristics “Best-effort” or approximation is good enough no single discrete answer to problem, or “right” answer may vary 问题没有唯一的解答,或者“正确”答案会变化 examples signal processing (信号处理) problem solving (planning, logistics, diagnostics) compiler optimization 2019/2/23 © sun@hit.edu.cn
Knowledge Sources Objective: Representation: Action: Responsibility: contribute knowledge that leads to solution 提供解决问题的知识 Representation: procedures, sets of rules, logic assertions 过程、规则、逻辑断言 Action: modify only the blackboard (or control data -- magic) 只修改黑板 Responsibility: know when it’s possible to help 知道何时能发挥作用 Selection: loosely-coupled subtasks, or areas of specialization 低耦合的子任务,或者有特别的能力 2019/2/23 © sun@hit.edu.cn
Blackboard Data Structure Objective: hold data for use by knowledge sources 保存知识源要使用的数据 Representation: stores objects from solution space, including 保存来自解空间的数据,包括 input data, partial solutions, alternatives, final solutions, control data objects and properties define the terms of the discourse relationships are denoted by named links (“next-to”, “part-of”) Organization: hierarchical, possibly multiple hierarchies; links between objects on same or different levels 分层;链接同层或不同层的对象 2019/2/23 © sun@hit.edu.cn
Control Objective: Representation: Remark: make knowledge sources respond opportunistically 让知识源响应偶然事件 Representation: keeps various sorts of information about which knowledge sources could operate and picks a sequence that allows the solution process to proceed a step at a time 了解各个知识源的能力,决策解决问题的步骤 Remark: the control mechanisms are thoroughly ad hoc 控制机制是彻底的与时俱进 2019/2/23 © sun@hit.edu.cn
Example:The Puzzle Metaphor 2019/2/23 © sun@hit.edu.cn
Example:The Puzzle Metaphor Data within the blackboard is often structured hierarchically Level 4 assemble chunks Level 3 build chunks of edges build chunks of sky Level 2 collect edge pieces collect sky pieces Level 1 Turn all pieces picture side up 2019/2/23 © sun@hit.edu.cn
Hearsay II Complex blackboard system to deal with arbitrary speech recongition (a difficult problem): Ambiguity in segmentation(音节分割问题): “Mary’s truck” versus “Mary struck” Ambiguity in stress(重音问题): “disease” versus “dizzies” Ambiguity in grammar(语法问题): “The horse raced past the barn fell” Ambiguity in semantics(语义问题): “I saw the man on the hill with the binoculars” 2019/2/23 © sun@hit.edu.cn
Problem Solving Strategy Had to be incremental, opportunistic, flexible 必须是增量的、机会的、灵活的 Hearsay-II employed several strategies: Bottom-up (synthetic) Top-down (analytic) General hypothesize-and-test (猜测和测试) Blackboard structure entertained many simultaneous hypotheses 黑板结构可以同时处理多种假设 Control was complex: had a monitor portion and a priority based scheduler 控制很复杂:有一个监视器,采用基于优先级的调度 2019/2/23 © sun@hit.edu.cn
Hearsay II Structure 2019/2/23 © sun@hit.edu.cn
Lecture Summary Repositories are ubiquitous in computer-based applications. 仓库在计算机应用中几乎无处不在 Shared information systems in many areas show similar trends, stimulated by similar technological and business pressures. 信息共享系统在很多领域有相似的发展趋势,因为有相似的技术和商业压力的激励 Blackboards are specialized types of repositories for dealing with “messy” information processing domains where the control strategy must be opportunistic. 黑板是一种特别的仓库,主要用于需要对凌乱的信息进行处理的领域,其控制策略必须是机会主义的 2019/2/23 © sun@hit.edu.cn