第一章简介.ppt

上传人:本田雅阁 文档编号:3138483 上传时间:2019-07-16 格式:PPT 页数:77 大小:3.38MB
返回 下载 相关 举报
第一章简介.ppt_第1页
第1页 / 共77页
第一章简介.ppt_第2页
第2页 / 共77页
第一章简介.ppt_第3页
第3页 / 共77页
第一章简介.ppt_第4页
第4页 / 共77页
第一章简介.ppt_第5页
第5页 / 共77页
点击查看更多>>
资源描述

《第一章简介.ppt》由会员分享,可在线阅读,更多相关《第一章简介.ppt(77页珍藏版)》请在三一文库上搜索。

1、第一章 简介,操作系统 Operating System,本章主题,操作系统安装位置 操作系统的功能 操作系统的结构 需要操作系统吗? 硬件接口 操作系统的接口,摩尔定理,芯片中的晶体管和电阻器的数量每年会翻番,现代信息社会,人均处理器拥有量,能耗问题,Layers and Views of a Computer System 计算机系统的分层结构,Computer Hardware 硬件,Operating-System操作系统,Utilities工具软件 编辑/编译/汇编软件,Application Programs应用软件,计算机软件 Software,编译程序 操作系统 解释程序 系统

2、软件 语言处理系统 汇编程序 常用的例行程序 库连接程序等 计算机软件 连接编译程序 诊断排错程序 应用软件 :火车售票系统、超市管理系统 裸机:没有配置任何软件的计算机 软件是在硬件基础之上对硬件的性能加以扩充和完善,操作系统定义,操作系统是计算机的第一个软件,管理和控制计算机系统中的硬件及软件资源、合理地组织计算机工作流程,以便有效利用这个资源为用户提供一个功能强大、使用方便和可扩充的工作环境,从而在计算机与用户之间起到接口作用。,软件代码量不断增加,Operating System 操作系统,A program that controls the execution of applica

3、tion programs 用于控制应用程序的执行的程序 An interface between the user and hardware 用户与硬件间的接口 Masks the details of the hardware 屏蔽硬件的细节,Services Provided by the Operating System 操作系统提供的服务-1,Program creation 程序开发 editors and debuggers (编辑和调试) Program execution 程序执行 Access to I/O devices 外设存取 Controlled access to

4、 files 文件取存控制 System access 系统访问,Error detection and response错误检测与响应 internal and external hardware errors内/外硬件错误 memory error内存错误 device failure设备错误 software errors软件错误 arithmetic overflow算法溢出 access forbidden memory locations 越权内存访问 operating system cannot grant request of application 操作系统不允许的应用请求

5、,Services Provided by the Operating System 操作系统提供的服务-2,Accounting 计帐 collect statistics 信息统计 monitor performance 性能监控 used to anticipate future enhancements 用于后期系统扩展 used for billing users 向用户收费,Services Provided by the Operating System 操作系统提供的服务-3,操作系统的功能,资源管理器 管理计算机系统的硬件资源 虚拟计算机 实现计算机的软件方面的功能,Hard

6、ware Resource 计算机的硬件资源,Processor,.,.,.,.,.,.,Computer System,I/O Controller,Processor,I/O Controller,I/O Controller,Memory,Operating System Software,Programs and Data,O/S,Programs,Data,1.扩充(转化) 从一个现存的资源创建一个新资源 隐藏硬件接口细节。 如虚拟打印机,提供一台硬件打印机的基本功能,由操作系统处理难以使用的硬件接口细节。 显示设备,Resource Manage 资源管理,2.多路技术 从一个资源

7、创建几个资源的映射 SPOOLING方法(联机的即时外围设备操作) 时分多路与空分多路 3.调度 决定哪个程序得到哪个资源及体何时得到,Resource Manage 资源管理,Virtual Computer 虚拟计算机,一个裸机在每加上一层软件后,就变成了一个功能更强的机器,我们把这种“功能更强的机器”称之为“虚拟机” 如果是多用户的操作系统,那么经过扩充后,一个实际的处理器就可以扩充成多个虚拟机,使得每一个用户都拥有一个处理机,虚拟计算机,时分复用/空分复用,虚拟计算机的组成,虚拟处理器 OS禁止了物理处理器中的一些指令(特权指令) 。 系统模式和用户模式(不允许使用特权指令) 虚拟主存

8、 虚拟辅助存储器 虚拟I/O,操作系统不是必须的,微波炉 来电显示的电话机 . 但操作系统的任务都由相应代码承担,80C51单片机,硬件接口,中断 改变处理器执行指令顺序的事件,被打断的程序可以在将来某个时候继续执行 内部中断 与 外部中断 中断的响应与处理 中断源、中断向量表 PSW 程序状态字寄存器 程序基本状态 中断码 中断屏蔽位,. . . .,Int 2 入口地址,Int 4 入口地址,INT2处理程序,INT4处理程序,中断向量表,00000,FFFFF,4 3 2 1 0,内存,CPU寄存器构成,PSW,中断屏蔽寄存器,通用寄存器AX,通用寄存器BX,通用寄存器CX,通用寄存器D

9、X,包括通用寄存器、专用寄存器和控制寄存器,代码段寄存器 CS,数据段寄存器 DS,堆栈段寄存器 SS,程序计数器 PC,堆栈指针 SP,指令寄存器 IR,Instruction Cycle with Interrupts! 中断的指令周期,CPU checks for interrupts after each instruction If no interrupts, then fetch the next instruction for the current program If an interrupt is pending, then suspend(挂起) execution o

10、f the current program, and execute the interrupt handler(中断处理),Interrupt Handler中断处理,决定由哪一段程序来处理中断 CPU转入该程序执行 中断处理结束时应能将控制交回被中断程序以便从断点继续执行 中断可在任何时刻产生 因此:必须保存当前程序状态 (content of PC + PSW + registers + .),Interrupts improve CPU usage 中断提高CPU的效率,I/O pgm prepares the I/O module and issues the I/O command

11、 (eg: to printer) I/O pgm branches(分支) to user pgm User code gets executed during I/O operation (eg: printing): no waiting 程序继续执行 User pgm gets interrupted (x) when I/O operation is done and branches to interrupt handler to examine status of I/O module I/O操作结束时产生中断,中断当前程序运行转入中断处理程序检测I/O状态 恢复运行用户程序,C

12、lasses of Interrupts中断类型,I/O中断 signals normal completion of operation or error Program Exception 程序异常中断 Overflows溢出 try to execute illegal instruction执行非法指令 reference outside users memory space 内存空间超界访问 时针中断Timer preempts a pgm to perform another task Hardware failure (eg: memory parity error) 硬件故障中

13、断(如内存奇偶校验错误),硬件中断和软件中断,硬件中断又可分为硬件故障中断、输入输出中断和外部中断。 软件中断又可分为程序中断(例如定点操作数溢出、地址越界、虚存管理中缺页等)和访管中断。访管中断是用户程序在运行中请求操作系统为其提供服务而执行一条“访管指令”所引起的中断,又称软件中断。在PDP-11机上访管指令是tarp指令,在86机上访管指令是INT指令。访管中断是进程所期待的,它是自愿性的中断,又称自愿中断,其它几种中断不是运行进程所期望的,它属于强迫性中断事件。,Multiple interrupts: sequential order 多级中断:顺序处理,Disable interr

14、upts during an interrupt Interrupts remain pending until the processor enables interrupts After interrupt handler routine completes, the processor checks for additional interrupts,Multiple Interrupts: priorities 多级中断:优先级,Higher priority interrupts cause lower-priority interrupts to wait Causes a low

15、er-priority interrupt handler to be interrupted Example: when input arrives from communication line, it needs to be absorbed quickly to make room for more input,操作系统的接口,由操作系统提供系统调用命令 作业级接口,它提供一组键盘命令,供用户组织和控制自己的作业运行。 程序级接口,它提供一组系统调用,即OS中某个模块功能,供用户程序和其它程序调用。(例MS-DOS) 系统调用会产生一个中断,使操作系统得以控制处理器,并由操作系统提供相

16、应的服务。,系统调用的例子,CreateProcess Exit Wait Send Receive,Create Open Read Write Lseek Close Delete,操作系统的发展历史,无操作系统(40年代未50年代初) 简单的批处理系统(50年代中50年代未) 多道程序设计共享系统(60年代初60年代中) 分时系统.,1.无操作系统,这时的计算机操作是由程序员采用人工操作方式直接使用计算机硬件系统。 计算速度慢(几千次每秒),没有操作系统甚至没有任何软件 用户独占计算机,完全手工操作 纸带(卡片) 输入机 计算机打印输出结果取走纸带 用户顺序使用计算机,2.简单的批处理系

17、统 Simple Batch System,它是为了减少人工操作时间和作业转换时间提高CPU利用率而设计的。系统自动成批处理作业,这是初级单道批处理系统。 程序员反自己的作业提交给计算机操作员,由操作员将作业用一台廉价的计算机组织成一批写到磁带上,由昂贵的计算机读入一批作业依次完成真正的计算。,3.多道程序批处理系统 Multiprogrammed Batch Systems,Allows the processor to execute another program while one program must wait for an I/O device.,Run A,Run A,Wai

18、t,Time,Wait,Run B,Run B,3.多道程序批处理系统(续) Multiprogrammed Batch Systems,在主存储器中同时驻留多个作业,并且在它们之间切换处理机的使用。 Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.,4. 分时系统 Time-Sharing Systems,多道程序的一个变种 每个用户都有联机终端,能够为一些用户提供快速的交互式服务,同时在CPU空闲时还能运行后台的大作业。 MULTICS系统(UNIX的前

19、身),4.分时系统: 分时系统的特征,多路性:允许在一台主机上同时联接多台联机终端,系统按分时原则为每个用户服务。宏观上是多个用户同时工作,共享系统资源,而微观上则是每个用户作业轮流运行一个时间片。多路性即同时性,它提高了资源利用率,从而促进了计算机更广泛的应用。 独立性:每个用户各占一个终端,彼此独立操作,互不干扰。因此用户会感觉到就象他一人独占主机。 交互性:用户可通过终端与系统进行广泛的人机对话。用户可以请求系统提供多方面服务,如文件编辑,数据处理和资源共享等。 及时性:用户的请求能在很短时间内获得响应,此时间间隔是以人们所能接受的等待时间来确定的,通常为1-2秒。,5.个人计算机系统/

20、桌面系统 Desktop Systems,Personal computers computer system dedicated to a single user. I/O devices keyboards, mice, display screens, small printers. May run several different types of operating systems (Windows, MacOS, UNIX, Linux),6. 并行系统 Parallel Systems,Multiprocessor systems with more than one CPU

21、in close communication. 多个处理器 Tightly coupled system (紧耦合系统) processors share memory and a clock; communication usually takes place through the shared memory. 多处理器共享内存和时钟,通过共享内存进行通讯 Advantages of parallel system: 优点 Increased throughput 高吞吐量 Economy of scale 经济 Increased reliability 高可靠性 graceful de

22、gradation(fault tolerant) 容错,6. 并行系统Parallel Systems (续),Symmetric multiprocessing (SMP)对称多处理器 Each processor runs an identical copy of the operating system.每处处理器运行同一个OS Many processes can run at once without performance deterioration 多处理器可同时运行可不影响性能 Most modern operating systems support SMP Asymmet

23、ric multiprocessing(异构多处理器) Each processor is assigned a specific task; master processor schedules and allocates work to slave processors. 每个处理器分配一个特定任务,主处理器在各从处理器间进行任务分配和调度 More common in extremely large systems多用于大型系统,7.分布式系统 Distributed Systems,Distribute the computation among several physical pr

24、ocessors.将计算分布于多个处理器 Loosely coupled system (松耦合系统) each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines. Advantages of distributed systems. Resources Sharing 资源共享 Computation speed up load

25、sharing 负载均衡 Reliability 可靠性 Communications 通信,7.分布式系统 Distributed Systems(续),Requires networking infrastructure.需要网络结构 Local area networks (LAN) or Wide area networks (WAN) 局域网或广域网 May be either client-server or peer-to-peer systems. 客户机/服务器 点对点系统,8. Clustered Systems(群集系统),Clustering allows two or

26、 more systems to share storage. 两个或从个系统共享内存 Provides high reliability(高可靠性). Asymmetric(非对称) clustering: one server runs the application while other servers standby(备用). Symmetric(对称) clustering: all N hosts are running the application. 例:8台sun工作站同时计算天气预报,9.实时系统 Real-Time Systems,Often used as a con

27、trol device in a dedicated application such as 专用于设备控制 controlling scientific experiments 科学实验控制 medical imaging systems 医疗成像系统 industrial control systems 工业控制系统 some display systems. 某些显示系统 Well-defined fixed-time constraints.固定的时间约束 Real-Time systems may be either hard or soft real-time.(硬实时系统、软实时

28、系统),9.实时系统 Real-Time Systems(续),硬实时系统 此类实时控制系统主要用于生产过程的自动控制,实验数据自动采集,武器的控制、包括火炮自动控制、飞机自动驾驶、导弹的制导系统。 软实时系统 这类系统主要用于实时信息处理,象飞机订票系统、情报检索系统。,10.手持式系统 Handheld Systems,Personal Digital Assistants (PDAs) 个人数字助理 Cellular telephones 蜂窝电话 Issues: 面临的问题 Limited memory 有限的内存 Slow processors 较慢的处理器 Small displa

29、y screens. 小的显示屏,图示:操作系统的发展,Evolution of an Operating System 操作系统的发展,Hardware upgrades and new types of hardware 硬件更新 New services 新的功能 Fixes 补丁,操作系统的结构 System Structure,单体式结构 层次式结构 客户机/服务器系统 微内核 机制与策略的分离,Characteristics of Modern Operating Systems,Microkernel architecture微内核架构 assigns only a few es

30、sential functions to the kernel 内核仅包括很少的重要的功能 address space地址空间 interprocess communication (IPC)进程间通信 basic scheduling基本调度,Characteristics of Modern Operating Systems,Multithreading多线程 process is divided into threads that can run simultaneously(同时地) Thread 线程 dispatchable unit of work 分配工作的单元 execut

31、es sequentially and is interruptable 顺序执行并可中断 Process is a collection of one or more threads 进程是一个或多个线程的集合,Characteristics of Modern Operating Systems,Symmetric multiprocessing对称多处理机 there are multiple processors 多个处理器 these processors share same main memory and I/O facilities共享内存和IO设备 All processor

32、s can perform the same functions 多个处理器能执行相同的功能,Characteristics of Modern Operating Systems,Distributed operating systems分布式操作系统 provides the illusion of a single main memory 提供虚拟的同一主存 used for distributed file system 分布式文件系统,Characteristics of Modern Operating Systems,Object-oriented design 面向对象设计 u

33、sed for adding modular extensions to a small kernel 通过对小的内核增加模块以扩展系统 enables programmers to customize an operating system without disrupting system integrity 在不破坏系统完整性的情况下允许程序员定制系统,Windows NT,Exploits the power of todays microprocessors 充分利用当今的微处理器 Provides full multitasking in a single-user environ

34、ment 单用户环境中完美的多任务 Can execute on a variety of hardware platforms 可运行于多种硬件平台 Supports applications written for a variety of other operating systems 可运行为其它OS开发的应用,Windows发展,Windows NT,NT Executive modified microkernel architecture微内核架构 many of the system functions outside the microkernel run in kernel

35、 mode Uses a layered structure 层结构 Hardware abstraction layer (HAL) 硬件抽象层 makes hardware look the same to the kernel provides support for symmetric(对称) multiprocessing,Windows NT,NT Executive Uses a layered structure microkernel 微内核 most-used components does not run in threads is not preemptible(非抢占

36、式) executive services provides an interface to user-mode software 为用户模式下的软件提供接口,Windows NT Features for SMP,Operating system routines can run on any processor Different routines can execute simultaneously(同时地) on different processors Multiple threads of execution within a single process Servers use

37、multiple threads to process request for more than one client simultaneously Flexible(灵活的) interprocess communication,Windows NT Objects,Not all entities are objects Entities represented by objects are files, processes, threads, semaphores, times, and windows Object manager in the kernel is responsib

38、le for creating and destroying objects, and for granting access to an objects services and data,UNIX Architecture,Hardware is surrounded by the operating-system 硬件由操作系统包围着 Operating system is called the kernel 内核 Comes with a number of user services and interfaces 提供一组用户服务和用户接口 shell 外壳 C compiler C

39、语言编译器,UNIX Architecture,Unix的发展,1969年贝尔实验室汤普森在PDP-7计算机开发了Unix,Modern UNIX Systems,System V Release 4 ( SVR4) by AT&T and SUN Microsystem Solaris 2.x by SUN Berkeley Software Distribution(BSD 4.x) Academic,Linux,1991年由芬兰的大学生(Linus Torvalds)研制 自由软件:免费和自由,可出售自己的程序 GPL版权 如 eMule Red Hat / 红旗Linux 应用于网络服

40、务器,企业计算 Oracle,Informix,Sybase/ IBM,Sun,Corel,Linux 发展的重要里程碑,1990年,Linus Torvalds 首次接触 MINIX 1991年,Linus Torvalds 开始在 MINIX 上编写各种驱动程序等操作系统内核组件 1991年,Linus Torvalds 公开了 Linux 内核 1993年,Linux 1.0 版发行,Linux 转向 GPL 版权协议 1994年,Linux 的第一个商业发行版 Slackware 问世1996年,美国国家标准技术局的计算机系统实验室确认 Linux 版本 1.2.13(由 Open Linux 公司打包)符合 POSIX 标准 1999年,Linux 的简体中文发行版相继问世 2001年,Linux2.4版内核发布 2003年,Linux2.6版内核发布,苹果公司MAC OS X,手机的操作系统,PalmOS Symbian Windows CE Linux,作业,了解Windows / Unix /Linux/Mac OS的发展历史,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1