现代操作系统(第三版)答案.pdf
《现代操作系统(第三版)答案.pdf》由会员分享,可在线阅读,更多相关《现代操作系统(第三版)答案.pdf(60页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、MODERNOPERATINGSYSTEMSSECOND EDITIONPROBLEM SOLUTIONSANDREW S.TANENBAUMVrije UniversiteitAmsterdam,The NetherlandsPRENTICE HALLUPPER SADDLE RIVER,NJ 07458课后答案网 w w w.k h d a w.c o mSOLUTIONS TO CHAPTER 1 PROBLEMS1.An operating system must provide the users with an extended(i.e.,virtual)machine,and i
2、t must manage the I/O devices and other system resources.2.Multiprogramming is the rapid switching of the CPU between multipleprocesses in memory.It is commonly used to keep the CPU busy while oneor more processes are doing I/O.3.Input spooling is the technique of reading in jobs,for example,from ca
3、rds,onto the disk,so that when the currently executing processes are finished,there will be work waiting for the CPU.Output spooling consists of firstcopying printable files to disk before printing them,rather than printingdirectly as the output is generated.Input spooling on a personal computer isn
4、ot very likely,but output spooling is.4.The prime reason for multiprogramming is to give the CPU something to dowhile 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 matt
5、er how much I/O a program does,theCPU will be 100 percent busy.This of course assumes the major delay is thewait while data are copied.A CPU could do other work if the I/O were slowfor other reasons(arriving on a serial line,for instance).5.Second generation computers did not have the necessary hard
6、ware to protectthe operating system from malicious user programs.6.It is still alive.For example,Intel makes Pentium I,II,and III,and 4 CPUswith a variety of different properties including speed and power consumption.All of these machines are architecturally compatible.They differ only inprice and p
7、erformance,which is the essence of the family idea.7.A 25 80 character monochrome text screen requires a 2000-byte buffer.The1024 768 pixel 24-bit color bitmap requires 2,359,296 bytes.In 1980 thesetwo options would have cost$10 and$11,520,respectively.For currentprices,check on how much RAM current
8、ly 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 singleuser.Mainframe systems nearly always emphasize batch or timesharing withmany users.Protection is much more of an issue on mainframe s
9、ystems,as isefficient use of all resources.10.Every nanosecond one instruction emerges from the pipeline.This means themachine is executing 1 billion instructions per second.It does not matter atall how many stages the pipeline has.A 10-stage pipeline with 1 nsec per课后答案网 w w w.k h d a w.c o m2PROBL
10、EM SOLUTIONS FOR CHAPTER 1stage would also execute 1 billion instructions per second.All that matters ishow often a finished instructions pops out the end of the pipeline.11.The manuscript contains 80 50 700=2.8 million characters.This is,ofcourse,impossible to fit into the registers of any currentl
11、y available CPU andis too big for a 1-MB cache,but if such hardware were available,themanuscript could be scanned in 2.8 msec from the registers or 5.8 msec fromthe cache.There are approximately 2700 1024-byte blocks of data,so scan-ning from the disk would require about 27 seconds,and from tape 2 m
12、inutes 7seconds.Of course,these times are just to read the data.Processing andrewriting the data would increase the time.12.Logically,it does not matter if the limit register uses a virtual address or aphysical address.However,the performance of the former is better.If virtualaddresses are used,the
13、addition of the virtual address and the base registercan start simultaneously with the comparison and then can run in parallel.Ifphysical addresses are used,the comparison cannot start until the addition iscomplete,increasing the access time.13.Maybe.If the caller gets control back and immediately o
14、verwrites the data,when the write finally occurs,the wrong data will be written.However,if thedriver first copies the data to a private buffer before returning,then the callercan be allowed to continue immediately.Another possibility is to allow thecaller to continue and give it a signal when the bu
15、ffer may be reused,but thisis tricky and error prone.14.A trap is caused by the program and is synchronous with it.If the program isrun again and again,the trap will always occur at exactly the same position inthe instruction stream.An interrupt is caused by an external event and itstiming is not re
16、producible.15.Base=40,000 and limit=10,000.An answer of limit=50,000 is incorrectfor the way the system was described in this book.It could have been imple-mented that way,but doing so would have required waiting until the address+base calculation was completed before starting the limit check,thus s
17、low-ing down the computer.16.The process table is needed to store the state of a process that is currentlysuspended,either ready or blocked.It is not needed in a single process sys-tem because the single process is never suspended.17.Mounting a file system makes any files already in the mount point
18、directoryinaccessible,so mount points are normally empty.However,a systemadministrator might want to copy some of the most important files normallylocated in the mounted directory to the mount point so they could be found intheir normal path in an emergency when the mounted device was beingchecked o
19、r repaired.课后答案网 w w w.k h d a w.c o mPROBLEM SOLUTIONS FOR CHAPTER 1318.Forkcan fail if there are no free slots left in the process table(and possibly ifthere is no memory or swap space left).Execcan fail if the file name givendoes not exist or is not a valid executable file.Unlinkcan fail if the f
20、ile to beunlinked does not exist or the calling process does not have the authority tounlink it.19.If the call fails,for example because fd is incorrect,it can return 1.It canalso fail because the disk is full and it is not possible to write the number ofbytes requested.On a correct termination,it a
21、lways returns nbytes.20.It contains the bytes:1,5,9,2.21.Block special files consist of numbered blocks,each of which can be read orwritten independently of all the other ones.It is possible to seek to any blockand start reading or writing.This is not possible with character special files.22.System
22、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 thesystem call in a register or on the stack.This number is used to index into atable.There is really no name used anywhere.On the other hand,the nameof the li
23、brary procedure is very important,since that is what appears in theprogram.23.Yes it can,especially if the kernel is a message-passing system.24.As far as program logic is concerned it does not matter whether a call to alibrary procedure results in a system call.But if performance is an issue,if ata
24、sk can be accomplished without a system call the program will run faster.Every system call involves overhead time in switching from the user contextto the kernel context.Furthermore,on a multiuser system the operating sys-tem may schedule another process to run when a system call completes,further s
25、lowing the progress in real time of a calling process.25.SeveralUNIXcalls have no counterpart in the Win32 API:Link:a Win32 program cannot refer to a file by an alternate name or see it inmore than one directory.Also,attempting to create a link is a convenient wayto test for and create a lock on a f
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 现代 操作系统 第三 答案
限制150内