题目对着老师上回给的那个答案的题号,我没写题目。
一
1.1What are the three main purposes of an operating system?
环境提供者,为计算机用户提供一个环境,使得能够在计算机硬件上方便、高效的执行程序
资源分配者,为解决问题按需分配计算机的资源,资源分配需尽可能公平、高效
控制程序
监控用户程序的执行,防止出错和对计算机的不正当使用
管理I/O设备的运行和控制
1.3 What is the main advantage of multiprogramming?
多道程序设计技术的基本思想是,在主存同时保持多道程序,主机以交替的方式同时处理多道程序。从宏观上看,主机内同时保持和处理若干道已开始运行但尚未结束的程序。从微观上看,某一时刻处理机只运行某道程序。
可以提高资源利用率的原因:由于任何一道作业的运行总是交替地串行使用CPU、外设等资源,即使用一段时间的CPU,然后使用一段时间的I/O设备,由于采用多道程序设计技术,加之对多道程序实施合理的运行调度,则可以实现CPU和I/O设备的高度并行,
可以大大提高CPU与外设的利用率。
1.4 What are the main differences between operating systems for mainframe computers and personal computers?
对这些机器的操作系统的设计目标不同。PC是便宜的,因此浪费资源,像cpu周期是不连贯的。浪费资源,但提高了可用性,增强了软件的用户界面的功能性。Mainframes是相反的,最大化资源利用率,易用,但昂贵。
1.6 Define the essential properties of the following types of operating systems:
a. Batch
b. Interactive
c. Time sharing
d. Real time
e. Network
f. Distributed
a.批处理:具有相似需求的作业被成批的集合起来,并把它们作为一个整体通过一个操作员或自动作业程序装置运行通过计算机。通过缓冲区,线下操作,后台和多道程序,运用尝试保持CPU和I/O一直繁忙,从而使得性能被提高。批处理系统对于运行那些需要
较少互动的大型作业十分适用。它们可以被更迟地提交或获得。
b.交互式:这种系统由许多短期交易构成,并且下一个交易的结果是无法预知的。从用户提交到等待结果的响应时间应该是比较短的,通常为1秒左右。
c.分时:这种系统使用CPU调度和多道程序来经济的提供一个系统的人机通信功能。CPU从一个用户快速切换到另一个用户。以每个程序从终端机中读取它的下一个控制卡,并且把输出的信息正确快速的输出到显示器上来替代用soopled card images定义的作业。
d.实时:经常用于专门的用途。这个系统从感应器上读取数据,而且必须在严格的时间内做出响应以保证正确的性能。
e.网络:提供给操作系统一个特征,使得其进入网络,比如;文件共享。
f.分布式:这种系统在几个物理处理器中分布式计算,处理器不共享内存或时钟。每个处理器都有它各自的本地存储器。它们通过各种通信线路在进行通信,比如:一条高速的总线或一个本地的网络。
Chapter 2
2.2 How does the distinction between monitor mode and user mode function as a rudimentary (基本的)form of protection (security) system?
内核态的指令只能在内核中执行,只有操作系统能够访问内核,这就避免了用户对内核的操作 ,从而起到了保护的作用
2.3 What are the differences between a trap and an interrupt? What is the use of each function?
中断是一个进程在执行的过程中,系统发生了急需处理的事件,产生中断,cpu收到中断信号后将当前正在执行的进行挂起,转而处理急需处理的事件。
陷入是指进程在执行的过程中,从用户态转到内核态。
区别:陷入是由程序造成的,并且与程序同步。如果程序一而再的被运行,陷入将总在指令流中相同位置的精确发生。而中断则是由外部事件和其时钟造成的,不具有重复性
2.4 For what types of operations is DMA useful? Explain your answer.
DMA对于内存与设备之间大量数据的移动是有用的。它不需要cpu参与转移,使转移完成的更快,cpu可以并发地执行其他的任务。
2.9 Give two reasons why caches are useful. What problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?
当两个或者更多的部件需要交换数据,以及组成部件以不同的速度完成转换时,缓存是十分有用的。缓存通过在各个组成部件之间提供一个中间速度的缓冲区来解决转换问题。如果速度较快的设备在缓存中发现它所要的数据,它就不需要再等待速度较慢的设备了。缓存中的数据必须与组成部件中的要一致。如果一个组成部件中的数据值改变了,缓存中
的这个数据也必须更新。在多进程系统中,当有不止一个进程可能进入同一个数据时,这就成了一个显著的问题。一个组成部件将会被一个同等大小的组成部件所消除,但是只有当;(a)缓存和组成部件有相同状态存储能力(也就是,当断电的时候,组成部件还能保存它的数据,缓存也一样能保存它的数据),(b)缓存是可以负担的起的,因为速度更快的存储器意味着更高的价格。
Chapter 3
3.1 What are the five major activities of an operating system in regard to process management?
1.创建,删除用户和系统的进程
2.挂起和恢复进程
3.提供进程同步的机制
4.提供进程通信的机制
5.提供死锁处理的机制
3.2 What are the three major activities of an operating system in regard to memory management?
1.追踪内存中的哪一部分正在被使用,被谁使用
2.当内存空间可用的时候,决定将哪个进程加载到内存中。
3.根据需要,分配和释放内存空间。
3.3 What are the three major activities of an operating system in regard to secondary-storage management?
1.空闲空间的管理。
2.存储空间分配
3.硬盘调度
3.4 What are the five major activities of an operating system in regard to file management?
1.创建和删除文件
2.创建和删除目录
3.提供操作文件和目录的原语
4.将文件映射到二级存储器上。
5.在稳定(非易失的)存储媒介上备份文件。
3.5 What is the purpose of the command interpreter? Why is it usually separate from the kernel?
命令解释器从用户或文件中读取命令并执行,一般而言把他们转化成系统调用。它通常是不属于内核,因为命令解释会有所变动
3.7 What is the purpose of system calls?
系统调用允许用户层的进程请求操作系统的服务。
3.11 What is the main advantage of the layered approach to system design?
就一切模块化设计而论,用模块化的方式设计操作系统有几个好处。系统更容易调试和修改,因为改变只影响到系统中有限的一部分,而不是关于操作系统的所有部分。信息只存放在需要它的地方,只在定义的和限制的区域中可访问,因此影响到数据的任何错误一定被限制在特定的模块或层中。
3.12 What are the main advantages of the microkernel approach to system design?
1.加一个新的服务时不需要修改内核
2.它更安全,因为操作更多的是在用户模式下做的而不是在内核模式下。
3.简单的内核设计和功能会使操作系统更可靠。
Chapter 4
4.2 Describe the differences among short-term, medium-term, and long-term scheduling.
短期调度(cpu调度):从内存中选择就绪可执行的作业,并为它们分配cpu.
中期调度:作为中间调度层,经常用于分时系统中。执行交换策略,从内存中移除一部分运行的程序,之后将它们恢复到它们离开的状态,继续执行。
长期调度(作业调度):决定哪些作业进入内存进行处理。
主要的不同是它们执行的频率。短期调度必须经常选择一个新的进程。长期调度使用的频率更低,因为它处理系统中存放的作业时,在它允许处理另一个作业之前,可能需要很长的时间等待一个作业完成。
4.4 Describe the actions a kernel takes to context switch between processes.
通常,操作系统必须保存现在正在运行的进程的状态,恢复将要运行的进程调度的状态。保存一个进程的状态主要包括所有cpu寄存器的值以及内存分配。上下文切换必须执行许多体系结构的业务操作,包括刷新数据和指令缓存。
Chapter5
5.1 Provide two programming examples of multithreading giving improved performance over a single-threaded solution.
1.一个WEB服务器用一个分离的线程给每个请求提供服务。
2.并行的应用,例如矩阵算法,矩阵的不同部分可以并行的工作。
3.一个交互的GUI程序,例如一个调试器,一个线程用于监视用户的输入,另一个线程描绘应用的运行,第三个线程监视性能。
5.2 Provide two programming examples of multithreading that would not improve performance over a single-threaded solution.
1)任何形式的顺序程序对线程来说都不是一个好的形式。例如一个计算个人报酬的程序。
2)另外一个例子是一个“空壳”程序,如C-shell和korn shell。这种程序必须密切检测其本身的工作空间。如打开的文件、环境变量和当前工作目录。
5.3 What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?
1.内核不知道用户级的线程,然而内核知道内核级的线程。
2.用户级线程是由线程库调度的,内核级线程是由内核调度的
3.内核级线程不需要与进程相联系,然而每个用户级线程都属于一个进程。
5.6 What resources are used when a thread is created? How do they differ
from those used when a process is created?
因为线程比进程小,所以创建线程时用的资源也比创建进程时要少。创建进程需要分配一个进程控制块PCB,一个相当大的数据结构。PCB包括一个内存映射,打开文件的列表,环境变量。分配和管理内存映射是很花费时间的。创建用户级线程或者内核级线程需要分配一个小的数据结构,包含一个寄存器集合,堆栈和优先级
Chapter 6
6.1 A CPU scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many possible different schedules are there? Give a formula in terms of n.
Answer: n! (n factorial = n n – 1 n – 2 ... 2 1)
6.2 Define the difference between preemptive and nonpreemptive scheduling. State why strict nonpreemptive scheduling is unlikely to be used in a computer center.
抢占调度允许进程在执行的过程中被中断,把cpu调走,分配给其他程序。非抢占调度可以确保只有当前进程执行完毕之后才可以放弃对cpu的控制
6.3 Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
Process Burst Time Priority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF,a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling.
b. What is the turnaround time of each process for each of the scheduling algorithms in part a?
c. What is the waiting time of each process for each of the scheduling algorithms in part a?
d. Which of the schedules in part a results in the minimal average waiting time (over all processes)?
Answer:
a. The four Gantt charts are
1 2 3 4 5 1 3 5 1 5 1 5 1 5 1
1 2 3 4 5
2 4 3 5 1
2 5 1 3 4
SJF
RR
FCFS
Priority
b. Turnaround time
FCFS RR SJF Priority
P1 10 19 19 16
P2 11 2 1 1
P3 13 7 4 18
P4 14 4 2 19
P5 19 14 9 6
c. Waiting time (turnaround time minus burst time)
Answers to Exercises 21
FCFS RR SJF Priority
P1 0 9 9 6
P2 10 1 0 0
P3 11 5 2 16
P4 13 3 1 18
P5 14 9 4 1
d. Shortest Job First
6.4 Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made.
Process Arrival Time Burst Time
P1 0.0 8
P2 0.4 4
P3 1.0 1
a. What is the average turnaround time for these processes with the FCFS scheduling algorithm?
b. What is the average turnaround time for these processes with the SJF scheduling algorithm?
c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling.
Remember that turnaround time is finishing time minus arrival time, so you have to subtract the arrival times to compute the turnaround times. FCFS is 11 if you forget to subtract arrival time.
Answer:
a. 10.53
b. 9.53
c. 6.86
Remember that turnaround time is finishing time minus arrival time, so you have to subtract
the arrival times to compute the turnaround times. FCFS is 11 if you forget to subtract
arrival time.
6.6 What advantage is there in having different time-quantum sizes on different levels of a multilevel queueing system?
进程需要更频繁的服务,例如,交互的进程,像编辑器,可以在拥有小的时间片的队列中。不需要频繁服务的进程可以放到时间片大一点的队列中,用更少的上下文切换就可以完成进程,使电脑使用更有效率。
6.10 Explain the differences in the degree to which the following scheduling algorithms discriminate in favor of short processes:
a. FCFS
b. RR
c. Multilevel feedback queues
a.FCFS----区别短任务是因为任何在长任务后到达的短任务都将会有很长的等待时间。
b.RR-----对所有的任务都是能够相同的(给它们相同的CPU时间区间),所以,短任务可以很快的离开系统,只要它们可以先完成。
c. 多级反馈队列和RR调度算法相似——它们不会先选择短任务。
Chapter 8
8.1 List three examples of deadlocks that are not related to a computer-system environment.
1.两个车从相反的方向想要通过一个单行桥。
2.一个人正在下梯子而另一个人正在向上爬梯子
3.2个火车在同一个铁轨上相向而行。
8.2 Is it possible to have a deadlock involving only one single process? Explain your answer.
不可能。 This follows directly from the hold-and-wait condition.
8.8 Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
一个系统同种类型的资源有m种,被n个进程共享。
进程不会死锁不要满足两个情况:
1. 每个进程的最大需求数在1-m之间
2. 所有进程的最大的需求之和小于m+n
老师给的m=4,n=3,每个进程至多需要2个资源:
因为2<4
且2*3=6<(4+3)
所以不会出现死锁。
Chapter 9
9.2 Explain the difference between internal and external fragmentation.
答案:内部碎片是某一区域或某一页中,未被占据其位置的作业所使用的区域。直到作业完成,释放页或区域,这个空间才能被系统所利用
Ps:书上定义:
内部碎片:进程所分配的内存可能比所所需要的要大,这两个数字之差称为内部碎片,这部分内存在分区内,而又不能用。
外部碎片:随着进程装入和移除内存,自由内存空间内分为小片段。当所有总的内存之和可以满足请求,但并不连续时,就出现了外部碎片的问题。
外部碎片可以通过紧缩,允许物理地址空间为非连续来解决。
9.3 Describe the following allocation algorithms:
First-fit:搜索可用内存的列表,分配第一块足够大的内存。
Best-fit:搜索整个可用内存的列表,在足够大的内存块中选择最小的一块分配给进程。
Worst-fit:搜索整个可用内存的列表,分配最大的内存块。
(这种方法也是正当的,它产生的残留的块将会更大,所以会比最佳适应方法产生的
残留块更有用。)
9.5 Given memory partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would each of the First-fit, Best-fit, and Worst-fit algorithms place processes of 212K, 417K, 112K, and 426K (in order)? Which algorithm makes the most efficient use of memory?
Answer:
a. First-fit:
b. 212K is put in 500K partition
c. 417K is put in 600K partition
d. 112K is put in 288K partition (new partition 288K = 500K - 212K)
e. 426K must wait
f. Best-fit:
g. 212K is put in 300K partition
h. 417K is put in 500K partition
i. 112K is put in 200K partition
j. 426K is put in 600K partition
k. Worst-fit:
l. 212K is put in 600K partition
m. 417K is put in 500K partition
n. 112K is put in 388K partition
o. 426K must wait
In this example, Best-fit turns out to be the best.
9.7 Why are page sizes always powers of 2?
页通过把一个地址分为页和偏移量来执行。把地址分为X页bits和Y偏移bits是最有效率的,而不是在一个地址上执行算法计算出页号和偏移量。因为每个bit位代表2的幂,所以在bits之间把地址分开使得页大小是2的幂。
9.8 Consider a logical address space of eight pages of 1024 words each, mapped onto a physical
memory of 32 frames.
a. How many bits are there in the logical address?
b. How many bits are there in the physical address?
Answer:
a. Logical address: 13 bits
b. Physical address: 15 bits
9.10 Consider a paging system with the page table stored in memory.
a. If a memory reference takes 200 nanoseconds, how long does a paged memory reference take?
b. If we add associative registers, and 75 percent of all page-table references are found in the associative registers, what is the effective memory reference time? (Assume that finding a page-table entry in the associative registers takes zero time, if the entry is there.)
Answer:
a. 400 nanoseconds; 200 nanoseconds to access the page table and 200 nanoseconds to
access the word in memory.
b. Effective access time = 0.75 (200 nanoseconds) + 0.25 (400 nanoseconds)
= 250
Nanoseconds.
9.16 Consider the following segment table:
What are the physical addresses for the following logical addresses?
a. 0,430
b. 1,10
c. 2,500
d. 3,400
e. 4,112
Answer:
a. 219 + 430 = 649
b. 2300 + 10 = 2310
c. illegal reference, trap to operating system
d. 1327 + 400 = 1727
e. illegal reference, trap to operating system
Chapter 10
10.1 Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.
当要访问的页不在内存上时会发生页错误(page—fault)
操作系统收到页错误信号时,会到磁盘上寻找该页,然后在内存中找到一个空闲帧(如果有的话),将该页加载到空闲帧的位置。如果内存已满,没有空闲帧,操作系统就会根据替换算法,选择一个victim,检查victim帧的修改位,看victim 帧的内容是否被更改,如果已经被更改,则将该帧中的内容写回到磁盘中,如果没有更改,则直接进行替换,然后操作系统更改进程表和页表,将该帧有效位置为有效,重新执行指令。
10.2 Assume a page reference string for a process with m frames (initially all empty). The page reference string has length p with n distinct page numbers occurring in it. For any page-replacement algorithms,
a. What is a lower bound on the number of page faults?
b. What is an upper bound on the number of page faults?
Answer:
a. n
b. P
10.3 A certain computer provides its users with a virtual-memory space of 232 bytes. The computer has 218 bytes of physical memory. The virtual memory is implemented by paging, and the page size is 4096 bytes. A user process generates the virtual address 11123456. Explain how the system establishes the corresponding physical location. Distinguish between software and hardware operations.
Answer: The virtual address in binary form is
0001 0001 0001 0010 0011 0100 0101 0110
Since the page size is 212, the page table size is 220. Therefore the low-order 12 bits “0100
0101 0110” are used as the displacement into the page, while the remaining 20 bits “0001
0001 0001 0010 0011” are used as the displacement in the page table.
10.5 Assume we have a demand-paged memory. The page table is held in registers. It takes 8 milliseconds to service a page fault if an empty page is available or the replaced page is not modified, and 20 milliseconds if the replaced page is modified. Memory access time is 100 nanoseconds. Assume that the page to be replaced is modified 70 percent of the time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200 nanoseconds?
Answer:
0.2 sec = (1 ?? P) 0.1 sec + (0.3P) 8 millisec + (0.7P) 20 millisec
0.1 = ??0.1P + 2400 P + 14000 P
0.1 ' 16,400 P
P ' 0.000006
10.11 Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each.
LRU replacement
FIFO replacement
Optimal replacement
Answer:
Number of frames LRU FIFO Optimal
1 20 20 20
2 18 18 15
3 15 16 11
4 10 14 8
5 8 10 7
6 7 10 7
7 7 7 7
10.20 What is the cause of thrashing? How does the system detect thrashing? Once it detects thrashing, what can the system do to eliminate this problem?
系统颠簸是指进程忙于进行页置换,系统不能够完成任务的现象
分配的页数少于进程所需的最小页数时发生颠簸,导致cpu执行所需的页不在内存中,产生页错误。于是将该页调入内存,同时另外一个页被置换,cpu执行之后有需要刚被置换出去的页,于是将该页调入,将另外一个页置换出去,然后cpu又请求刚被置换出去的页,这样循环。该系统可通过对比多道程序的程度来估计CPU利用率的程度,以此来检测颠簸。
降低多道程序的程度可以消除颠簸。
PS书上解释:频繁的页调度的行为称为颠簸。如果一个进程在换页上用的时间要多于执行时间,那么这个进程就在颠簸。
操作系统在监视cpu的利用率。如果cpu利用率太低,那么就向系统中引入新进程,以增加多道程序的程度。随着多道程序程序增加,cpu利用率增加,直至达到最大值。如果多道程序程度还要继续增加,那么系统颠簸就开始了,且cpu利用率急剧下降。这时,为了增加cpu利用率和降低系统颠簸,必须降低多道程序的程度。
Chapter 11
11.1 Consider a file system where a file can be deleted and its disk space reclaimed while links to that file still exist. What problems may occur if a new file is created in the same storage area or with the same absolute path name? How can these problems be avoided?
F1成为老的文件,F2成为新的文件。一个用户希望通过一个存在的链接访问F1实际上是访问F2。注意用的是F1的访问权限而不是F2的。
这个问题可以避免,通过确保删除所有已删除文件的链接。
这个可以用几个方法完成:
A. 保存到一个文件的所有链接的列表,当文件被删除时,把它们都移除。
B. 保留链接,当企图访问一个已删除的文件时,移除它们。
C. 保持一个文件引用列表(或计数器),只有当删除一个文件所有的链接或引用后,才可以删除文件。
11.7 Explain the purpose of the open and close operations.
打开操作:通知系统 命名文件将处于活跃状态
关闭操作:通知系统 命名文件再也不会被下达关闭操作的用户使用。
11.9 Give an example of an application in which data in a file should be accessed in the following order:
a. Sequentially
b. Randomly
A.打印文件内容
B.打印记录I的内容,这个记录可以用哈希或者索引的技术找到。
11.10 Some systems provide file sharing by maintaining a single copy of a file; other systems maintain several copies, one for each of the users sharing the file. Discuss the relative merits of each approach.
用单拷贝的方式,当对一个文件进行几个并发的更新时,也许会导致用户得到不正确的信息,文件将会置于一个不正确的状态。
用多拷贝的方式,将会有存储浪费,不同版本之间可能会有不一致。
Chapter 12
12.5 Consider a system that supports the strategies of contiguous, linked, and indexed allocation. What criteria should be used in deciding which strategy is best utilized for a particular file?
连续的:文件经常被顺序访问,文件比较小。
链接的:文件大,经常顺序访问。
索引的:文件大,经常随机访问。
12.9 How do caches help improve performance? Why do systems not use
more or larger caches if they are so useful?
高速缓存通过暂时把数据存储在一个较快的设备中,使不同速度的组件更有效率的进行通信。
高速缓存比较贵,因此增加缓存的数量或尺寸将会增大系统开销。
Chapter 13
13.2 Consider the following I/O scenarios on a single-user PC.
a. A mouse used with a graphical user interface
b. A tape drive on a multitasking operating system (assume no device preallocation is available)
c. A disk drive containing user files
d. A graphics card with direct bus connection, accessible through memory-mapped I/O
For each of these I/O scenarios, would you design the operating system to use buffering, spooling, caching, or a combination? Would you use polled I/O, or interrupt-driven I/O? Give reasons for your choices.
a. A mouse used with a graphical user interface:
当更高优先级的操作发生时buffering可能需要记录鼠标的移动。
Spooling和caching是不合适的,中断驱动I/O是最合适的。
b. A tape drive on a multitasking operating system (assume no device preallocation is available):
当管理磁带驱动和I/O来源或I/O目的地的吞吐量的差异时,可能用到
buffering.caching可以保持磁盘上数据的拷贝,从而可以更快速的访问。Spooling可以用来存储数据到设备上当多个用户想要对它进行读写操作的时候。中断驱动I/O更可能得到最好的执行。
c. A disk drive containing user files:
buffering在数据从用户空间到磁盘的运输过程中可以保持数据,反之亦然。Caching可以用来保持磁盘上的数据,以提高性能。Spooling不是需要的,因为磁盘是可以共享访问的设备。中断驱动I/O对于像磁盘这样的,以低速率传送数据的设备是最好的
d. A graphics card with direct bus connection, accessible through memory-mapped I/O:
buffering可能被需要去控制多路访问和性能(double-buffering可以在显示当前屏幕画面的时候保持下一个屏幕画面)。Caching和spooling不是必须的,因为设备快速,可以共享访问的特性。
Polling和interrupts只有在输入和检测I/O完成时是有用的,内存映射设备不需要
Polling和interrupts。
Chapter 18
18.1 What are the main differences between capability lists and access lists?
access list 中指出了对于每个对象的每个域的访问权限,capability list指出了对每个对象的每个域的所能够进行的操作
18.11 在任何时候,进程只能访问自己所需的同时已经被授予访问权限的资源。这个原则避免了一些错误进程对系统造成破坏
18.11 What is the need-to-know principle? Why is it important for a protection system to adhere to this principle?
Answer: A process may access at any time those resources that it has been authorized to access and are required currently to complete its task. It is important in that it limits the amount of damage a faulty process can cause in a system.
Chapter19
19.1 A password may become known to other users in a variety of ways. Is there a simple method for detecting that such an event has occurred? Explain your answer.
无论用户什么时候登陆,系统都打印出用户上一次登陆该系统的时间19.2
将密码内部加密,使他们只能访问到编码的形式。只有系统操作员知道怎么去解码,可以访问这些密码。
19.2 The list of all passwords is kept within the operating system. Thus, if a user manages to read this list, password protection is no longer provided. Suggest a scheme that will avoid this problem. (Hint: Use different internal and external representations.)
Answer: Encrypt the passwords internally so that they can only be accessed in coded
form. The only person with access or knowledge of decoding should be the system operator.
7.1让两个进程来实现如图所示的任务。其中进程P1依次运行S1,S2,S4,S5,S7子任务,进程P2依次运行S3,S6子任务。请使用PV操作实现两进程间的同步。请说明信号量初值。
答:可以用信号量描述如下(3分):
semaphore s13,s46,s67;
s13=0;s46=0;s67=0;//信号量初值都设置为0
进程P1程序框架如下:
……
S1;
V(s13);
S2;
S4;
V(s46);
S5;
P(s67);
S7
……
进程P2程序框架如下:
……
P(s13)
S3;
P(46);
S6;
V(67);
因篇幅问题不能全部显示,请点此查看更多更全内容