当前位置:文档之家› 现代操作系统答案

现代操作系统答案

现代操作系统答案
现代操作系统答案

第一章:

1. Multiprogramming is the rapid switching of the CPU between multiple processes in memory. It is commonly used to keep the CPU busy while one or

more processes are doing I/O.

2. Input spooling is the technique of reading in jobs, for example, from cards,

onto the disk, so that when the currently executing processes are finished,

there will be work waiting for the CPU. Output spooling consists of first

copying printable files to disk before printing them, rather than printing directly

as the output is generated. Input spooling on a personal computer is not

very likely, but output spooling is.

3. The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete. If there is no DMA, the CPU is fully occupied doing I/O, so there is nothing to be gained (at least in terms of CPU utilization)

by multiprogramming. No matter how much I/O a program does, the

CPU will be 100% busy. This of course assumes the major delay is the wait

while data are copied. A CPU could do other work if the I/O were slow for

other reasons (arriving on a serial line, for instance).

7. Choices (a), (c), and (d) should be restricted to kernel mode.

9. Every nanosecond one instruction emerges from the pipeline. This means the machine is executing 1 billion instructions per second. It does not matter at

all how many stages the pipeline has. A 10-stage pipeline with 1 nsec per

stage would also execute 1 billion instructions per second. All that matters is

how often a finished instruction pops out the end of the pipeline.

10. Average access time =

0.95 × 2 nsec (word is cache)

+ 0.05 × 0.99 × 10 nsec (word is in RAM, but not in cache)

+ 0.05 × 0.01 × 10,000,000 nsec (word on disk only)

= 5002.395 nsec

= 5.002395 μsec

13. A trap instruction switches the execution mode of a CPU from the user mode

to the kernel mode. This instruction allows a user program to invoke functions

in the operating system kernel.

14. A trap is caused by the program and is synchronous with it. If the program is run again and again, the trap will always occur at exactly the same position in

the instruction stream. An interrupt is caused by an external event and its

timing is not reproducible.

15. The process table is needed to store the state of a process that is currently suspended, either ready or blocked. It is not needed in a single process system because the single process is never suspended.

17. A system call allows a user process to access and execute operating system functions inside the kernel. User programs use system calls to invoke operating system services.

(一)21. Time to retrieve the file =

1 * 50 ms (Time to move the arm over track # 50)

+ 5 ms (Time for the first sector to rotate under the head)

+ 10/100 * 1000 ms (Read 10 MB)

= 155 ms

23. System calls do not really have names, other than in a documentation sense. When the library procedure read traps to the kernel, it puts the number of the system call in a register or on the stack. This number is used to index into a table. There is really no name used anywhere. On the other hand, the name

of the library procedure is very important, since that is what appears in the program.

第二章:

3. Generally, high-level languages do not allow the kind of access to CPU hardware that is required. For instance, an interrupt handler may be required to

enable and disable the interrupt servicing a particular device, or to manipulate data within a process’ stack area. Also, interrupt service routines must execute

as rapidly as possible.

4. There are several reasons for using a separate stack for the kernel. Two of

them are as follows. First, you do not want the operating system to crash because

a poorly written user program does not allow for enough stack space.

Second, if the kernel leaves stack data in a user program’s memory space

upon return from a system call, a malicious user might be able to use this data

to find out information about other processes.

12. User-level threads cannot be preempted by the clock unless the whole process’quantum has been used up. Kernel-level threads can be preempted individually.

In the latter case, if a thread runs too long, the clock will interrupt the

current process and thus the current thread. The kernel is free to pick a different thread from the same process to run next if it so desires.

14. The biggest advantage is the efficiency. No traps to the kernel are needed to switch threads. The biggest disadvantage is that if one thread blocks, the entire process blocks.

17. It could happen that the runtime system is precisely at the point of blocking or unblocking a thread, and is busy manipulating the scheduling queues. This

would be a very inopportune moment for the clock interrupt handler to begin inspecting those queues to see if it was time to do thread switching, since they might be in an inconsistent state. One solution is to set a flag when the runtime system is entered. The clock handler would see this and set its own flag,

then return. When the runtime system finished, it would check the clock flag,

see that a clock interrupt occurred, and now run the clock handler.

18. Yes it is possible, but inefficient. A thread wanting to do a system call first sets an alarm timer, then does the call. If the call blocks, the timer returns

control to the threads package. Of course, most of the time the call will not block, and the timer has to be cleared. Thus each system call that might block

(二)has to be executed as three system calls. If timers go off prematurely, all kinds of problems can develop. This is not an attractive way to build a

threads package.

21. Each thread calls procedures on its own, so it must have its own stack for the local variables, return addresses, and so on. This is equally true for user-level threads as for kernel-level threads.

28. With kernel threads, a thread can block on a semaphore and the kernel can run some other thread in the same process. Consequently, there is no problem using semaphores. With user-level threads, when one thread blocks on a semaphore, the kernel thinks the entire process is blocked and does not run it ever again. Consequently, the process fails.

37. For round robin, during the first 10 minutes each job gets 1/5 of the CPU. At the end of 10 minutes, C finishes. During the next 8 minutes, each job gets 1/4 of the CPU, after which time D finishes. Then each of the three remaining

jobs gets 1/3 of the CPU for 6 minutes, until B finishes, and so on. The finishing times for the five jobs are 10, 18, 24, 28, and 30, for an average of 22 minutes. For priority scheduling, B is run first. After 6 minutes it is finished. The other jobs finish at 14, 24, 26, and 30, for an average of 18.8 minutes. If the jobs run in the order A through E, they finish at 10, 16, 18, 22, and 30, for an average of 19.2 minutes. Finally, shortest job first yields finishing times of 2, 6, 12, 20, and 30, for an average of 14 minutes.

第三章:

2. Almost the entire memory has to be copied, which requires each word to be read and then rewritten at a different location. Reading 4 bytes takes 10 nsec,

so reading 1 byte takes 2.5 nsec and writing it takes another 2.5 nsec, for a

total of 5 nsec per byte compacted. This is a rate of 200,000,000 bytes/sec.

To copy 128 MB (227 bytes, which is about 1.34 × 108 bytes), the computer needs 227 /200,000,000 sec, which is about 671 msec. This number is slightly pessimistic because if the initial hole at the bottom of memory is k bytes,

those k bytes do not need to be copied. However, if there are many holes and many data segments, the holes will be small, so k will be small and the error

in the calculation will also be small.

3. The bitmap needs 1 bit per allocation unit. With 227 /n allocation units, this is 224 /n bytes. The linked list has 227 /216 or 211 nodes, each of 8 bytes, for a

total of 214 bytes. For small n, the linked list is better. For large n, the bitmap

is better. The crossover point can be calculated by equating these two formulas and solving for n. The result is 1 KB. For n smaller than 1 KB, a linked

list is better. For n larger than 1 KB, a bitmap is better. Of course, the assumption of segments and holes alternating every 64 KB is very unrealistic. Also, we need n <= 64 KB if the segments and holes are 64 KB.

4. First fit takes 20 KB, 10 KB, 18 KB. Best fit takes 12 KB, 10 KB, and 9 KB. Worst fit takes 20 KB, 18 KB, and 15 KB. Next fit takes 20 KB, 18 KB, and 9 KB.

(三)5. For a 4-KB page size the (page, offset) pairs are (4, 3616), (8, 0), and (14, 2656). For an 8-KB page size they are (2, 3616), (4, 0), and (7, 2656).

28. NRU removes page 2. FIFO removes page 3. LRU removes page 1. Second chance removes page 2.

第四章:

11. It takes 9 msec to start the transfer. To read 213 bytes at a transfer rate of 223 bytes/sec requires 2?10 sec (977 msec), for a total of 9.977 msec. Writing it

back takes another 9.977 msec. Thus copying a file takes 19.954 msec. To compact half of a 16-GB disk would involve copying 8 GB of storage, which

is 220 files. At 19.954 msec per file, this takes 20,923 sec, which is 5.8 hours. Clearly, compacting the disk after every file removal is not a great idea.

19. The bitmap requires B bits. The free list requires DF bits. The free list requires fewer bits if DF < B. Alternatively, the free list is shorter if

F/B < 1/D, where F/B is the fraction of blocks free. For 16-bit disk addresses,

the free list is shorter if 6% or less of the disk is free.

20. The beginning of the bitmap looks like:

(a) After writing file B: 1111 1111 1111 0000

(b) After deleting file A: 1000 0001 1111 0000

(c) After writing file C: 1111 1111 1111 1100

(d) After deleting file B: 1111 1110 0000 1100

21. It is not a serious problem at all. Repair is straightforward; it just takes time. The recovery algorithm is to make a list of all the blocks in all the files and

take the complement as the new free list. In UNIX this can be done by scanning

all the i-nodes. In the FAT file system, the problem cannot occur because

there is no free list. But even if there were, all that would have to be

done to recover it is to scan the FA T looking for free entries.

28. At 15,000 rpm, the disk takes 4 msec to go around once. The average access time (in msec) to read k bytes is then 8 + 2 + (k /262144) × 4. For blocks of 1 KB, 2 KB, and 4 KB, the access times are 10.015625 msec, 10.03125 msec,

and 10.0625 msec, respectively (hardly any different). These give rates of

about 102,240 KB/sec, 204,162 KB/sec, and 407,056 KB/sec, respectively.

29. If all files were 1 KB, then each 2-KB block would contain one file and 1 KB of wasted space. Trying to put two files in a block is not allowed because the

unit used to keep track of data is the block, not the semiblock. This leads to

50% wasted space. In practice, every file system has large files as well as

many small ones, and these files use the disk much more efficiently. For example, a 32,769-byte file would use 17 disk blocks for storage, given a space

efficiency of 32768/34816, which is about 94%.

33. The following disk reads are needed:

directory for /

i-node for /usr

directory for /usr

i-node for /usr/ast

(四)directory for /usr/ast

i-node for /usr/ast/courses

directory for /usr/ast/courses

i-node for /usr/ast/courses/os

directory for /usr/ast/courses/os

i-node for /usr/ast/courses/os/handout.t

In total, 10 disk reads are required.

第五章:

11. (a) Device driver.

(b) Device driver.

(c) Device-independent software.

(d) User-level software.

24. (a) 10 + 12 + 2 + 18 + 38 + 34 + 32 = 146 cylinders = 876 msec.

(b) 0 + 2 + 12 + 4 + 4 + 36 +2 = 60 cylinders = 360 msec.

(c) 0 + 2 + 16 + 2 + 30 + 4 + 4 = 58 cylinders = 348 msec.

25. In the worst case, a read/write request is not serviced for almost two full disk scans in the elevator algorithm, while it is at most one full disk scan in the modified algorithm.

28. Two msec 60 times a second is 120 msec/sec, or 12% of the CPU

现代操作系统(第三版)答案

MODERN OPERATING SYSTEMS SECOND EDITION PROBLEM SOLUTIONS ANDREW S.TANENBAUM Vrije Universiteit Amsterdam,The Netherlands PRENTICE HALL UPPER SADDLE RIVER,NJ 07458课后答案网 w w w .k h d a w .c o m

SOLUTIONS TO CHAPTER 1PROBLEMS 1.An operating system must provide the users with an extended (i.e.,virtual)machine,and it must manage the I/O devices and other system resources. 2.Multiprogramming is the rapid switching of the CPU between multiple processes in memory.It is commonly used to keep the CPU busy while one or more processes are doing I/O. 3.Input spooling is the technique of reading in jobs,for example,from cards,onto the disk,so that when the currently executing processes are ?nished,there will be work waiting for the CPU.Output spooling consists of ?rst copying printable ?les to disk before printing them,rather than printing directly as the output is generated.Input spooling on a personal computer is not very likely,but output spooling is. 4.The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete.If there is no DMA,the CPU is fully occu-pied doing I/O,so there is nothing to be gained (at least in terms of CPU utili-zation)by multiprogramming.No matter how much I/O a program does,the CPU will be 100percent busy.This of course assumes the major delay is the wait while data are copied.A CPU could do other work if the I/O were slow for other reasons (arriving on a serial line,for instance). 5.Second generation computers did not have the necessary hardware to protect the operating system from malicious user programs. 6.It is still alive.For example,Intel makes Pentium I,II,and III,and 4CPUs with a variety of different properties including speed and power consumption.All of these machines are architecturally compatible.They differ only in price and performance,which is the essence of the family idea. 7.A 25×80character monochrome text screen requires a 2000-byte buffer.The 1024×768pixel 24-bit color bitmap requires 2,359,296bytes.In 1980these two options would have cost $10and $11,520,respectively.For current prices,check on how much RAM currently costs,probably less than $1/MB. 8.Choices (a),(c),and (d)should be restricted to kernel mode. 9.Personal computer systems are always interactive,often with only a single user.Mainframe systems nearly always emphasize batch or timesharing with many users.Protection is much more of an issue on mainframe systems,as is ef?cient use of all resources. 10.Every nanosecond one instruction emerges from the pipeline.This means the machine is executing 1billion instructions per second.It does not matter at all how many stages the pipeline has.A 10-stage pipeline with 1nsec per 课后答案网 w w w .k h d a w .c o m

《现代操作系统第四版》第三章答案

第三章内存管理习题 1.IBM360有一个设计,为了对2KB大小的块进行加锁,会对每个块分配一个4bit的密钥,这个密钥存在PSW(程序状态字)中,每次内存引用时,CPU都会进行密钥比较。但该设计有诸多缺陷,除了描述中所言,请另外提出至少两条缺点。 A:密钥只有四位,故内存只能同时容纳最多十六个进程;需要用特殊硬件进行比较,同时保证操作迅速。 2.在图3-3中基址和界限寄存器含有相同的值16384,这是巧合,还是它们总是相等?如果这只是巧合,为什么在这个例子里它们是相等的? A:巧合。基地址寄存器的值是进程在内存上加载的地址;界限寄存器指示存储区的长度。 3.交换系统通过紧缩来消除空闲区。假设有很多空闲区和数据段随机分布,并且读或写32位长的字需要10ns的时间,紧缩128MB大概需要多长时间?为了简单起见,假设空闲区中含有字0,内存中最高地址处含有有效数据。 A:32bit=4Byte===>每字节10/4=2.5ns 128MB=1282^20=2^27Byte 对每个字节既要读又要写,22.5*2^27=671ms 4.在一个交换系统中,按内存地址排列的空闲区大小是10MB,4MB,20MB,18MB,7MB,9MB,12MB,和15MB。对于连续的段请求: (a) 12MB (b) 10MB (c) 9MB

使用首次适配算法,将找出哪个空闲区?使用最佳适配、最差适配、下次适配算法呢? A:首次适配算法:20MB,10MB,18MB;最佳适配算法:12MB,10MB,9MB;最差适配算法:20MB;18MB;15MB;下次适配算法:20MB;18MB;9MB; 5.物理地址和虚拟地址有什么区别? A:实际内存使用物理地址。这些是存储器芯片在总线上反应的数字。虚拟地址是指一个进程的地址空间的逻辑地址。因此,具有32位字的机器可以生成高达4GB的虚拟地址,而不管机器的内存是否多于或少于4GB。 6.对下面的每个十进制虚拟地址,分別使用4KB页面和8KB页面计算虚拟页号和偏移量:20000,32768,60000。 A:转换为二进制分别为:0100111000100000 虚拟地址应该是16位1000000000000000 1110101001100000 4KB页面偏移量范围0~4027,需要12位来存储偏移量,剩下4位作为页号;同理8KB页面需要13位来存储偏移量,剩下3位作为页号;所以,4KB | 8KB 页号| 偏移量| 页号| 偏移量20000 | 0100 111000100000 | 010 0111000100000 32768 | 1000 000000000000 | 100 0000000000000 60000 | 1110 101001100000 | 111 0101001100000 7. 使用图3-9的页表,给出下面每个虚拟地址对应的物理地址:

《现代操作系统第四版》 第六章 答案

第四章文件系统习题 Q1: 给出文件/etc/passwd的五种不同的路径名。(提示:考虑目录项”.”和”…”。) A: /etc/passwd /./etc/passwd /././etc/passwd /./././etc/passwd /etc/…/etc/passwd /etc/…/etc/…/etc/passwd /etc/…/etc/…/etc/…/etc/passwd /etc/…/etc/…/etc/…/etc/…/etc/passwd Q2:在Windows中,当用户双击资源管理器中列出的一个文件时,就会运行一个程序,并以这个文件作为参数。操作系统要知道运行的是哪个程序,请给出两种不同的方法。 A:Windows使用文件扩展名。每种文件扩展名对应一种文件类型和某些能处理这种类型的程序。另一种方式时记住哪个程序创建了该文件,并运行那个程序。Macintosh以这种方式工作。

Q3:在早期的UNIX系统中,可执行文件(a.out)以一个非常特別的魔数开始,这个数不是随机选择的。这些文件都有文件头,后面是正文段和数据段。为什么要为可执行文件挑选一个非常特别的魔数,而其他类型文件的第一个字反而有一个或多或少是随机选择的魔数? A:这些系统直接把程序载入内存,并且从word0(魔数)开始执行。为了避免将header作为代码执行,魔数是一条branch指令,其目标地址正好在header之上。按这种方法,就可能把二进制文件直接读取到新的进程地址空间,并且从0 开始运行。 Q4: 在UNIX中open系统调用绝对需要吗?如果没有会产生什么结果? A: open调用的目的是:把文件属性和磁盘地址表装入内存,便与后续调用的快速访问。 首先,如果没有open系统调用,每次读取文件都需要指定要打开的文件的名称。系统将必须获取其i节点,虽然可以缓存它,但面临一个问题是何时将i节点写回磁盘。可以在超时后写回磁盘,虽然这有点笨拙,但它可能起作用。 Q5:在支持顺序文件的系统中总有一个文件回绕操作,支持随机存取

现代操作系统--作业题整理演示教学

注:标有“操作系统第二版中文版答案”的答案是从操作系统第二版中文答案的电子书上摘抄的,剩下的是非标准答案(可以忽略~~)。有几道题没有写。以下的相关文档仅供参考!祝各位同学考试愉快! 第一章:引论(P44) 1、什么是多道程序设计? 答:多道程序就是CPU在内存中多个进程之间迅速切换。它一般被用来使CPU 保持忙碌,当有一个或多个进程进行I/O时。(操作系统第二版中文答案) 2、什么是SPOOLing?读者是否认为将来的高级个人计算机会把SPOOLing作为标准功能? 答:SPOOLing是Simultaneous Peripheral Operation On-Line (即外部设备联机并行操作)的缩写,它是关于慢速字符设备如何与计算机主机交换信息的一种技术,通常称为“假脱机技术”。(回答:什么是SPOOLing?百度的~~~)输入SPOOLing是作业中的读入技术,例如:从卡片在磁盘,这样当当前执行的进程完成时,将等候CPU。输出SPOOLing在打印之前首先复制打印文件,而非直接打印。在个人计算机上的输入SPOOLing很少,但输出SPOOLing非常普通。(操作系统第二版中文答案) 3、在早期的计算机中,每个字节的读写直接由CPU处理(既没有DMA)。对于多道程序而言这种组织方式有什么含义? 答:多道程序的主要原因是当等候I/O完成时CPU有事可做。如果没有DMA,I/O 操作时CPU被完全占有,因此,多道程序无利可图(至少在CPU利用方面)。无论程序操作多少I/O操作,CPU都是100%的忙碌。当然,这里是假定主要的延迟是数据复制时的等待。如果I/O很慢的话,CPU可以做其他工作。(操作系统第二版中文答案) 4、系列计算机的思想在20世纪60年代由IBM引入System/360大型机。现在这种思想已经消亡了还是继续活跃着? 答:它依然存在。例如:Interl以各种各样的不同的属性包括速度和能力消耗来产生Pentium I,II,III和4。所有这些机器的体系结构都是兼容的,仅仅是价格上的不同,这些都是家族思想的本质。(操作系统第二版中文答案) 5、缓慢采用GUI的一个原因是支持它的硬件的成本(高昂)。为了支持25行80列字符的单色文本屏幕应该需要多少视频RAM?对于1024*768像素24位色彩位图需要多少视频RAM?在1980年($5/KB)这些RAM的成本是多少?现在它的成本是多少? 答:25*80字符的单色文本屏幕需要2000字节的缓冲器。1024*768像素24位颜色的位图需要2359296字节。1980年代这两种选择将分别地耗费$10和$11520。而对于当前的价格。将少于$1/MB。(操作系统第二版中文答案) 8、考虑一个有两个CPU的系统,并且每个CPU有两个线程(超线程)。假设有三

现代操作系统试卷及其答案

1.一般用户更喜欢使用的系统是()。 A.手工操作 B.单道批处理 C.多道批处理 D.多用户分时系统 2. 与计算机硬件关系最密切的软件是()。 A.编译程序 B.数据库管理系统 C.游戏程序 D.OS 3. 现代OS具有并发性和共享性,是()的引入导致的。 A.单道程序 B. 磁盘 C. 对象 D.多道程序 4. 早期的OS主要追求的是()。 A.系统的效率 B.用户的方便性 C.可移植 D.可扩充性 5.()不是多道程序系统 A.单用户单任务 B.多道批处理系统 C.单用户多任务 D.多用户分时系统 6.()是多道操作系统不可缺少的硬件支持。 A.打印机 B.中断机构 C.软盘 D.鼠标 7. 特权指令可以在()执行。 A.目态 B.浏览器中 C.任意的时间 D.进程调度中 8. 没有了()计算机系统就启动不起来。 A.编译器 B.DBMS C.OS D.浏览器 9. 通道能够完成()之间的数据传输。 A.CPU与外设 B.内存与外设 C.CPU与主存 D.外设与外设 10. 操作系统的主要功能有()。 A.进程管理、存储器管理、设备管理、处理机管理 B.虚拟存储管理、处理机管理、进程调度、文件系统 C.处理机管理、存储器管理、设备管理、文件系统 D.进程管理、中断管理、设备管理、文件系统 11. 单处理机计算机系统中,()是并行操作的。 A.处理机的操作与通道的操作是并行的 B.程序与程序 C.主程序与子程序 D.用户程序与操作系统程序 12. 处理机的所有指令可以在()执行。 A.目态 B.浏览器中

C.任意的时间 D.系统态 13.()功能不是操作系统直接完成的功能。 A.管理计算机硬盘 B.对程序进行编译 C.实现虚拟存储器 D.删除文件 14. 要求在规定的时间内对外界的请求必须给予及时响应的OS是()。 A.多用户分时系统 B.实时系统 C.批处理系统时间 D.网络操作系统 15. 操作系统是对()进行管理的软件。 A.硬件 B.软件 C.计算机资源 D.应用程序 16.()对多用户分时系统最重要。 A.实时性 B.交互性 C.共享性 D.运行效率 17.()对多道批处理系统最重要。 A.实时性 B.交互性 C.共享性 D.运行效率 18. ( )对实时系统最重要。 A.及时性 B.交互性 C.共享性 D.运行效率 19. Windows98是()操作系统。 A.多用户分时 B.批处理系统 C.单用户多任务 D.单用单任务 20. 分布式系统与网络系统的主要区别是() A.并行性 B.透明性 C.共享性 D.复杂性 21. ( )操作系统允许在一台主机上同时连接多台终端,多个用户可以通过各自的终端同时交互地使用计算机。 A.网络 B.分布式 C.分时 D.实时 22. 如果分时操作系统的时间片一定,那么(),则响应时间越长。 A.用户数越少 B.用户数越多 C.内存越小 D.内存越大 23. 下面6个系统中,必须是实时操作系统的有()个。 ·航空订票系统 ·过程控制系统 ·机器口语翻译系统 ·计算机辅助系统

操作系统教程习题答案

《操作系统教程》习题答案

习题1 1.单项选择题 (1)大中小型计算机是以为中心的计算机系统。 A、CPU B、存储器 C、系统总线 D、通道 (2)以下关于操作系统的说法正确的是。 A、批处理系统是实现人机交互的系统 B、批处理系统具有批处理功能,但不具有交互能力 C、分时系统是实现自动控制,无须人为干预的系统 D、分时系统即具有分时交互能力,又具有批处理能力 (3)操作系统的职能是管理软硬件资源、合理地组织计算机工作流程和。 A、为用户提供良好的工作环境和接口 B、对用户的命令作出快速响应 C、作为服务机构向其它站点提供优质服务 D、防止有人以非法手段进入系统 (4)设计实时操作系统时,首先应考虑系统的。 A、可靠性和灵活性 B、实时性和可靠性 C、优良性和分配性 D、灵活性和分配性 (5)多道程序设计是指。 A、在分布式系统中同一时刻运行多个程序 B、在一台处理器上并行运行多个程序 C、在实时系统中并发运行多个程序 D、在一台处理器上并发运行多个程序 (6)以下关于并发性和并行性的说法正确的是。 A、并发性是指两个及多个事件在同一时刻发生 B、并发性是指两个及多个事件在同一时间间隔内发生 C、并行性是指两个及多个事件在同一时间间隔内发生 D、并发性是指进程,并行性是指程序 (1)B (2)B (3)A (4)B (5)D (6)B 2.填空题 (1)微机是以总线为纽带构成的计算机系统。 (2)在批处理兼分时系统中,往往把由分时系统控制的作业称为前台作业,把由批处理系统控制的作业称为后台作业。 (3)在分时系统中,若时间片长度一定,则用户数越多,系统响应时间越慢。 (4)分布式操作系统能使系统中若干台计算机协同完成一个共同的任务,分解问题成为子计算并使之在系统中各台计算机上并行执行,以充分利用各计算机的优势。 (5)用户通过网络操作系统可以网络通信、资源共享,从而大大扩展了计算机的应用范围。 3.简答题 (1)什么是操作系统?现代操作系统的基本特征是什么?并发性 (2)什么是批处理系统,衡量批处理系统好坏的主要指标是什么?及时性 (3)试述分时系统的原理及其特性。时间片原则交互性同时性独立性及时性

对现代计算机操作系统的发展趋势 精

现代计算机操作系统的发展趋势一、什么是操作系统操作系统(Operating System,简称OS是管理计算机硬件的软件。作为介于计算机用户和计算机硬件之间的中间层,操作系统为应用程序提供了基础,同时也是计算机系统的核心与基石。操作系统通常是最靠近硬件的一层系统软件,它把硬件裸机改造成为功能完善的一台虚拟机,使得计算机系统的使用和管理更加方便,计算机资源的利用效率更高,上层的应用程序可以获得比硬件提供的功能更多的支持。使计算机系统所有资源最大限度地发挥作用,为用户提供方便的、有效的、友善的服务界面。操作系统是一个庞大的管理控制程序,大致包括5个方面的管理功能:进程与处理机管理、作业管理、存储管理、设备管理、文件管理。目前微机上常见的操作系统有DOS、OS/2、UNIX、XENIX、LINUX、Windows2000、Netware等。二、操作系统的发展 1、大型机时代早期的操作系统非常多样化,生产商生产出针对各自硬件的系统。每一个操作系统都有不同的命令模式、操作过程和调试工具,即使它们来自同一个生产商。最能反映这一情况的是,厂家每生产一台新的机器都会配备一套操作系统。尽管这些机器在性能上有明显差异,但它们有统一的操作系统—— OS/360。 2、小型机和UNIX的崛起 UNIX操作系统是由AT&T公司开发出来的,后来成为开发小型操作系统的起点,并成为操作系统的典范。早期的操作系统是可以被用户所利用的功能的集合。60年代末70年代初,几种硬件支持相似的或提供端口的软件可在多种系统上运行早期的系统已经利用微程序来在它们的系统上实现功能。 3、个人计算机时代微型处理器的发展使计算机的应用普及至中小企业和个人爱好者。而计算机的普及又推动了硬件组件公共接口的发展,并逐渐地要求有一种“标准”的操作系统去控制它们。在早期,主要的操作系统是8080 CPU用的 CP/M-80,它建立在数家公司针对PDP-11架构的操作系统的基础上;在此基础上又产生了MS-DOS。这些计算机在ROM都有个小小的启动程序,可以把操作系统从磁盘装载到内存;IBM-PC系列的BIOS是这一思想的延伸。随着显示设备和处理器成本的降低,很多操作系统都开始提供图形用户界面。如:UNIX提供的 X Window系统、微软的Windows系统、苹果的Mac系统等。三、现代操作系统的发展(一)微内核操作系统对于一个操作系统而言,内核通常是系统中最核心的

操作系统教程第5版课后答案

操作系统教程第5版课后答案 费祥林、骆斌编著 第一章操作系统概论 习题一 一、思考题 1.简述现代计算机系统的组成及层次结构。 答:现代计算机系统由硬件和软件两个部分组成。是硬件和软件相互交织形成的集合体,构成一个解决计算问题的工具。硬件层提供基本可计算的资源,包括处理器、寄存器、内存、外存及I/O设备。软件层由包括系统软件、支撑软件和应用软件。其中系统软件是最靠近硬件的。 2、计算机系统的资源可分成哪几类?试举例说明。 答:包括两大类,硬件资源和信息资源。硬件资源分为处理器、I/O设备、存储器等;信息资源分为程序和数据等。 3.什么是操作系统?操作系统在计算机系统中的主要作用是什么? 答:操作系统是一组控制和管理计算机硬件和软件资源,合理地对各类作业进行调度,以及方便用户使用的程序的集合。 操作系统在计算机系统中主要起4个方面的作用。 (1)服务用户观点——操作系统提供用户接口和公共服务程序 (2)进程交互观点——操作系统是进程执行的控制者和协调者 (3)系统实现观点——操作系统作为扩展机或虚拟机 (4)资源管理观点——操作系统作为资源的管理者和控制者 4.操作系统如何实现计算与操作过程的自动化? 答:大致可以把操作系统分为以下几类:批处理操作系统、分时操作系统、实时操作系统、网络操作系统和分布式操作系统。其中批处理操作系统能按照用户预先规定好的步骤控制作业的执行,实现计算机操作的自动化。又可分为批处理单道系统和批处理多道系统。单道系统每次只有一个作业装入计算机系统的主存储器运行,多个作业可自动、顺序地被装入运行。批处理多道系统则允许多个作业同时装入主存储器,中央处理器轮流地执行各个作业,各个作业可以同时使用各自所需的外围设备,这样可以充分利用计算机系统的资源,缩短作业时间,提高系统的吞吐率 5.操作系统要为用户提供哪些基本的和共性的服务? 答:(1)创建程序和执行程序;(2)数据I/O和信息存取;(3)通信服务;(4)差错检测和处理。为了保证高效率、高质量的工作,使得多个应用程序能够有效的共享系统资源,提高系统效率,操作系统还具备一些其他的功能:资源分配,统计,保护等。 6.试述操作系统所提供的各种用户接口。 答:操作系统通过程序接口和操作接口将其服务和功能提供给用户。程序接口由一组系统调用组成,在应用程序中使用“系统调用”可获得操作系统的低层服务,访问或使用系统管理的各种软硬件资源,是操作系统对外提供服务和功能的手段;操作接口由一组命令和(或)作业控制语言组成,是操作系统为用户提

浅谈计算机操作系统现状与发展

浅谈计算机操作系统现状与发展 摘要:操作系统(Operating System,简称OS)是计算机系统的重要组成部分,是一个重要的系统软件,它负责管理计算机系统的硬、软件资源和整个计算机的工作流程,协调系统部件之间,系统与用户之间、用户与用户之间的关系。随着操作系统的新技术的不断出现,功能不断增加。操作系统作为一个标准的套装软件必须满足尽可能多用户的需要,于是系统不断膨胀,功能不断增加,并逐渐形成从开发工具到系统工具再到应用软件的一个平台环境。更能满足用户需求。本文主要针对操作系统在计算机发展中的核心地位和技术变革作出了分析,同时对计算机操作系统的功能,发展和分类做了简单的分析和阐述,以及对计算机未来发展趋势做了一个预测。 关键词:计算机操作系统,发展历程,新技术,发展趋势 Talking about the Present Situation and Development of Computer Operating System Abstract: Operating system (OS) is an important part of the computer system, is an important system software, which is responsible for managing the computer system hardware and software resources and the entire computer workflow, coordination between system components, systems and users Between the user and the user relationship. With the continuous emergence of the new technology of the operating system, the function is increasing. The operating system as a standard suite of software must meet the needs of as many users as possible, so the system is constantly expanding, the function is increasing, and gradually formed from the development tools to the system tools to the application software to a platform environment. More able to meet user needs. This paper mainly analyzes the core position and technological change of the computer in the development of the computer system, and makes a simple analysis and elaboration of the function, development and classification of the computer operating system, and makes a prediction of the future development trend of the computer.

江西理工大学-现代操作系统考试复习题

第一章:引论 1.系统调用与中断的概念。 作业题解 第一章引论 PE1-14. 陷阱和中断的主要差别是什么? 答:陷阱是由程序造成的,并且与它同步。如果程序一而再地被运行,陷阱将总在指令流中相同的位置的精确发生。而中断则是由外部事件和其他时钟造成的,不具有重复性。 PE1-20. 有一个文件,其文件描述符是fd,内含下列字节序列:3,1,4,1,5,9,2,6,5,3,5.有如下系统调用: lseek (fd, 3, SEEK_SET); // 从文件开头偏移量为3,此时将读写位置移到文件1,5,9,2的1处 Read(fd, &buffer, 4); 其中lseek调用寻找文件中的字节3.在读操作完成之后,buffer中的内容是什么? 答:包含字节:1,5,9,2。 PE1-22. 块特殊文件和字符特殊文件的基本差别是什么? 答:块特殊文件包含被编号的块,每一块都可以独立地读取或者写入。而且可以定位于任何块,并且开始读出或写入。这些对于字符特殊文件是不可能的。 PE1-29. 下面是单位转换练习: (a)一微年是多少秒? (b)微米常称micron.那么gigamicron是多长? (c)1TB存储器中有多少字节? (d)地球的质量是6000 yottagram,换算成kilogram是多少? 答:这些都可以直接转换: (a) micro year = 10-6X 365 X 24 X 3600 = 31.536 sec。 (b) 1km或者1000。 (c)有240字节,也就是1,099,511,627,776 字节。 (d)它是6 X 1024公斤。 第二章:进程与线程 1.进程的概念。 答:进程是对正在运行的程序的一个抽象。是容纳运行一个程序所需要的所有信息的容器。也可以说一个进程就是就是一个正在运行的实例。 2.进程的三种基本状态。 运行态(该时刻进程实际占用CPU)。 就绪态(可运行,但因为其他进程正在运行而暂时停止)。 阻塞态(除非某种外部事件发生,否则进程不能运行)。

现代操作系统第四版 第二章 答案

现代操作系统第二章进程与线程习题 1. 图2-2中给出了三个进程状态,在理论上,三个状态可以有六种转换,每个状态两个。但是,图中只给出了四种转换。有没有可能发生其他两种转换中的一个或两个 A:从阻塞到运行的转换是可以想象的。假设某个进程在I/O上阻塞,而且I/O结束,如果此时CPU空闲,该进程就可以从阻塞态直接转到运行态。而另外一种转换(从阻塞态到就绪态)是不可能的。一个就绪进程是不可能做任何会产生阻塞的I/O或者别的什么事情。只有运行的进程才能被阻塞。 2.假设要设计一种先进的计算机体系结构,它使用硬件而不是中断来完成进程切换。CPU需要哪些信息请描述用硬件完成进程切换的工作过程。 A:应该有一个寄存器包含当前进程表项的指针。当I/O结束时,CPU将把当前的机器状态存入到当前进程表项中。然后,将转到中断设备的中断向量,读取另一个过程表项的指针(服务例程),然后,就可以启动这个进程了。 3.当代计算机中,为什么中断处理程序至少有一部分是用汇编语言编写的 A:通常,高级语言不允许访问CPU硬件,而这种访问是必需的。例如,中断处理程序可能需要禁用和启用某个特定设备的中断服务,或者处理进程堆栈区的数据。另外,中断服务例程需要尽快地执行。(补充)主要是出于效率方面的考量。中断处理程序需要在尽量短的时间内完成所需的必要处理,尽量减少对线程/程序流造成的影响,因此大部分情况下用汇编直接编写,跳过了通用编译过程中冗余的适配部分。 4.中断或系统调用把控制转给操作系统时,为什么通常会用到与被中断进程的栈分离的内核栈 A:内核使用单独的堆栈有若干的原因。其中两个原因如下:首先,不希望操作系统崩溃,由于某些用户程序不允许足够的堆栈空间。第二,如果内核将数据保留在用户空间,然后从系统调用返回,那么恶意的用户可能使用这些数据找出某些关于其它进程的信息。 5.一个计算机系统的内存有足够的空间容纳5个程序。这些程序有一半的时间处于等待I/O的空闲状态。请问CPU时间浪费的比例是多少 A:^5 =%

对现代计算机操作系统的发展趋势精

对现代计算机操作系统的 发展趋势精 Newly compiled on November 23, 2020

现代计算机操作系统的发展趋势一、什么是操作系统操作系统(Operating System,简称OS是管理计算机硬件的软件。作为介于计算机用户和计算机硬件之间的中间层,操作系统为应用程序提供了基础,同时也是计算机系统的核心与基石。操作系统通常是最靠近硬件的一层系统软件,它把硬件裸机改造成为功能完善的一台虚拟机,使得计算机系统的使用和管理更加方便,计算机资源的利用效率更高,上层的应用程序可以获得比硬件提供的功能更多的支持。使计算机系统所有资源最大限度地发挥作用,为用户提供方便的、有效的、友善的服务界面。操作系统是一个庞大的管理控制程序,大致包括5个方面的管理功能:进程与处理机管理、作业管理、存储管理、设备管理、文件管理。目前微机上常见的操作系统有DOS、OS/2、UNIX、XENIX、LINUX、Windows2000、Netware等。二、操作系统的发展 1、大型机时代早期的操作系统非常多样化,生产商生产出针对各自硬件的系统。每一个操作系统都有不同的命令模式、操作过程和调试工具,即使它们来自同一个生产商。最能反映这一情况的是,厂家每生产一台新的机器都会配备一套操作系统。尽管这些机器在性能上有明显差异,但它们有统一的操作系统—— OS/360。 2、小型机和UNIX的崛起 UNIX操作系统是由AT&T公司开发出来的,后来成为开发小型操作系统的起点,并成为操作系统的典范。早期的操作系统是可以被用户所利用的功能的集合。60年代末70年代初,几种硬件支持相似的或提供端口的软件可在多种系统上运行早期的系统已经利用微程序来在它们的系统上实现功能。 3、个人计算机时代微型处理器的发展使计算机的应用普及至中小企业和个人爱好者。而计算机的普及又推动了硬件组件公共接口的发展,并逐渐地要求有一种“标准”的操作系统去控制它们。在早期,主要的操作系统是8080 CPU用的 CP/M-80,它建立在数家公司针对PDP-11架构的操作系统的基础上;在此基础上又产生了MS-DOS。这些计算机在ROM都有个小小的启动程序,可以把操作系统从磁盘装载到内存;IBM-PC系列的BIOS是这一思想的延伸。随着显示设备和处理器成本的降低,很多操作系统都开始提供图形用户界面。如:UNIX提供的 X Window系统、微软的Windows系统、苹果的Mac系统等。三、现代操作系统的发展(一)微内核操作系统对于一个操作系统而言,内核通常是系统中最核心的

(完整版)操作系统期末试卷(含答案)

一、选择题 1、在现代操作系统中引入了(),从而使并发和共享成为可能。 A.单道程序 B. 磁盘 C. 对象 D.多道程序 2、( )操作系统允许在一台主机上同时连接多台终端,多个用户可以通过各自的终端同时交互地使用计算机。 A.网络 B.分布式 C.分时 D.实时 3、从用户的观点看,操作系统是()。 A. 用户与计算机硬件之间的接口 B.控制和管理计算机资源的软件 C. 合理组织计算机工作流程的软件 D.计算机资源的的管理者 4、当CPU处于管态时,它可以执行的指令是()。 A. 计算机系统中的全部指令 B. 仅限于非特权指令 C. 仅限于访管指令 D. 仅限于特权指令 5、用户在程序中试图读取某文件的第100个逻辑块时,使用操作系统提供的()接口。 A. 系统调用 B.图形用户接口 C.原语 D.键盘命令 6、下列几种关于进程的叙述,()最不符合操作系统对进程的理解? A.进程是在多程序并行环境中的完整的程序。 B.进程可以由程序、数据和进程控制块描述。 C.线程是一种特殊的进程。 D.进程是程序在一个数据集合上运行的过程,它是系统进行资源分配和调度的一个独立单位。 7、当一个进程处于()状态时,称其为等待(或阻塞)状态。 A. 它正等待中央处理机 B. 它正等待合作进程的一个消息 C. 它正等待分给它一个时间片 D. 它正等待进入内存 8、一个进程释放一种资源将有可能导致一个或几个进程()。 A.由就绪变运行 B.由运行变就绪 C.由阻塞变运行 D.由阻塞变就绪 9、下面关于线程的叙述中,正确的是()。 A.不论是系统支持线程还是用户级线程,其切换都需要内核的支持。 B.线程是资源的分配单位,进程是调度和分配的单位。 C.不管系统中是否有线程,进程都是拥有资源的独立单位。 D.在引入线程的系统中,进程仍是资源分配和调度分派的基本单位。 10、设有3个作业,它们同时到达,运行时间分别为T1、T2和T3,且T1≤T2≤T3,若它们在单处理机系统中按单道运行,采用短作业优先调度算法,则平均周转时间为()。 A. T1+T2+T3 B. (T1+T2+T3)/3 C. T1+T2/3+2*T3/3 D.T3/3+2*T2/3+T1 11、在下面的I/O控制方式中,需要CPU干预最少的方式是()。 A.程序I/O方式B.中断驱动I/O控制方式C.直接存储器访问DMA控制方式D.I/O通道控制方式 12、有m个进程共享同一临界资源,若使用信号量机制实现对一临界资源的互斥访问,则

现代操作系统(中文第三版)习题答案

现代操作系统(第三版)习题答案 cztqwan 2017-06-19 (部分内容来源于网络,转载请注明出处)

目录 第一章绪论 (1) 第二章进程与线程 (8) 第三章存储管理 (21) 第四章文件系统 (32) 第五章输入/输出 (42) 第六章死锁 (55) 第七章多媒体操作系统 (65) 第八章多处理机系统 (76) 第九章安全 (88) 第十章实例研究1:Linux (100) 第十一章实例研究2:Windows Vista (110) 第十二章实例研究3:Symbian操作系统 (110) 第十三章操作系统设计 (110)

第一章绪论 1、什么是多道程序设计? 答:多道程序设计技术是指在内存同时放若于道程序,使它们在系统中并发执行,共享系统中的各种资源。当一道程序暂停执行时,CPU立即转去执行另一道程序。 2、什么是SPOOLing? 读者是否认为将来的高级个人计算机会把SPOOLing作为标准功能? 答:(假脱机技术)输入SPOOLing是作业中的读入技术,例如,从卡片在磁盘,这样当当前执行的进程完成时,将等候CPU。输出SPOOLing在打印之前首先复制打印文件,而非直接打印。在个人计算机上的输入SPOOLing很少,但是输出SPOOLing非常普遍。 3、在早期计算机中,每个字节的读写直接由CPU处理(即没有DMA),对于多道程序而言这种组织方式有什么含义? 答:多道程序的主要原因是当等候I/O完成时CPU有事可做。如果没有DMA。I/O操作时CPU被完全占有,因此,多道程序无利可图(至少在CPU利用方面)。无论程序作多少I/O操作,CPU都是100%的忙碌。当然,这里假定主要的延迟是数据复制时的等待。如果I/O很慢的话,CPU可以做其它工作。 4、系列计算机的思想在20世纪60年代由IBM引入进System/360大型机。现在这种思想已经消亡了还是继续活跃着? 答:它依然存在。例如,Intel以各种各样的不同的属性包括速度和能力消耗来生产Pentium I,II,III和4。所有这些机器的体系结构都是兼容的,仅仅是价格上的不同,这些都是家族思想的本质。 5、缓慢采用GUI的一个原因是支持它的硬件的成本(高昂)。为了支持25行80列字符的单色文本屏幕应该需要多少视颊RAM? 对于1024x768像素24位色彩位图需要多少视频RAM? 在1980年($5/KB)这些RAM的成本是多少?现在它的成本是多少? 答:25*80字符的单色文本屏幕需要2000字节的缓冲器。1024*768像素24位颜色的位图需要2359296字节。1980年这两种选择将分别地耗费$10和$11520。而对于当前的价格,将少于$1/MB。 6、在建立一个操作系统时有几个设计目的,例如资源利用、及时性、健壮性等。请列举两个可能互相矛盾的设计目的。 答:考虑公平和实时。公平要求每一个进程都以公平的方式分配资源,没有进程能得到超过公平份额的资源。另一方面,实时要求使进程在规定的时间内执行完毕的基础上分配资源。一个实时的进程可能会得到一个不成比例的资源份额。(非

现代操作系统总复习资料

操作系统基础 习题解析及实验指导 2016.9

第一篇操作系统基础知识点及习题解答 该部分罗列操作系统基础各章节的学习要点,指出学习的重点和难点,在回顾相关知识点的基础上,对典型习题进行分析和解答。 第一章操作系统引论 本章学习要点 【1】掌握操作系统的概念与作用 【2】掌握操作系统的基本类型与特点 【3】掌握操作系统的特征与功能 【4】深入领会多道程序设计技术 本章学习难点 【1】多道程序设计技术 【2】操作系统的特征 知识点回顾 一. 操作系统的概念 一个完整的计算机系统由计算机硬件系统和计算机软件系统两部分组成。操作系统是配置在计算机硬件上的第一层软件,是对硬件系统功能的第一次扩充。 图1-1 计算机系统的层次图 1.操作系统(Operating System,简称OS)的作用 (1)OS作为用户与计算机硬件系统之间的接口 OS处于用户与计算机硬件系统之间,用户通过OS来使用计算机系统。或者说,用户在OS 的帮助下能够方便、快捷、安全、可靠地操纵计算机硬件和运行自己的程序。 (2)OS作为计算机系统资源的管理者 这是广为流行的一个关于OS作用的观点。在一个计算机系统中,通常都包含了各种各样的硬件和软件资源。归纳起来可将资源分为四类:处理器、存储器、I/O设备以及信息(数据和程序)。OS的主要功能正是针对这四类资源进行有效的管理。 (3)OS用作扩充机器 对于一台完全没有软件配置的计算机系统(裸机),即使功能再强,也必定难于使用。OS在第 1 页共102 页

裸机上分别覆盖I/O设备管理软件、文件管理软件等,此时用户所看到的机器,将是一台比裸机功能更强、使用更方便的机器。通常把覆盖了软件的机器称为扩充机器或虚机器。 在计算机系统上覆盖上一层软件后,系统功能便增强一级。由于OS自身包含了若干层软件,因此当在裸机上覆盖上OS后,便可获得一台功能显著增强,使用极为方便的多层扩充机器或多层虚机器。 2.操作系统的概念 操作系统是一组控制和管理计算机硬件和软件资源、合理组织计算机的工作流程,方便用户使用的程序的集合。 操作系统是裸机上的第一层软件,是对硬件功能的首次扩充。 二. 操作系统的发展过程 人工操作方式→脱机输入输出技术→批处理技术→分时、实时系统→通用操作系统→微机操作系统→网络操作系统→分布式操作系统 1.脱机输入输出技术 为解决人工操作阶段存在的人机矛盾以及CPU与I/O速度不匹配的矛盾,引入脱机输入输出技术。系统中除主机外配置一台外围机(又称卫星机),它只与输入输出设备打交道,不与主机相连,即脱机。用户程序与数据可以在外围机控制下(脱离主机控制)预先从低速设备输入到磁带上,CPU需要时再从磁带上输入到主机,即脱机输入技术,以解决CPU与I/O速度不匹配的矛盾。类似地,脱机输出技术通过外围机完成数据从主机到磁带,再到低速输出设备上的输出操作。由于主机CPU只与高速的输入输出设备打交道,从而有效地减少了CPU等待低速设备输入输出的时间。 图1-2 脱机输入/输出方式 2.批处理技术 批处理技术是指计算机对一批作业自动进行处理的一种技术。 早期的计算机系统为了充分利用系统资源,通常把一批作业以脱机输入方式输入到磁带上,并在系统中配置监督程序,依次将作业装入内存,控制磁带上的作业自动地、一个接一个地进行处理,这样就形成了早期的单道批处理系统。 3.多道程序设计技术 为进一步改进单道批处理系统中CPU和内存利用率较低的问题,引进多道程序设计技术。 多道程序设计技术同时将多个作业放入内存并允许作业交替执行,共享系统中的资源。宏观上 第 2 页共102 页

相关主题
文本预览
相关文档 最新文档