第一章简介.ppt

上传人:sccc 文档编号:5293210 上传时间:2023-06-23 格式: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工具软件编辑/编译/汇编软件,ApplicationPrograms应用软件,计算机软件 Software,编译程序 操作系统 解释程序 系统软件 语言处理系

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

3、用于控制应用程序的执行的程序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 files 文件取存控制System acce

4、ss 系统访问,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操作系统不允许的应用请求,Services Provided by the Operati

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

6、.,Computer System,I/O Controller,Processor,I/O Controller,I/O Controller,Memory,OperatingSystemSoftware,Programsand Data,O/S,Programs,Data,1.扩充(转化)从一个现存的资源创建一个新资源隐藏硬件接口细节。如虚拟打印机,提供一台硬件打印机的基本功能,由操作系统处理难以使用的硬件接口细节。显示设备,Resource Manage 资源管理,2.多路技术从一个资源创建几个资源的映射SPOOLING方法(联机的即时外围设备操作)时分多路与空分多路3.调度决定哪个程序

7、得到哪个资源及体何时得到,Resource Manage 资源管理,Virtual Computer 虚拟计算机,一个裸机在每加上一层软件后,就变成了一个功能更强的机器,我们把这种“功能更强的机器”称之为“虚拟机”如果是多用户的操作系统,那么经过扩充后,一个实际的处理器就可以扩充成多个虚拟机,使得每一个用户都拥有一个处理机,虚拟计算机,时分复用/空分复用,虚拟计算机的组成,虚拟处理器OS禁止了物理处理器中的一些指令(特权指令)。系统模式和用户模式(不允许使用特权指令)虚拟主存虚拟辅助存储器虚拟I/O,操作系统不是必须的,微波炉来电显示的电话机.但操作系统的任务都由相应代码承担,80C51单片机

8、,硬件接口,中断改变处理器执行指令顺序的事件,被打断的程序可以在将来某个时候继续执行内部中断 与 外部中断中断的响应与处理中断源、中断向量表PSW 程序状态字寄存器程序基本状态中断码中断屏蔽位,.,Int 2 入口地址,Int 4 入口地址,INT2处理程序,INT4处理程序,中断向量表,00000,FFFFF,43210,内存,CPU寄存器构成,PSW,中断屏蔽寄存器,通用寄存器AX,通用寄存器BX,通用寄存器CX,通用寄存器DX,包括通用寄存器、专用寄存器和控制寄存器,代码段寄存器 CS,数据段寄存器 DS,堆栈段寄存器 SS,程序计数器 PC,堆栈指针 SP,.,指令寄存器 IR,Ins

9、truction Cycle with Interrupts!中断的指令周期,CPU checks for interrupts after each instructionIf no interrupts,then fetch the next instruction for the current programIf an interrupt is pending,then suspend(挂起)execution of the current program,and execute the interrupt handler(中断处理),Interrupt Handler中断处理,决定由

10、哪一段程序来处理中断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(eg:to printer)I/O pgm branches(分支)to user pgmUser code gets executed during I/O operation(eg:printi

11、ng):no waiting程序继续执行User pgm gets interrupted(x)when I/O operation is done and branches to interrupt handler to examine status of I/O moduleI/O操作结束时产生中断,中断当前程序运行转入中断处理程序检测I/O状态恢复运行用户程序,Classes of Interrupts中断类型,I/O中断signals normal completion of operation or errorProgram Exception 程序异常中断Overflows溢出tr

12、y to execute illegal instruction执行非法指令reference outside users memory space内存空间超界访问时针中断Timerpreempts a pgm to perform another taskHardware failure(eg:memory parity error)硬件故障中断(如内存奇偶校验错误),硬件中断和软件中断,硬件中断又可分为硬件故障中断、输入输出中断和外部中断。软件中断又可分为程序中断(例如定点操作数溢出、地址越界、虚存管理中缺页等)和访管中断。访管中断是用户程序在运行中请求操作系统为其提供服务而执行一条“访管

13、指令”所引起的中断,又称软件中断。在PDP-11机上访管指令是tarp指令,在86机上访管指令是INT指令。访管中断是进程所期待的,它是自愿性的中断,又称自愿中断,其它几种中断不是运行进程所期望的,它属于强迫性中断事件。,Multiple interrupts:sequential order多级中断:顺序处理,Disable interrupts during an interruptInterrupts remain pending until the processor enables interruptsAfter interrupt handler routine completes

14、,the processor checks for additional interrupts,Multiple Interrupts:priorities多级中断:优先级,Higher priority interrupts cause lower-priority interrupts to waitCauses a lower-priority interrupt handler to be interruptedExample:when input arrives from communication line,it needs to be absorbed quickly to ma

15、ke room for more input,操作系统的接口,由操作系统提供系统调用命令作业级接口,它提供一组键盘命令,供用户组织和控制自己的作业运行。程序级接口,它提供一组系统调用,即OS中某个模块功能,供用户程序和其它程序调用。(例MS-DOS)系统调用会产生一个中断,使操作系统得以控制处理器,并由操作系统提供相应的服务。,系统调用的例子,CreateProcessExitWaitSendReceive,CreateOpenReadWriteLseekCloseDelete,操作系统的发展历史,无操作系统(40年代未50年代初)简单的批处理系统(50年代中50年代未)多道程序设计共享系统(

16、60年代初60年代中)分时系统.,1.无操作系统,这时的计算机操作是由程序员采用人工操作方式直接使用计算机硬件系统。计算速度慢(几千次每秒),没有操作系统甚至没有任何软件用户独占计算机,完全手工操作纸带(卡片)输入机 计算机打印输出结果取走纸带用户顺序使用计算机,2.简单的批处理系统 Simple Batch System,它是为了减少人工操作时间和作业转换时间提高CPU利用率而设计的。系统自动成批处理作业,这是初级单道批处理系统。程序员反自己的作业提交给计算机操作员,由操作员将作业用一台廉价的计算机组织成一批写到磁带上,由昂贵的计算机读入一批作业依次完成真正的计算。,3.多道程序批处理系统

17、Multiprogrammed Batch Systems,Allows the processor to execute another program while one program must wait for an I/O device.,RunA,RunA,Wait,Time,Wait,RunB,RunB,3.多道程序批处理系统(续)Multiprogrammed Batch Systems,在主存储器中同时驻留多个作业,并且在它们之间切换处理机的使用。Several jobs are kept in main memory at the same time,and the CPU

18、 is multiplexed among them.,4.分时系统 Time-Sharing Systems,多道程序的一个变种每个用户都有联机终端,能够为一些用户提供快速的交互式服务,同时在CPU空闲时还能运行后台的大作业。MULTICS系统(UNIX的前身),4.分时系统:分时系统的特征,多路性:允许在一台主机上同时联接多台联机终端,系统按分时原则为每个用户服务。宏观上是多个用户同时工作,共享系统资源,而微观上则是每个用户作业轮流运行一个时间片。多路性即同时性,它提高了资源利用率,从而促进了计算机更广泛的应用。独立性:每个用户各占一个终端,彼此独立操作,互不干扰。因此用户会感觉到就象他一

19、人独占主机。交互性:用户可通过终端与系统进行广泛的人机对话。用户可以请求系统提供多方面服务,如文件编辑,数据处理和资源共享等。及时性:用户的请求能在很短时间内获得响应,此时间间隔是以人们所能接受的等待时间来确定的,通常为1-2秒。,5.个人计算机系统/桌面系统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

20、 operating systems(Windows,MacOS,UNIX,Linux),6.并行系统 Parallel Systems,Multiprocessor systems with more than one CPU in close communication.多个处理器Tightly coupled system(紧耦合系统)processors share memory and a clock;communication usually takes place through the shared memory.多处理器共享内存和时钟,通过共享内存进行通讯Advantages

21、 of parallel system:优点Increased throughput 高吞吐量Economy of scale 经济Increased reliability 高可靠性graceful degradation(fault tolerant)容错,6.并行系统Parallel Systems(续),Symmetric multiprocessing(SMP)对称多处理器Each processor runs an identical copy of the operating system.每处处理器运行同一个OSMany processes can run at once wi

22、thout performance deterioration 多处理器可同时运行可不影响性能Most modern operating systems support SMPAsymmetric multiprocessing(异构多处理器)Each processor is assigned a specific task;master processor schedules and allocates work to slave processors.每个处理器分配一个特定任务,主处理器在各从处理器间进行任务分配和调度More common in extremely large syst

23、ems多用于大型系统,7.分布式系统 Distributed Systems,Distribute the computation among several physical processors.将计算分布于多个处理器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

24、.Advantages of distributed systems.Resources Sharing 资源共享Computation speed up load 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

25、 systems.客户机/服务器 点对点系统,8.Clustered Systems(群集系统),Clustering allows two or 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

26、.例:8台sun工作站同时计算天气预报,9.实时系统 Real-Time Systems,Often used as a control 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-T

27、ime systems may be either hard or soft real-time.(硬实时系统、软实时系统),9.实时系统 Real-Time Systems(续),硬实时系统此类实时控制系统主要用于生产过程的自动控制,实验数据自动采集,武器的控制、包括火炮自动控制、飞机自动驾驶、导弹的制导系统。软实时系统这类系统主要用于实时信息处理,象飞机订票系统、情报检索系统。,10.手持式系统 Handheld Systems,Personal Digital Assistants(PDAs)个人数字助理Cellular telephones 蜂窝电话Issues:面临的问题Limite

28、d memory 有限的内存Slow processors 较慢的处理器Small display screens.小的显示屏,图示:操作系统的发展,Evolution of an Operating System操作系统的发展,Hardware upgrades and new types of hardware 硬件更新New services 新的功能Fixes 补丁,操作系统的结构System Structure,单体式结构层次式结构客户机/服务器系统微内核机制与策略的分离,Characteristics of Modern Operating Systems,Microkernel

29、architecture微内核架构assigns only a few essential 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 线程dispatcha

30、ble unit of work 分配工作的单元executes 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 facilit

31、ies共享内存和IO设备All processors 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-or

32、iented design 面向对象设计used 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 si

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

34、run in kernel modeUses a layered structure 层结构Hardware abstraction layer(HAL)硬件抽象层makes hardware look the same to the kernelprovides support for symmetric(对称)multiprocessing,Windows NT,NT ExecutiveUses a layered structuremicrokernel 微内核most-used components does not run in threads is not preemptible(

35、非抢占式)executive services provides an interface to user-mode software为用户模式下的软件提供接口,Windows NT Features for SMP,Operating system routines can run on any processorDifferent routines can execute simultaneously(同时地)on different processorsMultiple threads of execution within a single processServers use mul

36、tiple threads to process request for more than one client simultaneouslyFlexible(灵活的)interprocess communication,Windows NT Objects,Not all entities are objectsEntities represented by objects are files,processes,threads,semaphores,times,and windowsObject manager in the kernel is responsible for creat

37、ing 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语言编译器,UNIX Archit

38、ecture,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应用于网络服务器,企业计算Oracle,Informix,Sy

39、base/IBM,Sun,Corel,Linux 发展的重要里程碑,1990年,Linus Torvalds 首次接触 MINIX1991年,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,手机的操作系统,PalmOSSymbianWindows CELinux,作业,了解Windows/Unix/Linux/Mac OS的发展历史,

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

当前位置:首页 > 建筑/施工/环境 > 农业报告


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号