操作系统精髓与设计原理-第2章
- 格式:pptx
- 大小:3.46 MB
- 文档页数:43
第1章计算机系统概述1.1、图1.3中的理想机器还有两条I/O指令:0011 = 从I/O中载入AC0111 = 把AC保存到I/O中在这种情况下,12位地址标识一个特殊的外部设备。
请给出以下程序的执行过程(按照图1.4的格式):1.从设备5中载入AC。
2.加上存储器单元940的内容。
3.把AC保存到设备6中。
假设从设备5中取到的下一个值为3940单元中的值为2。
答案:存储器(16进制内容):300:3005;301:5940;302:7006步骤1:3005->IR;步骤2:3->AC步骤3:5940->IR;步骤4:3+2=5->AC步骤5:7006->IR:步骤6:AC->设备61.2、本章中用6步来描述图1.4中的程序执行情况,请使用MAR和MBR扩充这个描述。
答案:1. a. PC中包含第一条指令的地址300,该指令的内容被送入MAR中。
b. 地址为300的指令的内容(值为十六进制数1940)被送入MBR,并且PC增1。
这两个步骤是并行完成的。
c. MBR中的值被送入指令寄存器IR中。
2. a. 指令寄存器IR中的地址部分(940)被送入MAR中。
b. 地址940中的值被送入MBR中。
c. MBR中的值被送入AC中。
3. a. PC中的值(301)被送入MAR中。
b. 地址为301的指令的内容(值为十六进制数5941)被送入MBR,并且PC增1。
c. MBR中的值被送入指令寄存器IR中。
4. a. 指令寄存器IR中的地址部分(941)被送入MAR中。
b. 地址941中的值被送入MBR中。
c. AC中以前的内容和地址为941的存储单元中的内容相加,结果保存到AC中。
5. a. PC中的值(302)被送入MAR中。
b. 地址为302的指令的内容(值为十六进制数2941)被送入MBR,并且PC增1。
c. MBR中的值被送入指令寄存器IR中。
6. a. 指令寄存器IR中的地址部分(941)被送入MAR中。
第一章:计算机系统概述计算机系统基本组成I.处理器:控制计算机的操作,执行数据处理功能。
当只有一个处理器时,它通常指中央处理器(CPU)。
II. 主存储器:存储数据和程序。
iii.输入/输出模块:在计算机和外部环境之间移动数据。
iv.系统总线:为处理器、主存储器和输入输出模块提供通信的设施。
什么是中断?中断是指计算机的处理机用来处理外来请求或部错误的一种机制,该机制软硬件结合,使得计算机的处理机能够暂停当前指令系列的执行而转向请求指令系列的执行。
1.将计算机的处理机正在执行的指令系列称为当前指令系列,当前指令系列通常是用户程序。
2.将计算机为处理各类突发(非预期)事件请求(I/O请求,时钟请求,程序错误,硬件错误)而有待执行的指令系列称为请求指令系列,通常称为中断处理程序,是操作系统的一部分。
3.请求指令系列执行期间,可以被其它事件中断(在允许多重中断的情况下)。
4.执行请求指令系列完毕后,可以返回被暂停的原始指令系列,也可以不返回(在多道程序设计环境中)。
5.中断处理程序与社会事务中的应急事件的预案类似。
中断处理中断的发生激活了很多事情,包括处理器硬件中的事件及软件中的事件。
1.设备给处理器发出一个中断信号。
2.处理器在响应中断前结束指令系列的执行。
3.处理器对中断进行测定,确定存在未响应的中断,并给提交中断的设备发送确认信号,确认信号允许该设备取消它的中断信号。
4.处理器需要把处理权转移到中断程序中去做准备。
首先,需要保存从中断点恢复当前程序所需要的信息,要求的最少信息包括程序状态字(PSW)和保存在程序计数器中的下一条执行的指令地址,它们被压入系统控制栈中(参见附录1B)。
5.处理器把响应此中断的中断处理器入口地址装入程序的计数器中。
6.在这一点,与被中断程序相关的程序计数器和PSW被保存到系统栈中。
此外,还有一些其他信息被当作正在执行程序的状态的一部分。
7.中断处理器现在可以开始处理中断,其中包括检查与I/O操作相关的信息或其他引起中断的事件,还可能包括给I/O设备发送附加命令或应答。
复习题答案第1章计算机系统概述1、1 列出并简要地定义计算机得四个主要组成部分。
主存储器,存储数据与程序;算术逻辑单元,能处理二进制数据;控制单元,解读存储器中得指令并且使她们得到执行;输入/输出设备,由控制单元管理。
1、2 定义处理器寄存器得两种主要类别。
用户可见寄存器:优先使用这些寄存器,可以使机器语言或者汇编语言得程序员减少对主存储器得访问次数。
对高级语言而言,由优化编译器负责决定把哪些变量应该分配给主存储器。
一些高级语言,如C语言,允许程序言建议编译器把哪些变量保存在寄存器中。
控制与状态寄存器:用以控制处理器得操作,且主要被具有特权得操作系统例程使用,以控制程序得执行。
1、3 一般而言,一条机器指令能指定得四种不同操作就是什么?处理器-寄存器:数据可以从处理器传送到存储器,或者从存储器传送到处理器。
处理器-I/O:通过处理器与I/O模块间得数据传送,数据可以输出到外部设备,或者从外部设备输入数据。
数据处理:处理器可以执行很多关于数据得算术操作或逻辑操作。
控制:某些指令可以改变执行顺序。
1、4 什么就是中断?中断:其她模块(I/O,存储器)中断处理器正常处理过程得机制。
1、5 多中断得处理方式就是什么?处理多中断有两种方法。
第一种方法就是当正在处理一个中断时,禁止再发生中断。
第二种方法就是定义中断优先级,允许高优先级得中断打断低优先级得中断处理器得运行。
1、6 内存层次得各个元素间得特征就是什么?存储器得三个重要特性就是:价格,容量与访问时间。
1、7 什么就是高速缓冲存储器?高速缓冲存储器就是比主存小而快得存储器,用以协调主存跟处理器,作为最近储存地址得缓冲区。
1、8 列出并简要地定义I/O操作得三种技术。
可编程I/O:当处理器正在执行程序并遇到与I/O相关得指令时,它给相应得I/O模块发布命令(用以执行这个指令);在进一步得动作之前,处理器处于繁忙得等待中,直到该操作已经完成。
中断驱动I/O:当处理器正在执行程序并遇到与I/O相关得指令时,它给相应得I/O模块发布命令,并继续执行后续指令,直到后者完成,它将被I/O模块中断。
Operating Systems: Internals and Design Principles,7th Edition Course DesignIntroductionOperating Systems: Internals and Design Principles, also known asthe Dinosaur Book, is a classic text in the field of operating systems. Its latest edition, the 7th edition, covers a wide range of topics related to operating system design, including process management, memory management, file systems, and more. It is an essential text for anyone interested in understanding how operating systems work.In this course design, we will explore the major topics covered in the 7th edition of Operating Systems: Internals and Design Principles. We will provide an overview of each topic, highlighting the key concepts and design principles covered in the book. Additionally, we will provide recommended reading and exercises for each topic to further enhance your understanding.Course Outline1. IntroductionIn this section, we will introduce the course and provide an overview of the major topics covered in Operating Systems: Internals and Design Principles. We will also discuss the importance of operating systems and the role they play in modern computing.Recommended Reading: Chapter 1 of Operating Systems: Internals and Design PrinciplesExercises: 1. What is an operating system? Why are they important? 2. Identify three essential components of an operating system.2. System StructuresThis section covers the basic organization of operating systems, including kernel architecture and system calls. We will explore how processes are managed, including process scheduling, context switching, and synchronization.Recommended Reading: Chapter 2 of Operating Systems: Internals and Design PrinciplesExercises: 1. Describe the difference between a process and a thread.2. Expln the concept of process synchronization.3. Process ManagementIn this section, we will dive deeper into process management in operating systems. We will cover topics such as interprocess communication, process scheduling algorithms, and multiprocessing.Recommended Reading: Chapters 3-4 of Operating Systems: Internalsand Design PrinciplesExercises: 1. Describe two different process scheduling algorithms. 2. What is a semaphore? Expln its role in process synchronization.4. Memory ManagementMemory management is a critical aspect of operating system design. This section will cover topics such as virtual memory, paging, and segmentation.Recommended Reading: Chapter 9 of Operating Systems: Internals and Design PrinciplesExercises: 1. Expln the concept of virtual memory. How does itdiffer from physical memory? 2. Describe the paging process in memory management.5. File SystemsIn this section, we will explore file systems in operating systems. We will cover topics such as file organization, access controls, and directory structures.Recommended Reading: Chapter 10 of Operating Systems: Internals and Design PrinciplesExercises: 1. What is a file system? Describe its key components. 2. Compare and contrast the FAT and NTFS file systems.6. Input/OutputInput/output (I/O) is a fundamental aspect of operating system design. This section will cover topics such as device drivers, I/O operations, and networking.Recommended Reading: Chapter 12 of Operating Systems: Internals and Design PrinciplesExercises: 1. What is a device driver? How does it interact with the operating system? 2. Describe the difference between synchronous and asynchronous I/O operations.ConclusionOperating Systems: Internals and Design Principles is a comprehensive text that covers a wide range of topics related to operating system design. This course design provides an overview of the major topics covered in the 7th edition of the book and includes recommended reading and exercises to further enhance your understanding. By completing this course, you will have a solid foundation in operating system design principles and be better equipped to tackle real-world operating system design challenges.。
操作系统精髓与设计原理-第2章操作系统概述第二章操作系统概述复习题2.1操作系统设计的三个目标是什么?方便:操作系统使计算机更易于使用。
有效:操作系统允许以更有效的方式使用计算机系统资源。
扩展的能力:在构造操作系统时,应该允许在不妨碍服务的前提下有效地开发、测试和引进新的系统功能。
2.2什么是操作系统的内核?内核是操作系统最常使用的部分,它存在于主存中并在特权模式下运行,响应进程调度和设备中断。
2.3什么是多道程序设计?多道程序设计是一种处理操作,它在两个或多个程序间交错处理每个进程。
2.4什么是进程?进程是一个正在执行的程序,它被操作系统控制和选择。
2.5操作系统是怎么使用进程上下文的?执行上下文又称为进程状态,是操作系统用来管理和控制所需的内部数据。
这种内部信息和进程是分开的,因为操作系统信息不允许被进程直接访问。
上下文包括操作系统管理进程以及处理器正确执行进程所需要的所有信息,包括各种处理器寄存器的内容,如程序计数器和数据寄存器。
它还包括操作系统使用的信息,如进程优先级以及进程是否在等待特定I/O事件的完成。
2.6列出并简要介绍操作系统的五种典型存储管理职责。
进程隔离:操作系统必须保护独立的进程,防止互相干涉数据和存储空间。
自动分配和管理:程序应该根据需要在存储层次间动态的分配,分配对程序员是透明的。
因此,程序员无需关心与存储限制有关的问题,操作系统有效的实现分配问题,可以仅在需要时才给作业分配存储空间。
2.7解释实地址和虚地址的区别。
虚地址指的是存在于虚拟内存中的地址,它有时候在磁盘中有时候在主存中。
实地址指的是主存中的地址。
2.8描述轮循调度技术。
轮循调度是一种调度算法,所有的进程存放在一个环形队列中并按固定循序依次激活。
因为等待一些事件(例如:等待一个子进程或一个I/O操作)的发生而不能被处理的进程将控制权交给调度器。
2.9解释单体内核和微内核的区别。
单体内核是一个提供操作系统应该提供的功能的大内核,包括调度、文件系统、网络、设备驱动程序、存储管理等。