1 / 300

(操作系统)

Operating System. (操作系统). 计算机科学与技术系 教授. 孙 辉 博士. 操作系统课程的主要内容及学习目的. 一、 主要内容. 1. 操作系统概述及相关的背景知识介绍. 2. 进程管理及处理机调度. 3. 存储管理及虚拟内存管理. 4. 设备管理. 5. 文件管理. 二、学习目的. 1. 通过系统学习操作系统知识,深入了解其工作原理和计算机运作过程,更好地使用操作系统;. 2. 通过学习,了解系统编程的方法。. 3. 学习系统程序设计中的思考方式和处理问题的技巧 , 提高程序设计能力和计算机应用能力。.

yank
Télécharger la présentation

(操作系统)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating System (操作系统) 计算机科学与技术系 教授 孙 辉 博士

  2. 操作系统课程的主要内容及学习目的 一、 主要内容 1. 操作系统概述及相关的背景知识介绍 2. 进程管理及处理机调度 3. 存储管理及虚拟内存管理 4. 设备管理 5. 文件管理

  3. 二、学习目的 1. 通过系统学习操作系统知识,深入了解其工作原理和计算机运作过程,更好地使用操作系统; 2. 通过学习,了解系统编程的方法。 3. 学习系统程序设计中的思考方式和处理问题的技巧,提高程序设计能力和计算机应用能力。 4. 为后续相关课程打下基础。

  4. 三、主要参考书 1. William Stallings,Operating SystemsInternals and Design Principles 操作系统——精髓与设计原理(第五版,影印版),电子工业出版社,2006.3, 本课程教材 2 Abraham Silberschatz,Peter Galvin,Greg Gagne OPERATING SYSTEM CONCEPTS,操作系统概念 (第六版,影印版)高等教育出版社,2002.5 3 孙钟秀主编,操作系统教程(第三版),高等教育出版社,2003年8月,附电子讲稿 4. 陈莉君,深入分析 Linux 内核源代码,人民邮电出版社 5. Jim Mauro Richard McDougall,Solaris内核结构,冯锐等译,机械工业出版社

  5. Chapter 1 Introduction of Operating System 操作系统概述

  6. Main points 1 计算机系统的基本知识 2 操作系统的基本概念 3 操作系统的发展 4 操作系统的主要成就 5 现代操作系统的特征 6 典型的操作系统简介

  7. 1.1 Computer System Overview (hardware) (计算机系统概述)

  8. 1.1.1 Basic Elements(计算机的基本元素) • Processor(中央处理器) • Main Memory(主存储器,物理内存) • Referred to as real memory or primary memory • Volatile(多变性) • I/O modules(输入/输出设备) • secondary memory devices(辅助存储器,外存) • communications equipment • terminals • System bus(系统总线) • communication among processors, memory, and I/O modules

  9. Top-Level Components

  10. 1.1.2 Processor Registers (处理器寄存器)

  11. 1.1.3 Instruction Cycle (指令执行周期) Fetch Cycle Execute Cycle Fetch Next Instruction Execute Instruction START HALT Instruction Fetch Execute Instruction Register 程序执行例

  12. 1.1.4 Direct Memory Access (DMA) (直接存储器存取) • I/O exchanges occur directly with memory • Processor grants I/O module authority to read from or write to memory • Relieves the processor responsibility for the exchange • Processor is free to do other things

  13. 1.1.5 Interrupts Interrupts 中断的概念 Classes of Interrupts 中断的分类 Interrupt Handler 中断处理 Interrupt Cycle 中断周期

  14. 1.2 Operating System Overview (software) (操作系统概述)

  15. 1.2.1 Operating System 操作系统定义 1、A program that controls the execution of application programs (一个控制应用程序的执行的程序) 2、An interface between applications and hardware (应用程序和计算机硬件之间的接口)

  16. Operating System 操作系统控制整个计算机的运行,但与一般的控制机制相比,有如下两点不同: • Functions same way as ordinary computer software • It is program that is executed • Operating system relinquishes(释放)control of the processor to execute other programs

  17. 操作系统作为资源管理器

  18. 1.2.2 Operating System Objectives 操作系统设计的目标 • Convenience(方便) • Makes the computer more convenient to use • Efficiency(效率) • Allows computer system resources to be used in an efficient manner • Ability to evolve(扩展能力) • Permit effective development, testing, and introduction of new system functions without interfering with service

  19. 1.2.3 Layers of Computer System 最终用户面对的是应用程序 程序员面对的是操作系统和应用系统 操作系统设计者面对的是计算机硬件

  20. Program development(程序开发) Editors and debuggers Program execution(程序运行) Access to I/O devices(访问I/O设备) Controlled access to files(控制访问文件) System access(系统访问) 1.2.3 Services Provided by the Operating System 操作系统提供的服务

  21. 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 • Accounting(统计) • collect statistics • monitor performance • used to anticipate future enhancements • used for billing users

  22. Portion of operating system that is in main memory Contains most-frequently used functions Also called the nucleus 1.2.4 Kernel 内核 内核是操作系统最基本的部分,也可以认为,操作系统的一种定义就是内核,本程课程所介绍的操作系统即为内核。

  23. 1.2.5 Evolution of an Operating System 操作系统的易扩展性 • Hardware upgrades and new types of hardware • (硬件的升级和新硬件的出现) • New services(新的服务) • Fixes(纠正错误)

  24. 1.3 Evolution of Operating Systems 操作系统的发展 Serial Processing (串行处理) Simple Batch Systems(简单批处理系统) Multiprogramming (多道程序批处理系统) Time Sharing(分时系统)

  25. 1.4 Major Achievements 操作系统的主要成就 Processes(进程) Memory Management(内存管理) Information protection and security(信息保护和安全) Scheduling and resource management(调度和资源管理) System structure(系统结构)

  26. 1.5 Characteristics of Modern Operating Systems 现代操作系统的特征 Microkernel architecture(微内核结构) Multithreading(多线程) Symmetric multiprocessing(对称多处理) Distributed operating systems(分布式) Object-oriented design(面向对象)

  27. 1.6 典型操作系统 1.6.1 WINDOWS 2000 操作系统 1.6.2 UINX操作系统

  28. Migration of Operating-System Concepts and Features

  29. Chapter 2 Process Description and Control (进程描述和控制)

  30. 2.1 Process Description (进程描述) A process is a program in execution; process execution must progress in sequential fashion. Can be characterized by its trace A process requires resources, which are managed by the operating system The OS interleaves the execution of several processes to maximize processor utilization OS supports InterProcess Communication (IPC) and user creation of processes 进程的各种定义 三进程迸发执行动画

  31. 一个进程的生命期可以划分为一组状态,这些状态刻划了整个进程。一个进程的生命期可以划分为一组状态,这些状态刻划了整个进程。 进程的状态反映进程执行过程的变化。 进程的状态转换是一个非常复杂的过程。从一种状态到另一种状态的转换除了要使用不同的控制过程,有时还要借助于硬件触发器才能完成。 2.2 Process States(进程状态及转换) 从上面的三进程的例子可看到,由于有几个进程同时在运行,在某一时刻,不同的进程有不同的状态,如正在运行的进程,等待运行的进程,还有等待I/O设备的进程,所以,进程的状态及转换是一个重要的概念。

  32. Dispatch Exit Running Not Running Enter Pause State transition diagram 2.2.1 Two-State Process Model 两状态的进程模型 • Process may be in one of two states • Running(运行) • Not-running(不运行)

  33. Dispatcher(分派程序) Program that assigns the processor to one process or another(分派CPU给一个个进程) Prevents a single process from monopolizing processor time(防止一个进程独占CPU时间) Processor 2.2.2 Queuing Diagram 两状态进程队列图 Dispatch Queue Exit Enter Pause Queuing diagram

  34. 2.2.35 Process States (进程的5种状态) As a process executes, it changes state New(新建): The process is being created. Running : Instructions are being executed. (运行) Waiting or blocked:The process is waiting for some event to occur. 等待或阻塞 Ready : The process is waiting to be assigned to a process. (就绪) Terminate or Exit: The process has finished execution.

  35. Diagram of Process State 新建进程允许进入就绪队列 新建 结束 中断 运行 就绪 进程调度 等待 I/O或事件完成,进程从阻塞队列转入就绪队列 请求I/O或其它资源,进程转入阻塞队列中

  36. 2.2.4Example for 3 Processes 三个进程运行状态转换的例子

  37. Using Two Queues 两个队列:就绪队列和单一阻塞队列 使用单一阻塞队列,当队列中有大量的进程,导致效率下降。因为如果系统释放一个资源,要搜索整个阻塞队列。

  38. 分类型的多个阻塞队列模型

  39. Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk Two new states Blocked, suspend Ready, suspend 2.2.5 Suspended Processes (挂起的进程) 进程的挂起就是进程被交换到外存中

  40. One Suspend State 挂起的就绪进程被激活,进入就绪队列 等待事件,进程转入阻塞状态 等待的事件发生,进程转入就绪状态 阻塞进程被挂起

  41. 2.2.6 Reasons for Process Suspension Swapping The operating system needs to release sufficient main memory to bring in a process that is ready to execute(操作系统需要更多的主存空间,以调入并执行处于就绪状态的进程) Other OS reason The operating system may suspend a background or utility process or a process that is suspected of causing a problem(操作系统可能挂起后台进程或工具程序进程,或者因导致问题而已经挂起的进程) Interactive user request A user may wish to suspend execution of a program for purposes of debugging or in connection with the use of a resource(用户可能希望挂起一个进程的执行,目的是为了调试或者与一个资源的使用进行连接)

  42. Reasons for Process Suspension Timing A process may be executed periodically (e.g. an accounting or system monitoring process) and may be suspended while waiting for the next time interval(一个进程可能会周期性地执行—如计账程序或系统监控程序,而且可能在等待下一个时间间隔被挂起) Parent process request A parent process may wish to suspend execution of a descendent to examine or modify the suspended process, or to coordinate the activity of various descendents(父进程可能会希望挂起后代进程的执行,以检查或修改挂起的进程,或者协调不同后代进程之间的行为)

  43. 2.3.1 Process Creation 2. 3 Process Creation and Termination 进程的创建与终止 • Submission of a batch job(新的作业) • User logs on(用户登录) • Created to provide a service such as printing(提供新的服务) • Process creates another process(现有进程生成)

  44. 2.3.2 Process Termination 进程的终止 • Batch job issues Halt instruction(批处理指令) • User logs off(用户退出) • Quit an application(结束应用程序) • Error and fault conditions(硬件错误)

  45. Normal completion(正常完成) Time limit exceeded(超过时限) Memory unavailable(无可用存储器) Bounds violation(越界) Protection error(保护错误) example write to read-only file(如写只读文件) Arithmetic error(算术错误) Time overrun(时间超出) process waited longer than a specified maximum for an event 2.3.3 Reasons for Process Termination 终止进程的原因

  46. I/O failure(I/O失败) Invalid instruction(无效指令) happens when try to execute data Privileged instruction(特权指令,只有操作系统才能使用) Data misuse(数据误用) Operating system intervention(操作员或操作系统干涉) such as when deadlock occurs(如出现死锁) Parent terminates so child processes terminate(父进程终止子进程) Parent request(父进程请求) Reasons for Process Termination

  47. 2.4 Operating System Control Structures 进程控制结构

More Related