Chap 3 Operating-System Structures 操作系统结构

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

云计算辅助教学风云录 黎加厚 上海师范大学教育技术系 2010年8月9日.
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计算机系统结构
Scrum 实践.
B500 主控制程序 B5000 Master Control Program
天文望远镜集成建模研究 杨德华 南京天文光学技术研究所 30 NOV, 年中国虚拟天文台年会 广西师范大学 桂林
59 中 张丽娟 学习目标: 1. 识记并理解运用 6 个单词和 5 个短语。 (source, accessible, network, access, via, create come up with, from the moment on, consist of, go down , at the.
云实践引导产业升级 沈寓实 博士 教授 MBA 中国云体系产业创新战略联盟秘书长 微软云计算中国区总监 WinHEC 2015
Operating System Process Management - 4 Monday, August 11, 2008.
Operating System CPU Scheduing - 2 Monday, August 11, 2008.
Operating System CPU Scheduing - 3 Monday, August 11, 2008.
TinyLink: A Holistic System for Rapid Development of IoT Applications
雲端運算虛擬主機技術的發展.
Operating System Concepts 作業系統原理 Chapter 3 行程觀念 (Process Concept)
Windows Vista 操作系统最新安全特性
軟體原型 (Software Prototyping)
網路技術管理進階班---區域網路的技術發展
操作系统课程的特点: 实践性强(从实践总结出原理)
Applied Operating System Concepts
从UNIX到Windows的 电信软件移植实践
Chapter 3 Case Studies.
5 Computer Organization (計算機組織).
附錄 通訊協定堆疊.
Managers and Management
Operating System Concepts 作業系統原理 CHAPTER 2 系統結構 (System Structures)
Operating System Internals and Design principles
Special English for Industrial Robot
Android 课程讲义 智能手机开发
HLA - Time Management 陳昱豪.
Chapter 3 行程觀念 (Process Concept)
微程序控制器 刘鹏 Dept. ISEE Zhejiang University
创建型设计模式.
ICT RTOS Research Group 胡伟平,王剑
Mechanisms and Machine Theory.
SAP 架構及基本操作 SAP前端軟體安裝與登入 Logical View of the SAP System SAP登入 IDES
Chapter 4 多執行緒 (Multi Thread)
重點 資料結構之選定會影響演算法 選擇對的資料結構讓您上天堂 程式.
作業系統 (Operating System)
校園網路架構介紹與資源利用 主講人:趙志宏 圖書資訊館網路通訊組.
第4章(1) 空间数据库 —数据库理论基础 北京建筑工程学院 王文宇.
簡易 Visual Studio 2005 C++ 使用手冊
Operating System Principles 作業系統原理
第3章 認識處理元.
服務於中國研究的網絡基礎設施 A Cyberinfrastructure for Historical China Studies
Unit 11.Operating System 11.1 What’s OS 11.2 Related Courses
資料結構 Data Structures Fall 2006, 95學年第一學期 Instructor : 陳宗正.
SAP R/3架構及前端軟體安裝 Logical View of the R/3 System SAP Frontend 6.2安裝
資料庫 靜宜大學資管系 楊子青.
高正宗 System Consultant Manager
中国科学技术大学计算机系 陈香兰 2013Fall 第七讲 存储器管理 中国科学技术大学计算机系 陈香兰 2013Fall.
虚 拟 仪 器 virtual instrument
中国科学技术大学计算机系 陈香兰 Fall 2013 第三讲 线程 中国科学技术大学计算机系 陈香兰 Fall 2013.
Inheritance -II.
NASA雜談+電腦網路簡介 Prof. Michael Tsai 2015/03/02.
James R. Evans. William M. Lindsay 張倫編譯
CHAPTER 6 Concurrency:deadlock And Starvation
SAP 架構及基本操作 SAP前端軟體安裝與登入 Logical View of the SAP System SAP登入 IDES
Resources Planning for Applied Research
作業系統概論 授課老師: 羅習五.
Operating System Software School of SCU
SAP 架構及前端軟體安裝 Logical View of the SAP System SAP Frontend 7.1安裝 SAP登入
作業系統概論 授課老師: 羅習五.
Requirements for SPN Information Modeling
作业 请您用星级模式评估您自己公司的一致性状况。 您的公司与它的战略执行一致吗?.
Presentation transcript:

Chap 3 Operating-System Structures 操作系统结构 Applied Operating System Concepts

Applied Operating System Concepts Contents内容 System Components系统部件 Operating System Services操作系统服务 System Calls系统调用 System Programs系统程序 System Structure 系统结构 Virtual Machines虚拟机 System Design and Implementation系统设计和实现 Summary(总结) Homework作业 Applied Operating System Concepts

Common System Components 系统部件 Process Management 进程管理 Main Memory Management主存管理 Secondary-Storage Management 二级储存器管理 I/O System Management I/O系统管理 File Management 文件管理 Protection System 保护系统 Networking 网络处理 Command-Interpreter System 命令解释器系统 Applied Operating System Concepts

Process Management 进程管理 A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. 进程是正在执行的程序。为了完成其任务,进程需要一定的资源,包括CPU时间,存储器,文件,以及I/O设备 The operating system is responsible for the following activities in connection with process management. 在同进程管理有关的活动中,操作系统负责下列事务: Process creation and deletion. 进程创建和删除 process suspension and resumption. 进程挂起和恢复 Provision of mechanisms for 可提供以下有关机制: process synchronization 进程同步 process communication 进程通信 Deadlock Handing 死锁处理 Applied Operating System Concepts

Main-Memory Management 主存管理 Memory is a large array of words or bytes, each with its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices.存储器是字或字节的一个大数组,每一字或字节有自己的地址。它是一个可被CPU和I/O 共享、可快速存取数据的存放地。 Main memory is a volatile storage device. It loses its contents in the case of system failure.主存储器是一个易失性存储设备。系统失败时,会丢失内容。 The operating system is responsible for the following activities in connections with memory management: 在同存储管理有关的活动中,操作系统负责下列事务: Keep track of which parts of memory are currently being used and by whom. 保持记录存储器的哪一部分当前被使用以及被谁使用 Decide which processes to load when memory space becomes available.当有可用存储空间时,决定调入哪个进程 Allocate and deallocating memory space as needed. 需要时分配和收回存储空间 Applied Operating System Concepts

Secondary-Storage Management 二级存储管理 Since main memory (primary storage) is volatile and too small to accommodate all data and programs permanently, the computer system must provide secondary storage to back up main memory. 由于主存(基本存储器)是易失性的,而且太小不足以永久保存所有的数据和程序,计算机系统必须提供二级存储器备份主存 Most modern computer systems use disks as the principle on-line storage medium, for both programs and data. 多数现代计算机系统采用磁盘作为程序和数据的基本联机存储介质 The operating system is responsible for the following activities in connection with disk management: 在同磁盘管理有关的活动中,操作系统负责下列事务: Free space management 空闲空间管理 Storage allocation 存储器分配 Disk scheduling 磁盘调度 Applied Operating System Concepts

I/O System Management I/O系统管理 One of the purpose of the OS is to hide the peculiarities of specific hardware devices from users. 操作系统的一个目标是实现用户和设备的无关性 The I/O system consists of: I/O 系统包括 A buffer,caching,and spooling system 缓冲,高速缓存,假脱机系统 A general device-driver interface 通用设备驱动器接口 Drivers for specific hardware devices 特定硬件设备的驱动程序 Applied Operating System Concepts

Applied Operating System Concepts File Management 文件管理 A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data. 文件是由其创建者定义的关联信息的一个收集器,通常文件表示程序(源程序和目标程序)和数据 The operating system is responsible for the following activities in connections with file management: 在同文件管理有关的活动中,操作系统负责下列事务: File creation and deletion. 文件创建和删除 Directory creation and deletion. 目录创建和删除 Support of primitives for manipulating files and directories. 支持操作文件和目录的原语 Mapping files onto secondary storage. 把文件映象到二级存储器 File backup on stable (nonvolatile) storage media. 在稳定(非易失性)存储介质做文件副本 Applied Operating System Concepts

Protection System 保护系统 Protection refers to a mechanism for controlling access by programs, processes, or users to both system and user resources. 保护是一种机制,控制程序、进程、或用户对系统和用户资源的访问 The protection mechanism must 保护机制必须: distinguish between authorized and unauthorized usage. 区分授权和非授权使用 specify the controls to be imposed. 确定要采用的控制 provide a means of enforcement. 提供强制手段 Applied Operating System Concepts

Networking (Distributed Systems) 网络处理(分布式系统) A distributed system is a collection processors that do not share memory or a clock. Each processor has its own local memory. 分布式系统是一组不共享存储器或时钟的处理器集合,每个处理器有自己的内存 The processors in the system are connected through a communication network.系统中的处理器通过通信网络连接 A distributed system provides user access to various system resources.分布式系统提供用户访问各种系统资源的手段 Access to a shared resource allows:对共享资源的访问可以实现: Computation speed-up 加速运算 Increased data availability 提高数据利用性 Enhanced reliability 增强可靠性 Applied Operating System Concepts

Command-Interpreter System 命令解释器系统 Many commands are given to the operating system by control statements which deal with: 操作系统有许多命令,可以通过控制语句处理: process creation and management 进程创建和管理 I/O handling 处理I/O secondary-storage management 二级存储管理 main-memory management 主存管理 file-system access 文件访问 protection 保护 networking 网络 Applied Operating System Concepts

Command-Interpreter System (Cont.) 命令解释器系统(续) The program that reads and interprets control statements is called variously: 读入和解释控制语句的程序有各种名称 control-card interpreter 控制卡解释器 command-line interpreter 命令行解释器 shell (in UNIX) Its function is to get and execute the next command statement. 其功能是获得和执行下一个命令语句 字符方式命令解释系统—DOS、Unix等 图形方式命令解释系统 —Windows、Linux的GNOME/KDE Applied Operating System Concepts

Operating System Services 操作系统服务 Operating system provides an environment for execution of program, these operating System Services are provided for the convenience of the programmer, to take the programming task easier. 操作系统需要提供一个执行程序的环境,而操作系统服务可以为编程人员提供方便,使得程序设计变得简单。 Program execution – system capability to load a program into memory and to run it. 程序执行 - 调入一个程序进内存并运行之的系统能力 I/O operations – since user programs cannot execute I/O operations directly, the operating system must provide some means to perform I/O. I/O操作 - 由于用户程序不能直接执行I/O操作,操作系统必须提供手段完成I/O操作 File-system manipulation – program capability to read, write, create, and delete files. 文件系统操作 - 读、写、创建和删除文件的能力 Communications – exchange of information between processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing. 通信 - 运行的进程在同一计算机或由网络连接的不同系统中交换信息。通过共享存储器或消息传递实现 Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs. 出错检测 - 探测在CPU与内存硬件中,在I/O设备中,或在用户程序中的错误,确保正确运算 Applied Operating System Concepts

Additional Operating System Functions 其他操作系统功能 Additional functions exist not for helping the user, but rather for ensuring efficient system operations. 其他的功能不是用于帮助用户,而是为了系统效率: Resource allocation – allocating resources to multiple users or multiple jobs running at the same time. 资源分配 - 把资源分配给多个用户或多个同时运行的作业 Accounting – keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics. 帐号管理 - 跟踪和记录用户对资源的使用,用于帐单和统计 Protection – ensuring that all access to system resources is controlled. 保护 - 确保对资源的所有访问均在控制中 Applied Operating System Concepts

Applied Operating System Concepts System Calls 系统调用 System calls provide the interface between a running program and the operating system.系统调用提供在运行程序和操作系统之间的接口 Generally available as assembly-language instructions. 通常以汇编语言指令形式提供 Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g., C. Bliss, PL/360)替代汇编语言的、供系统编程的语言,允许直接使用系统调用 Three general methods are used to pass parameters between a running program and the operating system. 3种常用方式用于在运行程序和操作系统之间的参数传递 Pass parameters in registers. 寄存器中的参数传递 Store the parameters in a table in memory, and the table address is passed as a parameter in a register. 参数存在内存的一张表中,表地址 作为寄存器的参数传递 Push (store) the parameters onto the stack by the program, and pop off the stack by operating system. 程序把参数压入栈,由操作系统弹出 Applied Operating System Concepts

System Call Categories 系统调用的分类 Process Control 进程控制 File manipulation 文件操作 Device manipulation 设备操作 Information maintenance、 信息维护 Communication 通信 Applied Operating System Concepts

Applied Operating System Concepts System Programs 系统程序 System programs provide a convenient environment for program development and execution. They can be divided into: 系统提供程序开发和执行的便利环境。可划分为: File manipulation 文件操作 Status information 状态信息 File modification 文件修改 Programming language support 程序设计语言支持 Program loading and execution 程序调入和执行 Communications 通信 Application programs 应用程序 Applied Operating System Concepts

System Structure – Simple Approach 系统结构 - 简单结构 MS-DOS – written to provide the most functionality in the least space MS-DOS-以最小的空间提供最多的功能 not divided into modules 不划分模块 Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated 尽管MS-DOS有某种结构,其接口和功能层没有划分清楚 Applied Operating System Concepts

MS-DOS Layer Structure MS-DOS层次结构 Applied Operating System Concepts

System Structure – Simple Approach 系统结构 - 简单结构(续) UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts. UNIX - 受硬件功能限制,早期UNIX只是有限的结构化。 UNIX包括2个分离的部分 Systems programs 系统程序 The kernel 内核 Consists of everything below the system-call interface and above the physical hardware 包括了在物理硬件之上,系统调用之下的一切 Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level. 提供文件系统, CPU调度,存储管理,和其他操作系统功能 ;每一层有大量的功能 Applied Operating System Concepts

UNIX System Structure UNIX系统结构 Applied Operating System Concepts

System Structure – Layered Approach 系统结构 - 层次化结构 The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. 操作系统划分为若干层,在低层上构建高层。底层(0层)为硬件;最高层( N层)为用户层 With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers. 考虑模块化,层的选择是每层只使用低层次的功能和服务 Applied Operating System Concepts

An Operating System Layer 操作系统层 Applied Operating System Concepts

Layered Structure of the THE OS THE OS的层次化结构 A layered design was first used in THE operating system. Its six layers are as follows: THE操作系统首先使用层次化设计。有如下六层: Applied Operating System Concepts

OS/2 Layer Structure OS/2层次化结构 Applied Operating System Concepts

Applied Operating System Concepts Microkernels 微内核 As UNIX and other OS expanded ,the kernel became large and difficult to manage. 当UNIX和其它操作系统扩展时,内核变大并难于管理。 For example, the first version of OS/360 was create by 5000 programmer over a period of five years and contained over a million lines of code. 例如第一个版本的OS/360是由5000个程序员化5年时间设计的,保护穿过100万行代码。 In the mid-1980’S, researcher of Carnegie Mellon University developed an OS called Mach that using the microkernel approach. 20世纪80年代中期,卡耐基—梅隆大学的研究人员开发的Mach 首先使用微内核结构。 Applied Operating System Concepts

Microkernels Philosophy 微内核原理 Only absolutely essential core operating system function should be in kernel. Less essential services and applications are built on the microkernel and execute in user mode. 只有最基本的操作系统功能才放在内核中,其它不是最基本的服务和应用在微内核上构造并在用户态执行。 The functions provided by the microkernel: Memory management, IPC, I/O and interrupt management. 微内核提供存储管理,进程间通信功能以及I/O中断管理 Applied Operating System Concepts

Kernel Architecture 内核结构 Applied Operating System Concepts

Windows 2000 Microkernel Structure Windows 2000 微内核结构 Environment Subsystems System Processes Services Applications Replicator POSIX Service Controller Alerter OS/2 WinLogon User Application RPC User Mode Session Manager Event Logger Win32 Subsystem DLLs System Threads NTDLL.DLL Kernel Mode Executive API I/O Manager PnP/Power Manager Processes & Threads Security Virtual Memory Cache Manager File systems Object management / Executive RTL Device drivers Kernel Hardware Abstraction Layer (HAL) Hardware interfaces (read/write port, timers, clocks, DMA, cache control, etc.) Applied Operating System Concepts

Benefits of Microkernel Orgnamization 微内核组织结构的优点 Uniform Interface 统一接口 Extensibility 扩展性 Flexibility 灵活性 Portability 可移植性 Reliability 可靠性 Distributed system support 分布系统支持 Object-oriented operating system 面向对象的操作系统 Applied Operating System Concepts

Applied Operating System Concepts Virtual Machines 虚拟机 A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware. 虚拟机是层次化的逻辑结果。它把硬件和操作系统看成都是硬件 A virtual machine provides an interface identical to the underlying bare hardware. 虚拟机为裸机提供了统一的接口 The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory. 操作系统创建了多个进程,每一个进程有自己的处理器和(虚拟)内存 Applied Operating System Concepts

Virtual Machines (Cont.) 虚拟机(续) The resources of the physical computer are shared to create the virtual machines.物理计算机的资源被共享,以创建虚拟机 CPU scheduling can create the appearance that users have their own processor. CPU调度使得用户好像有自己的处理器 Spooling and a file system can provide virtual card readers and virtual line printers. Spooling和文件系统提供了虚拟卡片阅读机和打印机 A normal user time-sharing terminal serves as the virtual machine operator’s console.普通用户终端成为虚拟机操作员的控制台 Applied Operating System Concepts

Non-virtual Machine非虚拟机 System Models 系统模式 Non-virtual Machine非虚拟机 Virtual Machine虚拟机 Applied Operating System Concepts

Advantages/Disadvantages of Virtual Machines虚拟机的优缺点 The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. 虚拟机概念提供对系统资源的完全保护,因为每个虚拟机同其他虚拟机隔离。当然,隔离不允许直接共享资源 A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. 虚拟机是研发操作系统的完美载体。系统开发在虚拟机上而不是在物理硬件上完成,从而不会打扰正常系统运行 The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine. 由于需要对下面的机器进行精确的复制,所以虚拟机的概念实现困难 Applied Operating System Concepts

The Java Virtual Machine Java虚拟机 Applied Operating System Concepts

The Java Platform Java平台 Applied Operating System Concepts

Java .class File on Cross Platforms 跨平台的Java .class文件 Applied Operating System Concepts

Java Development Environment Java开发环境 Applied Operating System Concepts

System Design Goals 系统设计目标 User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast. 用户目标 - 操作系统应该便于使用,易学,可靠,安全并且快捷 System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. 系统目标 - 操作系统应该容易设计、实现和维护,还要灵活、可靠、无错误和高效 Applied Operating System Concepts

System Implementation 系统实现 Traditionally written in assembly language, operating systems can now be written in higher-level languages. 传统上用汇编语言编写,现在可用高级语言编写 Code written in a high-level language: 用高级语言编写代码: can be written faster. 编码快 is more compact. 更紧凑 is easier to understand and debug. 容易理解和调试 An operating system is far easier to port (move to some other hardware) if it is written in a high-level language. 以高级语言编写的操作系统更容易移植 Applied Operating System Concepts

Applied Operating System Concepts Summary(总结) Chapter 3 is concerned with the operating-system interfaces that users (or at least programmers) actually see: system calls. The treatment is somewhat vague since more detail requires picking a specific system to discuss. This chapter is best supplemented with exactly this detail for the specific system the students have at hand. Ideally they should study the system calls and write some programs making system calls. This chapter also ties together several important concepts including layered design, virtual machines, Java and the Java virtual machine, system design and implementation, system generation, and the policy/mechanism difference. Applied Operating System Concepts

Applied Operating System Concepts 作业 P82 3.1 P83 3.8 3.12 Applied Operating System Concepts