第二讲 计算机系统结构 本讲主要内容: 计算机系统操作 I/O 结构 存储系统的结构 分级的存储体系 硬件保护 一般的系统结构 作业:

Slides:



Advertisements
Similar presentations
1 I/O 设备访问方式和类型. 2 Overview n The two main jobs of a computer: l I/O (Input/Output) l processing n The control of devices connneted to the computer is.
Advertisements

操作系统概念 第二章:计算机系统结构.
存储基础知识 V1.1.
Chapter 3: Operating-System Structures操作系统结构
CHAPTER 9 虛擬記憶體管理 9.2 分頁需求 9.3 寫入時複製 9.4 分頁替換 9.5 欄的配置法則 9.6 輾轉現象
Foundations of Computer Science
操作系统结构.
CHAP 2 Computer-System Structures 计算机系统结构
Chapter 2: Computer-System Structures计算机系统结构
最新計算機概論 第3章 計算機組織.
Chapter 9: Memory Management
大数据在医疗行业的应用.
性能测试培训 在组设置中可使用此模板作为演示培训材料的起始文件。 节
Operating System Process Management - 4 Monday, August 11, 2008.
Group multicast fanOut Procedure
指導教授:許子衡 教授 報告學生:翁偉傑 Qiangyuan Yu , Geert Heijenk
CH.2 Introduction to Microprocessor-Based Control
Operating System Concepts 作業系統原理 Chapter 3 行程觀念 (Process Concept)
Windows Vista 操作系统最新安全特性
现场总线Fieldbus.
第六章 应用程序结构.
網路技術管理進階班---區域網路的技術發展
BTS3911E 一体化站点解决方案 支持UL平滑演进,降低CAPEX 小站点,大容量,提升用户体验 高集成度 ,降低部署成本
Applied Operating System Concepts
簡易 Visual Studio 2010 C++ 使用手冊
CHAPTER 8 VIRTUAL MEMORY
5 Computer Organization (計算機組織).
SOLUTIONACCELERATORS Windows Vista Hardware Assessment 1
Operating System Concepts 作業系統原理 CHAPTER 2 系統結構 (System Structures)
Flash数据管理 Zhou da
Operating System Internals and Design principles
Protective Packaging and Materials Handling 保护性包装和物料搬运
第五章 MSP430中斷式數位I/O.
第4章 网络互联与广域网 4.1 网络互联概述 4.2 网络互联设备 4.3 广域网 4.4 ISDN 4.5 DDN
HLA - Time Management 陳昱豪.
Computer Organization
Chapter 3 行程觀念 (Process Concept)
微程序控制器 刘鹏 Dept. ISEE Zhejiang University
Ch 9: Input/Output System 输入/输出系统
组合逻辑3 Combinational Logic
存储系统.
預官考試輔導 計算機概論提要 91年12月4日.
第三章 基本觀念 電腦繪圖與動畫 (Computer Graphics & Animation) Object Data Image
第五章,抢占式调度(lab3).
软件工程 Software Engineering
CPU结构和功能.
單元11: 事件結構 主題: a. 事件結構概述 b. 如何使用事件結構 c. 使用事件結構須注意的事項.
Operating System Principles 作業系統原理
第3章 認識處理元.
計算機概論 第3章 計算機組織與結構概觀.
Unit 11.Operating System 11.1 What’s OS 11.2 Related Courses
Westmont College 网络应用软件 第一讲 (客户-服务器 概念, 协议端口的使用, 套接字API)
資料庫 靜宜大學資管系 楊子青.
Version Control System Based DSNs
Operation System(OS).
The Processor: Datapath and Control (Multi-cycle implementation)
5-6 串列埠模式0輸出埠擴充實習.
中国科学技术大学计算机系 陈香兰 2013Fall 第七讲 存储器管理 中国科学技术大学计算机系 陈香兰 2013Fall.
虚 拟 仪 器 virtual instrument
中国科学技术大学计算机系 陈香兰 Fall 2013 第三讲 线程 中国科学技术大学计算机系 陈香兰 Fall 2013.
计算机系统结构(2012年春) ----存储层次: Cache基本概念
Process Description And Control
第10章 存储器接口 罗文坚 中国科大 计算机学院
计算机问题求解 – 论题1-5 - 数据与数据结构 2018年10月16日.
CHAPTER 6 Concurrency:deadlock And Starvation
TinyDB資料庫 靜宜大學資管系 楊子青.
Operating System Software School of SCU
Race Conditions and Semaphore
MGT 213 System Management Server的昨天,今天和明天
Experimental Analysis of Distributed Graph Systems
Presentation transcript:

第二讲 计算机系统结构 本讲主要内容: 计算机系统操作 I/O 结构 存储系统的结构 分级的存储体系 硬件保护 一般的系统结构 作业:   第二章 2, 3, 4, 5,6,7,8,9,10 Operating System Concepts

计算机系统结构 Operating System Concepts

计算机系统操作 I/O设备和CPU可以并行地执行。 每一个设备控制器负责管理一种特定的设备。 设备控制器通常都有本地的缓冲。 CPU moves data from/to main memory to/from local buffers。 CPU需要在主存和设备控制器的本地缓冲之间传送数据。 I/O is from the device to local buffer of controller. I/O就是从设备到控制器的本地缓冲之间传送数据。 Device controller informs CPU that it has finished its operation by causing an interrupt. 设备控制器在完成I/O操作后通过中断通知CPU . Operating System Concepts

Common Functions of Interrupts 中断处理的公共操作 Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. 中断一般来说通过中断向量将CPU的控制转移给中断服务程序。中断向量包含有所有的服务程序的地址。 Interrupt architecture must save the address of the interrupted instruction. 中断处理的结构要保存被中断的指令的地址。 Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt. 当一个中断被处理时,新进来的中断被关闭,以避免中断请求丢失。 A trap is a software-generated interrupt caused either by an error or a user request. 陷阱是由软件产生的中断,通常是由执行指令的错误或用户的请求(执行陷阱指令)产生的。 An operating system is interrupt driven. 操作系统都是中断驱动的。 Operating System Concepts

Interrupt Handling 中断处理 The operating system preserves the state of the CPU by storing registers and the program counter. 操作系统通过存储寄存器和程序计数器来保存CPU的状态。 Determines which type of interrupt has occurred(决定中断的类型的方法): Polling 轮询 vectored interrupt system 中断向量 Separate segments of code determine what action should be taken for each type of interrupt 单独的代码段决定对每一种中断类型要采取什么操作。 Operating System Concepts

Interrupt Time Line For a Single Process Doing Output 单个进程做输出操作的时序图 Operating System Concepts

I/O Structure I/O结构 After I/O starts, control returns to user program only upon I/O completion. I/O操作开始后,CPU的控制只有在I/O操作完成后才返回用户程序。 Wait instruction idles the CPU until the next interrupt 等待指令在下一次中断开始之前使CPU处于空等状态。 Wait loop (contention for memory access). 当访问存储器冲突时,就插入等待节拍。 At most one I/O request is outstanding at a time, no simultaneous I/O processing. 任何时候最多只有一个中断请求处于处理状态。 After I/O starts, control returns to user program without waiting for I/O completion. I/O操作开始后,CPU的控制不等I/O操作完成就交给用户程序。 System call – request to the operating system to allow user to wait for I/O completion. 系统调用-请求操作系统容许用户等待I/O完成。 Device-status table contains entry for each I/O device indicating its type, address, and state.设备状态表中每个I/O设备包含一个项目表明设备的类型,地址和状态。 Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt. 操作系统访问I/O设备表决定设备的状态,修改表项以加入中断。 Operating System Concepts

Two I/O Methods 两种方法 Synchronous同步 Asynchronous异步 Operating System Concepts

Device-Status Table 设备状态表 Operating System Concepts

Direct Memory Access Structure 直接访问存储器的结构 Used for high-speed I/O devices able to transmit information at close to memory speeds. 用于高速I/O设备,以接近存储器速度和、传送信息。 Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. 设备控制器不需要CPU的干预将一块数据从缓冲直接传送到存储器。 Only on interrupt is generated per block, rather than the one interrupt per byte. 每个数据块只产生一个中断,而不是每个字节产生一个中断。 Operating System Concepts

Storage Structure 存储结构 Main memory – only large storage media that the CPU can access directly. 主存-CPU可以直接访问的存储介质。 Secondary storage – extension of main memory that provides large nonvolatile storage capacity. 二级存储器-主存的扩展,提供大容量的永久存储。 Magnetic disks – rigid metal or glass platters covered with magnetic recording material 磁盘-硬金属或玻璃上覆盖磁记录材料。 Disk surface is logically divided into tracks, which are subdivided into sectors. 磁盘的表面从逻辑上分成磁道,磁道分为扇区。 The disk controller determines the logical interaction between the device and the computer. 磁盘控制器决定设备和计算机之间逻辑上相互作用。 Operating System Concepts

Moving-Head Disk Mechanism 磁盘磁头移动的机制 Operating System Concepts

Storage Hierarchy 分级的存储系统 Storage systems organized in hierarchy. 存储系统根据以下因素组织成分级体系: Speed 速度 Cost 成本 Volatility 非易失(永久存储) Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage. 高速缓存-将信息拷贝到快速的存储系统。主存可以二级存储器的上一级的高速缓冲。 Operating System Concepts

Storage-Device Hierarchy 分级存储设备 Operating System Concepts

Caching 缓冲 Use of high-speed memory to hold recently-accessed data. 用高速主存保存最近访问的数据。 Requires a cache management policy. 要求高速缓冲的策略。 Caching introduces another level in storage hierarchy. This requires data that is simultaneously stored in more than one level to be consistent.  Operating System Concepts

Migration of A From Disk to Register 将A从磁盘迁移到寄存器 Operating System Concepts

Hardware Protection 硬件保护 Dual-Mode Operation 双模式操作 I/O Protection I/O保护 Memory Protection 存储保护 CPU Protection CPU保护 Operating System Concepts

Dual-Mode Operation 双模式操作 Sharing system resources requires operating system to ensure that an incorrect program cannot cause other programs to execute incorrectly. Provide hardware support to differentiate between at least two modes of operations. 1. User mode – execution done on behalf of a user. 2. Monitor mode (also kernel mode or system mode) – execution done on behalf of operating system. Operating System Concepts

Dual-Mode Operation (Cont.) 双模式操作(续) Mode bit added to computer hardware to indicate the current mode: monitor (0) or user (1). When an interrupt or fault occurs hardware switches to monitor mode. 中断或异常 monitor user 设置用户模式 特权指令只有在管态或核心模式下才能执行。 Operating System Concepts

I/O Protection I/O保护 All I/O instructions are privileged instructions. 所有的I/O指令都是特权指令。 Must ensure that a user program could never gain control of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector). 必须确保用户程序不能获得核心模式(即用户程序不能将中断向量表修改成用户程序的地址) Operating System Concepts

Use of A System Call to Perform I/O 使用系统调用执行I/O操作 Operating System Concepts

Memory Protection 内存保护 Must provide memory protection at least for the interrupt vector and the interrupt service routines. 至少要为中断向量表和中断服务程序提供存储保护。 In order to have memory protection, add two registers that determine the range of legal addresses a program may access: 为了提供存储保护,使用以下两个寄存器决定程序可以访问的合法的地址 Base register – holds the smallest legal physical memory address. 基址寄存器-保存最小的合法的物理内存的地址 Limit register – contains the size of the range 界限寄存器-表示合法地址的范围 Memory outside the defined range is protected. 存储器超出定义的范围就受到保护。 Operating System Concepts

Use of A Base and Limit Register 使用基址寄存器和界限寄存器 Operating System Concepts

Hardware Address Protection 硬件地址保护 Operating System Concepts

Hardware Protection 硬件保护 When executing in monitor mode, the operating system has unrestricted access to both monitor and user’s memory. 当操作系统在管态下执行时,系统和用户的存储空间都有没有限制的访问权限。 The load instructions for the base and limit registers are privileged instructions. 装载基址寄存器和界限寄存器的指令为特权指令。 Operating System Concepts

CPU Protection CPU保护 Timer – interrupts computer after specified period to ensure operating system maintains control.时间中断:计算机在给定的时间间隔后产生中断,时间中断是确保操作系统维护系统控制的重要中断。 Timer is decremented every clock tick. 时间中断计时在每个时间节拍减一。 When timer reaches the value 0, an interrupt occurs. 当时间中断计时回零时,就产生中断。 Timer commonly used to implement time sharing. 时间中断用来实现分时系统。 Timer also used to compute the current time. 时间中断还用来计算系统的时间。 Load-timer is a privileged instruction. 设置系统时间是特权指令。 Operating System Concepts

Network Structure 网络结构 Local Area Networks (LAN) 局域网 Wide Area Networks (WAN) 广域网 Operating System Concepts

Local Area Network Structure 局域网结构 Operating System Concepts

Wide Area Network Structure 广域网结构 Operating System Concepts