




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Chapter 1Introduction,2,Contents,1.1 What is an operating system (OS)? 1.2 History of OS 1.3 The OS zoo 1.4 OS concept 1.5 The functions of OS 1.6 System calls 1.7 OS structure,3,Operating system (OS),The job of OS: To provide user programs with a better, simpler, cleaner, model of the computer To h
2、andle managing all the resources (one or more processors, some main memory, disks, printers, a keyboard, a mouse, a display, network interfaces, and various other input/output devices.),4,Two modes of operation (运行模式) of computers: Kernel mode(内核态,也称管态、核心态) User mode(用户态) The OS runs in kernel mode,
3、 it can access to all the hardware and can execute any instruction the machine is capable of executing. The rest of the software runs in user mode, in which only a subset of the machine instructions is available.,5,Where the OS fits in,6,1.1 What is an OS,1.1.1 The OS as an extended machine Top-down
4、 view 1.1.2 The OS as a resource manager Bottom-up view,7,1.1.1 The OS as an extended machine,The OS provides abstractions (抽象) to application programs. Good abstractions turn a nearly impossible task into two manageable ones. The first one: define and implement the abstractions The second one: use
5、these abstractions to solve the problem at hand,8,One of the major tasks of the OS is to hide the hardware and present programs (and their programmers) with nice, clean, elegant, consistent, abstractions to work with instead.,9,OS turns ugly hardware into beautiful abstractions,10,1.1.2 The OS as a
6、resource manager,From this view, OS is designed to manage all the pieces of a complex system. The job of OS is to provide for an orderly and controlled allocation of the processors, memories, and I/O devices among the various programs.,11,Resource management includes multiplexing resources in two di
7、fferent ways: time multiplexing(时分复用)For example: CPU, printer space multiplexing(空分复用) For example: main memory, disk,12,操作系统(OS)的定义,操作系统是控制和管理计算机软、硬件资源,合理地组织计算机的工作流程,以及方便用户使用的程序集合。,13,1.2 History of OS,Since operating systems have closely tied to the architecture of the computers on which they run
8、, we will look at successive generations of computers to see what their operating systems were like.,14,1.2.1 The first generation: vacuum tubes,In this generation, all programming was done in absolute machine language, or even worse yet, by wiring up electrical circuits by connecting thousands of c
9、ables to plugboards(插件板) to control the machines basic functions. Programming languages were unknown, operating systems were unheard of.,15,1.2.2 The second generation: Transistors(晶体管) and Batch systems,Mainframe (大型机) To run a job, a programmer would first write the program on paper (in FORTRAN or
10、 assembler), then punch it on cards(穿孔成卡片), then bring the card deck down to the input room and hand it to the operators and wait until the output was ready. Given the high cost of the equipment, people quickly looked for ways to reduce the wasted time. The solution generally adopted was the batch s
11、ystem (批处理系统).,16,An early batch system,After each job finished, the operating system automatically read the next job from the tape and began running it.,17,The structure of a typical input job,Typical operating systems were FMS (FORTRAN Monitor System) and IBMSYS (IBMs OS for the 7094).,18,1.2.3 Th
12、e third generation: ICs and multiprogramming,ICs: Integrated circuits, 集成电路 By the early 1960s, most computer manufacturers had two distinct, incompatible product lines. (1) word-oriented, large-scale scientific computers, e.g. 7094 (2) character-oriented, commercial computers, e.g. 1401 Developing
13、and maintaining two completely different product lines was an expensive proposition for the manufacturers.,19,Solution: IBM System/360 The 360 was a series of software-compatible machines ranging from 1401-sized to much more powerful than the 7094. Since all the machines had the same architecture(体系
14、结构) and instruction set(指令集), programs written for one machine could run on all the others, at least in theory. The operating system: OS/360 The idea of a family of compatible computers(兼容机) was soon adopted by all the other major manufactures.,20,Some key techniques,Multiprogramming: 多道程序设计 SPOOLin
15、g: Simultaneous Peripheral Operation On Line, 同时的外部设备联机操作,21,Multiprogramming,Partition memory into several pieces, with a different job in each partitions.,While one job was waiting for I/O to complete, another job could be using the CPU.,(a) 单道程序的运行情况,(b) 多道程序的运行情况,23,SPOOLing,the ability to read
16、jobs from cards onto the disk as soon as they were brought to the computer room. Whenever a running job finished, the OS could load a new job from the disk into the now-empty partition and run it. With spooling, the 1401 were no longer needed.,24,Timesharing system(分时系统),由于批处理系统对用户的响应时间长,因此用户对响应时间的要
17、求导致了分时系统的出现 Timesharing system is a variant of multiprogramming, in which each user has an online terminal. The first general-purpose timesharing system: CTSS (Compatible Time Sharing System), developed by MIT,25,Timesharing system,分时系统:在一台主机上连接了多个带有显示器和键盘的终端,同时允许多个用户通过自己的终端,以交互方式使用计算机,共享主机中的资源。,26,
18、Timesharing system,MULTICS-The designer of this system envisioned one huge machine providing computing power for everyone in the Boston area. MULTICS introduced many seminal(有重大影响的) ideas into the computer literature(文献).,27,MULTICS 庞大的分时系统,1965年在ARPA的支持下,MIT、贝尔实验室和通用电气公司决定开发一种“公用计算服务系统”, 希望能够同时支持整个
19、波士顿所有的分时用户。该系统称作MULTICS (MULTiplexed Information and Computing Service ) MULTICS的设计目标是: 便利的远程终端使用,大量终端通过电话线接入计算机主机 高可靠的大型文件系统;大容量的用户信息共享;存储和构造层次化信息结构的能力,28,MULTICS,MULTICS的研制难度超出了所有人的预料,1969年4月贝尔实验室退出,通用电气公司也退出了,但最终,经过多年的努力,MULTICS成功地应用 运行MULTICS的计算机系统在九十年代陆续被关闭 Despite its lack of commercial succes
20、s, MULTICS had a huge influence on subsequent OSs. MULTICS引入了许多现代操作系统领域概念的雏形,对随后操作系统特别是UNIX的成功有着巨大的影响,29,小型计算机,电子游戏和UNIX的成功,1969年,在贝尔退出MULTICS研制项目后,Ken Thompson和Dennis M. Ritchie 想申请经费买计算机从事操作系统研究,但多次申请得不到批准 因此他们在一台无人用的PDP-7上,重新摆弄原先在MULTICS项目上设计的“空间旅行”游戏 为了使游戏能够在PDP-7上顺利运行,他们陆续开发了浮点运算软件包、显示驱动软件,设计了文
21、件系统、实用程序、shell 和汇编程序 到了1970年,在一切完成后,给新系统起了个同MULTICS发音相近的名字UNIX,随后,UNIX用C语言全部重写,自此,UNIX诞生了,30,UNIX,Two major versions of UNIX: System V: from AT / 保存子进程的ID号 int status; / 等待的退出状态 pid=fork( ); / 创建新进程 if(pid= -1) perror(“Fork failed to creat a process”);exit(1); else if (pid=0) / 子进程代码 if(execl(“/bin/
22、ls”, “ls”, “-l”, NULL)0) perror(“Exec failed”); exit(1); else if(pid!=wait( ,68,例2的运行结果,69,1.6.2 system calls for file management,open read write lseek: changes the value of the current position pointer in the file, so that subsequent calls to read or write can begin anywhere in the file. stat: keep
23、s track of the file mode, size, time of last modification, and other information.,70,1.6.3 system calls for directory management,mkdir: create a new directory rmdir: remove an empty directory link(name1, name2): create a new entry, name2, point to name1 unlink: remove a directory entry mount umount,
24、71,example,link(“/usr/jim/memo”, “/usr/ast/note”);,72,1.6.4 miscellaneous system calls,chdir(“/usr/ast/test”): changes the current working directory chmod(“file”, 0644): change the mode of a file kill: send signals,73,1.6.5 The windows Win32 API,In windows, the library calls and the actual system ca
25、lls are highly decoupled. Microsoft has defined a set of procedures called the Win32 API (Application Program Interface) that programmers are expected to use to get OS services.,74,Win32 API,75,1.7 OS structure,Monolithic systems (单体系统) Layered systems Microkernels (微内核) Client-server model Virtual
26、Machines,76,1.7.1 Monolithic systems,In this approach, the entire OS runs as a single program in kernel mode. The OS is written as a collection of procedures, linked together into a single large executable binary program. When this technique is used, each procedure in the system is free to call any
27、other one, if the latter provides some useful computation that the former needs.,77,A simple structuring model for a monolithic system,This organization suggests a basic structure for the OS: A main program that invokes the requested service procedure A set of service procedures that carry out the s
28、ystem calls A set of utility procedures that help the service procedures,78,A simple structuring model for a monolithic system,Figure 1-24,79,1.7.2 layered system,A generalization of the approach of Fig. 1-24 is to organize the OS as a hierarchy of layers, each one constructed upon the one below it.
29、,80,Example: Structure of the THE OS,81,1.7.3 micorkernels,The basic idea behind the micorkernels design is to achieve high reliability by splitting the OS up into small, well-defined modules, only one of which - the micorkernel - runs in kernel mode and the rest run as relatively powerless ordinary
30、 user processes.,82,micorkernels,Micorkernels are especially common in real-time, industrial, avionics (航空), and military applications that are mission critical and have very high reliability requirements.,83,micorkernels,An idea somewhat related to having a minimal kernel is to put the mechanism (机
31、制) for doing something in the kernel but not the policy(策略). 机制与策略分离 Example: A simple scheduling algorithm of processes is to assign a priority to every process and then have the kernel run the highest-priority process that is runnalble. The mechanism is to look for the highest-priority process and
32、 run it. The policy assigning priorities to process can be done by user-mode processes.,84,1.7.4 Client-Server model,A slight variation of the micorkernel idea is to distinguish two classes of processes: The servers: each of which provides some service The clients: use these services The essence of
33、this model is the presence of client processes and server processes.,85,Client-Server model,Communication between clients and servers is often by message passing. To obtain a service, a client process constructs a message saying what it wants and sends it to the appropriate service. The service then
34、 does the work and sends back the answer.,86,The client-Server model over a network,An obvious generalization of this idea is to have the clients and servers run on different computers, connected by a local or wide-area network.,87,client-Server model,Since clients communicate with servers by sending messages, the clients need not know whether the messages are handled locally on their own machines, or whether they are sent across a network to servers on a remote ma
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五年度房产证办理专业代理服务协议
- 2025年度新型农业设施劳务分包合同规范(灌溉系统)
- 2025版艺术中心场地租赁及文化活动合作协议
- 二零二五年度财务部门保密协议执行标准
- 二零二五年度安全培训师聘用合同范本
- 二零二五版油气田股权转让与勘探开发合作协议
- 二零二五年度车辆挂靠汽车租赁与保险代理服务协议
- 二零二五年度公共场所保洁临时工服务协议
- 2025版保安员心理辅导与健康管理合同范本
- 二零二五年度儿童玩具包装盒采购协议
- 搬迁项目临时设施拆除与废弃物处理合同
- 2025年食品安全知识考试试题库及解析答案
- 小学一年级升二年级暑假数学作业-思维应用题训练50题(附答案)
- 腹透患者健康指导
- 西安高新区管委会招聘考试真题2024
- 党史知识竞赛试题及答案
- 初中语文新课程标准试题及答案
- 宗教场所消防培训课件
- 隧道建设施工进度计划与工期保证措施
- 车工考评员培训课件
- 2025年老年人能力评估师(三级)考试模拟试题(含答案)
评论
0/150
提交评论