操作系统全英文期末考试题(带答案)
操作系统设计与实现课后习题答案(英文)

操作系统设计与实现课后习题答案(英⽂)OPERATING SYSTEMS: DESIGN AND IMPLEMENTATIONTHIRD EDITIONPROBLEM SOLUTIONSANDREW S.TANENBAUMVrije UniversiteitAmsterdam,The NetherlandsALBERT S.WOODHULLAmherst,MassachusettsPRENTICE HALLUPPER SADDLE RIVER,NJ07458SOLUTIONS TO CHAPTER1PROBLEMS1.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.In kernel mode,every machine instruction is allowed,as is access to all theI/O devices.In user mode,many sensitive instructions are prohibited.Operating systems use these two modes to encapsulate user programs.Run-ning user programs in user mode keeps them from doing I/O and prevents them from interfering with each other and with the kernel.3.Multiprogramming is the rapid switching of the CPU between multipleprocesses in memory.It is commonly used to keep the CPU busy while one or more processes are doing I/O.4.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.5.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 matter how much I/O a program does,the CPU will be100percent busy.This of course assumes the major delay is the wait while data is copied.A CPU could do other work if the I/O were slow for other reasons(arriving on a serial line,for instance).6.Second generation computers did not have the necessary hardware to protectthe operating system from malicious user programs.7.Choices(a),(c),and(d)should be restricted to kernel mode.8.Personal computer systems are always interactive,often with only a singleuser.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.9.Arguments for closed source are that the company can vet the programmers,establish programming standards,and enforce a development and testing methodology.The main arguments for open source is that many more people look at the code,so there is a form of peer review and the odds of a bug slip-ping in are muchsmaller with so much more inspection.2PROBLEM SOLUTIONS FOR CHAPTER110.The?le will be executed.11.It is often essential to have someone who can do things that are normally for-bidden.For example,a user starts up a job that generates an in?nite amount of output.The user then logs out and goes on a three-week vacation to Lon-don.Sooner or later the disk will?ll up,and the superuser will have to manu-ally kill the process and remove the output?le.Many other such examples exist.12.Any?le can easily be named using its absolute path.Thus getting rid ofworking directories and relative paths would only be a minor inconvenience.The other way around is also possible,but trickier.In principle if the working directoryis,say,/home/ast/projects/research/proj1one could refer to the password?le as../../../../etc/passwd,but it is very clumsy.This would not be a practical way of working.13.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.14.Block special?les consist of numbered blocks,each of which can be read orwritten independently of all the other ones.It is possible to seek to any block and start reading or writing.This is not possible with character special?les.15.The read works /doc/d0db25e29b89680203d82542.html er2’s directory entry contains a pointer to thei-node of the?le,and the reference count in the i-node was incremented when user2linked to it.So the reference count will be nonzero and the?le itself will not be removed when user1removes his directory entry for it.Only when all directory entries for a?le have been removed will its i-node and data actually vanish.16.No,they are not so essential.In the absence of pipes,program1could writeits output to a?le and program2could read the?le.While this is less ef?cient than using a pipe between them,and uses unnecessary disk space,in most circumstances it would work adequately.17.The display command and reponse for a stereo or camera is similar to theshell.It is a graphical command interface to the device.18.Windows has a call spawn that creates a new process and starts a speci?cprogram in it.It is effectively a combination of fork and exec.19.If an ordinary user could set the root directory anywhere in the tree,he couldcreate a?le etc/passwd in his home directory,and then make that the root directory.He could then execute some command,such as su or login that reads the password?le,and trick the system into using his password?le, instead of the real one.PROBLEM SOLUTIONS FOR CHAPTER13 20.The getpid,getuid,getgid,and getpgrp,calls just extract a word from the pro-cess table and return it.They will execute very quickly.They are all equally fast.21.The system calls can collectively use500million instructions/sec.If eachcall takes1000instructions,up to500,000system calls/sec are possible while consuming only half the CPU.22.No,unlink removes any?le,whether it be for a regular?le or a special?le.23.When a user program writes on a?le,the data does not really go to the disk.It goes to the buffer cache.The update program issues SYNC calls every30 seconds to force the dirty blocks in the cache onto the disk,in order to limit the potential damage that a system crash could cause.24.No.What is the point of asking for a signal after a certain number of secondsif you are going to tell the system not to deliver it to you?25.Yes it can,especially if the system is a message passing system.26.When a user program executes a kernel-mode instruction or does somethingelse that is not allowed in user mode,the machine must trap to report the attempt.The early Pentiums often ignored such instructions.This made them impossible to fully virtualize and run an arbitrary unmodi?ed operating sys-tem in user mode. SOLUTIONS TO CHAPTER2PROBLEMS1.It is central because there is so much parallel or pseudoparallel activity—multiple user processes and I/O devices running at once.The multiprogram-ming model allows this activity to be described and modeled better.2.The states are running,blocked and ready.The running state means the pro-cess has the CPU and is executing.The blocked state means that the process cannot run because it is waiting for an external event to occur,such as a mes-sage or completion of I/O.The ready state means that the process wants to run and is just waiting until the CPU is available.3.You could have a register containing a pointer to the current process tableentry.When I/O completed,the CPU would store the current machine state in the current process table entry.Then it would go to the interrupt vector for the interrupting device and fetch a pointer to another process table entry(the service procedure).This process would then be started up.4.Generally,high level languages do not allow one the kind of access to CPUhardware that is required.For instance,an interrupt handler may be required to enable and disable the interrupt servicing a particular device,or to4PROBLEM SOLUTIONS FOR CHAPTER2manipulate data within a process’stack area.Also,interrupt service routines must execute as rapidly as possible.5.The?gure looks like this6.It would be dif?cult,if not impossible,to keep the?le system consistent usingthe model in part(a)of the?gure.Suppose that a client process sends a request to server process1to update a?le.This process updates the cache entry in its memory.Shortly thereafter,another client process sends a request to server2to read that?le.Unfortunately,if the?le is also cached there, server2,in its innocence,will return obsolete data.If the?rst process writes the? le through to the disk after caching it,and server2checks the disk on every read to see if its cached copy is up-to-date,the system can be made to work,but it is precisely all these disk accesses that the caching system is try-ing to avoid.7.A process is a grouping of resources:an address space,open?les,signalhandlers,and one or more threads.A thread is just an execution unit.8.Each thread calls procedures on its own,so it must have its own stack for thelocal variables,return addresses,and so on.9.A race condition is a situation in which two(or more)process are about toperform some action.Depending on the exact timing,one or other goes?rst.If one of the processes goes?rst,everything works,but if another one goes ?rst,a fatal error occurs.10.One person calls up a travel agent to?nd about price and availability.Thenhe calls the other person for approval.When he calls back,the seats are gone.11.A possible shell script might be:if[!–f numbers];echo0>numbers;?count=0while(test$count!=200)docount=‘expr$count+1‘PROBLEM SOLUTIONS FOR CHAPTER25n=‘tail–1numbers‘expr$n+1>>numbersdoneRun the script twice simultaneously,by starting it once in the background (using&)and again in the foreground.Then examine the?le numbers.It will probably start out looking like an orderly list of numbers,but at some point it will lose its orderliness,due to the race condition created by running two copies of the script.The race can be avoided by having each copy of the script test for and set a lock on the?le before entering the critical area,and unlocking it upon leaving the critical area.This can be done like this: if ln numbers numbers.lockthenn=‘tail–1numbers‘expr$n+1>>numbersrm numbers.lockThis version will just skip a turn when the?le is inaccessible,variant solu-tions could put the process to sleep,do busy waiting,or count only loops in which the operation is successful.12.Yes,at least in MINIX3.Since LINK is a system call,it will activate serverand task level processes,which,because of the multi-level scheduling of MINIX3,will receive priority over user processes.So one would expect that from the point of view of a user process,linking would be equivalent to an atomic act,and another user process could not interfere.Also,even if another user process gets a chance to run before the LINK call is complete,perhaps because the disk task blocks looking for the inode and directory,the servers and tasks complete what they are doing before accepting more work.So, even if two processes try to make a LINK call at the same time,whichever one causes a software interrupt?rst should have its LINK call completed?rst.13.Yes,it still works,but it still is busy waiting,of course.14.Yes it can.The memory word is used as a?ag,with0meaning that no one isusing the critical variables and1meaning that someone is using them.Put a 1in the register,and swap the memory word and the register.If the register contains a0after the swap,access has been granted.If it contains a1,access has been denied.When a process is done,it stores a0in the?ag in memory.15.To do a semaphore operation,the operating system?rst disables interrupts.Then it reads the value of the semaphore.If it is doing a DOWN and the semaphore is equal to zero,it puts the calling process on a list of blocked processes associated with the semaphore.If it is doing an UP,it must check6PROBLEM SOLUTIONS FOR CHAPTER2to see if any processes are blocked on the semaphore.If one or more processes are blocked,one of then is removed from the list of blocked processes and made runnable.When all these operations have been com-pleted,interrupts can be enabled again.16.Associated with each counting semaphore are two binary semaphores,M,used for mutual exclusion,and B,used for blocking.Also associated with each counting semaphore is a counter that holds the number of UP s minus the number of DOWN s,and a list of processes blocked on that semaphore.To implement DOWN,a process?rst gains exclusive access to the semaphores, counter,and list by doing a DOWN on M.It then decrements the counter.If it is zero or more,it just does an UP on M and exits.If M is negative,the pro-cess is put on the list of blocked processes.Then an UP is done on M and a DOWN is done on B to block the process.To implement UP,?rst M is DOWN ed to get mutual exclusion,and then the counter is incremented.If it is more than zero,no one was blocked,so all that needs to be done is to UP M.If,however,the counter is now negative or zero,some process must be removed from the list.Finally,an UP is done on B and M in that order.17.With round robin scheduling it works.Sooner or later L will run,and eventu-ally it will leave its critical region.The point is,with priority scheduling,L never gets to run at all;with round robin,it gets a normal time slice periodi-cally,so it has the chance to leave its critical region.18.It is very expensive to implement.Each time any variable that appears in apredicate on which some process is waiting changes,the run-time system must re-evaluate the predicate to see if the process can be unblocked.With the Hoare and Brinch Hansen monitors,processes can only be awakened on a SIGNAL primitive. 19.The employees communicate by passing messages:orders,food,and bags inthis case.In MINIX terms,the four processes are connected by pipes.20.It does not lead to race conditions(nothing is ever lost),but it is effectivelybusy waiting.21.If a philosopher blocks,neighbors can later see that he is hungry by checkinghis state,in test,so he can be awakened when the forks are available.22.The change would mean that after a philosopher stopped eating,neither of hisneighbors could be chosen next.With only two other philosophers,both of them neighbors,the system woulddeadlock.With100philosophers,all that would happen would be a slight loss of parallelism.23.Variation1:readers have priority.No writer may start when a reader isactive.When a new reader appears,it may start immediately unless a writer is currently active.When a writer?nishes,if readers are waiting,they are allPROBLEM SOLUTIONS FOR CHAPTER 27started,regardless of the presence of waiting writers.Variation 2:Writers have priority.No reader may start when a writer is waiting.When the last active process ?nishes,a writer is started,if there is one,otherwise,all the readers (if any)are started.Variation 3:symmetric version.When a reader is active,new readers may start immediately.When a writer ?nishes,a new writer has priority,if one is waiting.In other words,once we have started reading,we keep reading until there are no readers left.Similarly,once we have started writing,all pending writers are allowed to run.24.It will need nT sec.25.If a process occurs multiple times in the list,it will get multiple quanta percycle.This approach could be used to give more important processes a larger share of the CPU.26.The CPU ef?ciency is the useful CPU time divided by the total CPU time.When Q ≥T ,the basic cycle is for the process to run for T and undergo a pro-cess switch for S .Thus (a)and (b)have an ef? ciency of T /(S +T ).When the quantum is shorter than T ,each run of T will require T /Q process switches,wasting a time ST /Q .The ef?ciency here is thenT +ST /QT which reduces to Q /(Q +S ),which is the answer to (c).For (d),we just sub-stitute Q for S and ?nd that the ef?ciency is50percent.Finally,for (e),as Q →0the ef?ciency goes to 0.27.Shortest job ?rst is the way to minimize average response time.0<x ≤3:x="" ,3,5,6,9.<="" p="" bdsfid="201">。
计算机专业英语期末复习题及参考答案

一单选题 (共10题,总分值30分 )1. hacker (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙2. functional testing (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙3. relational database (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙4. firewall (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙5. software testing (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙6. audi (3 分)B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙7. application software (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙8. machine language (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库J. 防火墙9. memory (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙10. structured programming (3 分)A. 音频B. 应用软件C. 机器语言D. 软件测试E. 结构化程序设计F. 内存G. 功能测试H. 关系数据库I. 黑客J. 防火墙二填空题 (共1题,总分值5分 )11. Microsoft Word XP is the current Window versionof Word, and documents created in Word XP can beeasily _________________________________Excel, Power Point and Access files. In the interface of Word, the_________________________________displays the name of the current application and name of the current document;the_________________________________lists the names of the menus available;the_________________________________gives the user quick access to frequently used editingfunctions; the_________________________________enables theuser to change left and right margin.toolbarrulertitle barmenu barincorporate into (5 分)三翻译题 (共10题,总分值50分 )12. hard disk (5 分)13. 集成开发环境(5 分)14. 通用串行总线(5 分)15. network security (5 分)16. software maintenance (5 分)17. electronic commerce (5 分)18. 广域网(5 分)19. 结构化查询语言(5 分)20. management information system (5 分)21. 面向对象编程(5 分)四阅读理解 (共1题,总分值15分 )22. The Internet, then known as ARPANET, wasbrought online in 1969, which initiallyconnected four major computers at universitiesin the southwestern US . The early Internet wasused by computer experts , engineers, scientists, and librarians. There was nothing friendly about it. There were no home or office personalcomputers in those days, and anyone who used it, whether a computer professional or an engineeror scientist or librarian, had to learn to use a very complex system.The Internet matured in the 1970's as a result of the TCP/IP architecture. As the commands for E-mail, FTP , and telnet were standardized, it became a lot easier for non-technical people to learn to use the nets. It was not easy by today' s standards by any means, but it did open up use of the Internet to many more people in universities in particular. Other departments besides the libraries, computer, physics, and engineering departments found ways to make good use of the nets -- to communicate with colleagues around the world and to share files and resources.In 1991, the first really friendly interface to the Internet was developed at the University of Minnesota. The University wanted to develop a simple menu system to access files and information on campus through their local network.Since the Internet was initially funded by the government, it was originally limited to research, education, and government uses. Commercial uses were prohibited unless they directly served the goals of research and education. This policy continued until the early 1990's, when independent commercial networks began to grow.(四) Choose the best answer according to Passage C.(根据上文的内容选择正确的答案。
计算机专业英语期末必考题及答案总结

switchSwitches (Switch) is an identification based on the MAC ( network card hardware address) , complete the package forwarding packets functional network equipmentA router is a device that forwards data packets between computer networks, creating an overlay internetwork. 路由器(Router)是连接因特网中各局域网、广域网的设备,它会根据信道的情况自动选择和设定路由,以最佳路径,按前后顺序发送信号的设备路由器是为信息流或数据分组选择路由的设备。
Router is a routing device to select the flow of information or data packetRouter (Router) is connected to the Internet , LAN, WAN equipment ,it will automatically select the channel and routing settings , the best path , according to the equipment before and after the order to send signals区别Switch refers to any network -level data relay equipment (although multi-finger bridge ) , while the router is more focused on the network layerThe first switch is a data link layer in the OSI / RM open architecture , which is the second layer , while the router is a beginning design work at the network layer of the OSI modelThe switch is a physical address or MAC address to determine the destination address of the forwarding data . While the router is to use the IP address)to determine the data forwarding address交换机是一个物理地址或MAC地址来确定转发数据的目的地址。
斯坦福大学2003年操作系统期末考试题(英文)

FINAL EXAM – INTRODUCTION TO OPERATING SYSTEMS CSE421May 2, 2003 (Spring 2003)NAME : _____________________________________________________________ STUDENT NUMBER : _________-_________INSTRUCTIONSThis is a closed book but you are allowed two sheets of information to refer to. You have 180 minutes to complete 10 questions. Please write neatly and clearly. To receive partial credit, you must show all work for your answers. You should have 11 pages in this exam book, some of which are blank to allow room for your answers.Raw Score : ___________/ 140 = ____________/ 1001) [20 Points] DeadlockConsider the following snapshot of a system (P=Process, R=Resource) :Answer the following questions using banker’s algorithm:a) Calculate the Needs matrix:b) Is the system in a safe state? If so, show a safe order in which the processes can run. c) Can a request of one instance of RA by Process P0 be granted safely according to Banker’s algorithm?2) [20 points] Logical and Physical Address SpacesThe Kiwi™ memory architecture design team has a dilemma. The team is considering several different memory configuration variations for an upcoming machine design. Consider the following designs (All memory accesses are in terms of bytes, and all are using paging techniques):a) [6 points] For each design, list the maximum number of pages each process can access in logical address space.b) [6 points] For each design, list the maximum number of frames in physical memory.c) [6 points] For design 3, if the outermost page table holds 32 entries, how many bits are needed in the logical address to represent the outer page table? How many bits are used for representing the offset within a page? How many bits are needed in the logical address in order to represent the inner page table?Given the following reference string:0 2 1 3 0 1 4 0 1 2 3 4showa)Page faults occur during the processing of the reference scheme?b)The hit ratio is for each of the following policies in a pure demand paging system?c)What do you observe when you move from Scheme 1 to Scheme 2? Explain. Scheme 1: FIFO with three pages of main memoryScheme 2: FIFO with four pages of main memoryConsider a system where the virtual memory page size is 2K (2048 bytes), and main memory consists of 4 page frames. Now consider a process which requires 8 pages of storage. At some point during its execution, the page table is as shown below:1.List the virtual address ranges for each virtual page.2.List the virtual address ranges that will result in a page fault.3.Give the main memory (physical) addresses for each of the following virtual addresses(all numbers decimal): (i) 8500, (ii) 14000, (iii) 5000, (iv) 2100.5) [20 points] File System ImplementationSuppose a file system is constructed using blocks of 8 words each. In this system, a word has a length of 4 bytes. The disk pack used to hold the file system consists of 32 blocks. The initial block (block 0) contains a directory entry. The directory entry contains the filename of a single file in this file system, and a pointer to the first I-node in block 1. The I-node structure is as follows (word, value):The file contains 16 words of data: the first direct index points at block 31, and the second direct index points at block 29. Blocks 4,7,10,and 15 are marked bad. Assume that free blocks are allocated in logical order starting with block 0 and that write operations modify the file system 1 block at a time.What will the state of the system look like after 100 additional words are appended to the file (draw a block diagram showing the structure of the I-node and the blocks that are allocated)6) [16 points] Disk SchedulingDisk requests come into the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in that order. Assume that the disk has 100 cylinders.A seek takes 6msec per cylinder moved. Compute the average seek time for the request sequence given above for1.First-come, First-served2.Shortest Seek Time First (SSTF)3.LOOK (with the disk-arm initially moving towards higher number cylinders from lowernumber cylinders)4.C-SCANIn all the cases, the arm is initially at cylinder 20.7) [10 points] Security: Public Key EncryptionConsider the public key encryption defined by the RSA (Rivest, Shamir, Adelman) scheme. Assume that the two starting primes are p and q are 3 and 7 respectively and determine the (nontrivial) private key and public key pairs according to the RSA scheme.8) [10 Points] Networking: TCP/IPThe following flowchart shows the client and server portions of a TCP communication session. Fill in the empty bubbles/boxes with the appropriate socket system call names.CLIENT SERVER9) [10 points] Enduring Principles in System Design1.When a system gets complex in design what is a common solution to manage thecomplexity? Give an example.2.When you experience incompatibilities between system modules, how will you solve thisproblem? Give an example.3.What is a common data structure used to manage (the slots for) n resources? Give anexample.4.The data items such as inodes and files are typically located in external memory that issluggish relative to the local main memory. How are the effective access times of these structures minimized?5.When a table maintaining a list of pointers grows unmanageably large how will you solvethis problem so that (i) search times of the table is reasonable and (ii) only the region of interest in the table need to be in the memory?10) [10 points] Nachos Operating Systems1.List the two main operations (methods) that have the potential for resulting in a pagefault.2.Where is the address that caused the page fault stored?3.You incremented the PC after every system call you implemented? Why not for pagefault system call?4.What is the purpose of Exec, Join and Exit system calls?5.Explain the above with an example.6.How would you control the access to a shared resource by multiple threads?11。
操作系统期末考试题和答案

操作系统期末考试题和答案一、选择题(每题2分,共20分)1. 在操作系统中,进程和程序的主要区别是()。
A. 程序是静态的,进程是动态的B. 程序是动态的,进程是静态的C. 程序是操作系统的一部分,进程是用户的一部分D. 程序是用户的一部分,进程是操作系统的一部分答案:A2. 下列关于死锁的描述中,错误的是()。
A. 死锁是指两个或多个进程在执行过程中,因争夺资源而造成的一种僵局B. 死锁产生的原因是系统资源不足C. 死锁的四个必要条件是互斥、占有和等待、不可剥夺和循环等待D. 死锁可以预防,但无法避免答案:D3. 在分页存储管理中,页表的作用是()。
A. 将逻辑地址转换为物理地址B. 将物理地址转换为逻辑地址C. 存储进程的执行状态D. 存储进程的资源分配情况答案:A4. 虚拟内存技术的主要目的是()。
A. 提高CPU的利用率B. 提高内存的利用率C. 提高I/O设备的利用率D. 提高磁盘的利用率答案:B5. 在操作系统中,文件的逻辑结构通常采用()。
A. 顺序结构B. 链接结构C. 索引结构D. 树形结构答案:A6. 操作系统中,文件的物理结构通常采用()。
A. 顺序结构B. 链接结构C. 索引结构D. 树形结构答案:B7. 在操作系统中,文件的共享是指()。
A. 多个进程可以同时访问同一个文件B. 多个进程可以同时修改同一个文件C. 多个进程可以同时创建同一个文件D. 多个进程可以同时删除同一个文件答案:A8. 在操作系统中,文件的保护是指()。
A. 防止文件被非法访问B. 防止文件被非法修改C. 防止文件被非法删除D. 以上都是答案:D9. 在操作系统中,文件的组织方式通常采用()。
A. 顺序文件B. 随机文件C. 索引文件D. 以上都是答案:D10. 在操作系统中,文件的存取方式通常采用()。
A. 顺序存取B. 随机存取C. 直接存取D. 以上都是答案:D二、填空题(每题2分,共20分)1. 操作系统的主要功能包括______、______、文件管理、设备管理和______。
操作系统习题(英文版)

操作系统习题(英文版)Chapter 1 – Computer Systems OverviewTrue / False Questions:1. T / F – The operating system acts as an interface between the computerhardware and the human user.2. T / F –One of the processor’s main functions is to exchange data withmemory.3. T / F –User-visible registers are typically accessible to systemprograms but are not typically available to application programs.4. T / F – Data registers are general purpose in nature, but may berestricted to specific tasks such as performing floating-point operations.5. T / F –The Program Status Word contains status information in the formof condition codes, which are bits typically set by the programmer as aresult of program operation.6. T / F – The processing required for a single instruction ona typicalcomputer system is called the Execute Cycle.7. T / F – A fetched instruction is normally loaded into the InstructionRegister (IR).8. T / F –An interrupt is a mechanism used by systemmodules to signalthe processor that normal processing should be temporarily suspended.9. T / F – To accommodate interrupts, an extra fetch cycle is added to theinstruction cycle.10. T / F –The minimum information that must be saved before theprocessor transfers control to the interrupt handler routine is theprogram status word (PSW) and the location of the current instruction.11. T / F – One approach to dealing with multiple interrupts is to disable allinterrupts while an interrupt is being processed.12. T / F – Multiprogramming allows the processor to make use of idle timecaused by long-wait interrupt handling.13. T / F – In a two-level memory hierarchy, the Hit Ratio is defined as thefraction of all memory accesses found in the slower memory.14. T / F – Cache memory exploits the principle of locality by providing asmall, fast memory between the processor and main memory.15. T / F – In cache memory design, block size refers to the unit of dataexchanged between cache and main memory16. T / F – The primary problem with programmed I/O is that the processormust wait for the I/O module to become ready and mustrepeatedlyinterrogate the status of the I/O module while waiting.Multiple Choice Questions:1. The general role of an operating system is to:a. Act as an interface between various computersb. Provide a set of services to system usersc. Manage files for application programsd. None of the above2. The four main structural elements of a computer system are:a. Processor, Registers, I/O Modules & Main Memoryb. Processor, Registers, Main Memory & System Busc. Processor, Main Memory, I/O Modules & System Busd. None of the above3. The two basic types of processor registers are:a. User-visible and Control/Status registersb. Control and Status registersc. User-visible and user-invisible registersd. None of the above4. Address registers may contain:a. Memory addresses of datab. Memory addresses of instructionsc. Partial memory addressesd. All of the above5. A Control/Status register that contains the address of the nextinstruction to be fetched is called the:a. Instruction Register (IR)b. Program Counter (PC)c. Program Status Word (PSW)d. All of the above6. The two basic steps used by the processor in instruction processingare:a. Fetch and Instruction cyclesb. Instruction and Execute cyclesc. Fetch and Execute cyclesd. None of the above7. A fetched instruction is normally loaded into the:a. Instruction Register (IR)b. Program Counter (PC)c. Accumulator (AC)d. None of the above8. A common class of interrupts is:a. Programb. Timerc. I/Od. All of the above9. When an external device becomes ready to be serviced by theprocessor, the device sends this type of signal to the processor:a. Interrupt signalb. Halt signalc. Handler signald. None of the above10. Information that must be saved prior to the processor transferringcontrol to the interrupt handler routine includes:a. Processor Status Word (PSW)b. Processor Status Word (PSW) & Location of next instructionc. Processor Status Word (PSW) & Contents of processor registersd. None of the above11. One accepted method of dealing with multiple interrupts is to:a. Define priorities for the interruptsb. Disable all interrupts except those of highest priorityc. Service them in round-robin fashiond. None of the above12. In a uniprocessor system, multiprogramming increases processorefficiency by:a. Increasing processor speedb. Taking advantage of time wasted by long wait interrupt handlingc. Eliminating all idle processor cyclesd. All of the above13. As one proceeds down the memory hierarchy (i.e., from inboardmemory to offline storage), the following condition(s) apply:a. Increasing cost per bitb. Decreasing capacityc. Increasing access timed. All of the above14. Small, fast memory located between the processor and main memoryis called:a. WORM memoryb. Cache memoryc. CD-RW memoryd. None of the above15. When a new block of data is written into cache memory, the followingdetermines which cache location the block will occupy:a. Block sizeb. Cache sizec. Write policyd. None of the above16. Direct Memory Access (DMA) operations require the followinginformation from the processor:a. Address of I/O deviceb. Starting memory location to read from or write toc. Number of words to be read or writtend. All of the aboveQuestions1.1,1.4,1.7,1.8Problems1.1,1.3,1.4,1.5,1.7Chapter 2 – Operating System OverviewTrue / False Questions:1. T / F –An operating system controls the execution of applications andacts as an interface between applications and the computer hardware.2. T / F – The operating system maintains information that can be used forbilling purposes on multi-user systems.3. T / F – The operating system typically runs in parallel with applicationpro grams, on it’s own special O/S processor.4. T / F –One of the driving forces in operating system evolution isadvancement in the underlying hardware technology.5. T / F – In the first computers, users interacted directly with thehardware and operating systems did not exist.6. T / F – In a batch-processing system, the phrase “control is passed to ajob” means that the processor is now fetching and executinginstructions in a user program.7. T / F –Uniprogramming typically provides better utilization of systemresources than multiprogramming.8. T / F –In a time sharing system, a user’s program is preempted atregular intervals, but due to relatively slow human reaction time thisoccurrence is usually transparent to the user.9. T / F –A process can be defined as a unit of activity characterized by asingle sequential thread of execution, a current state, and an associated set of system resources.10. T / F – A virtual memory address typically consists of a page numberand an offset within the page.11. T / F – Implementing priority levels is a common strategyforshort-term scheduling, which involves assigning each process in thequeue to the processor according to its level of importance.12. T / F – Complex operating systems today typically consist of a fewthousand lines of instructions.13. T / F – A monolithic kernel architecture assigns only a few essentialfunctions to the kernel, including address spaces, interprocesscommunication and basic scheduling.14. T / F –The hardware abstraction layer (HAL) maps between generichardware commands/responses and those unique to a specificplatform.Multiple Choice Questions:17. A primary objective of an operating system is:a. Convenienceb. Efficiencyc. Ability to evolved. All of the above18. The operating system provides many types of services to end-users,programmers and system designers, including:a. Built-in user applicationsb. Error detection and responsec. Relational database capabilities with the internal file systemd. All of the above19. The operating system is unusual i n it’s role as a control mechanism, inthat:a. It runs on a special processor, completely separated from therest of the systemb. It frequently relinquishes control of the system processor andmust depend on the processor to regain control of the systemc. It never relinquishes control of the system processord. None of the above20. Operating systems must evolve over time because:a. Hardware must be replaced when it failsb. Users will only purchase software that has a current copyrightdatec. New hardware is designed and implemented in the computersystemd. All of the above21. A major problem with early serial processing systems was:a. Setup timeb. Lack of input devicesc. Inability to get hardcopy outputd. All of the above22. An example of a hardware feature that is desirable in abatch-processing system is:a. Privileged instructionsb. A completely accessible memory areac. Large clock cyclesd. None of the above23. A computer hardware feature that is vital to the effective operation of amultiprogramming operating system is:a. Very large memoryb. Multiple processorsc. I/O interrupts and DMAd. All of the above24. The principle objective of a time sharing, multiprogramming system isto:a. Maximize response timeb. Maximize processor usec. Provide exclusive access to hardwared. None of the above25. Which of the following major line of computer system developmentcreated problems in timing and synchronization that contributed to the development of the concept of the process?a. Multiprogramming batch operation systemsb. Time sharing systemsc. Real time transaction systemsd. All of the above26. The paging system in a memory management system provides fordynamic mapping between a virtual address used in a program and:a. A virtual address in main memoryb. A real address in main memoryc. A real address in a programd. None of the above27. Relative to information protection and security in computer systems,access control typically refers to:a. Proving that security mechanisms perform according tospecificationb. The flow of data within the systemc. Regulating user and process access to various aspects of thesystemd. None of the above28. A common problem with full-featured operating systems, due to theirsize and difficulty of the tasks they address, is:a. Chronically late in deliveryb. Latent bugs that show up in the fieldc. Sub-par performanced. All of the above29. A technique in which a process, executing an application, is dividedinto threads that can run concurrently is called:a. Multithreadingb. Multiprocessingc. Symmetric multiprocessing (SMP)d. None of the aboveQUESTIONS2.1,2.3,2.4,2.7,2.10PROBLEMS2.1,2.2,2.3,2.4。
linux操作系统期末考试试题及答案

linux操作系统期末考试试题及答案一、选择题(每题2分,共20分)1. 以下哪个命令可以查看Linux系统的发行版信息?A. cat /etc/issueB. cat /etc/redhat-releaseC. cat /etc/debian_versionD. lsb_release -a答案:A2. 在Linux系统中,以下哪个命令可以用来查看文件权限?A. ls -lB. ls -aC. ls -rD. ls -t答案:A3. 以下哪个命令用于创建一个新的用户?A. useraddB. userdelC. groupaddD. groupdel答案:A4. 在Linux系统中,以下哪个命令可以用来查看系统运行时间?A. uptimeB. topC. psD. free答案:A5. 以下哪个命令可以用来查看系统负载?A. uptimeB. topC. psD. free答案:A6. 以下哪个命令可以用来挂载一个USB设备?A. mountB. umountC. mountpointD. mount | grep答案:A7. 以下哪个命令可以用来查看网络连接信息?A. ifconfigB. ipconfigC. netstatD. ping答案:C8. 以下哪个命令可以用来重启Linux系统?A. rebootB. shutdown -rC. shutdown -hD. init 6答案:A9. 以下哪个命令可以用来杀死一个进程?A. killB. pkillC. killallD. kill -9答案:A10. 在Linux系统中,以下哪个文件包含了系统环境变量?A. /etc/profileB. /etc/bash.bashrcC. ~/.bashrcD. /etc/environment答案:D二、填空题(每题2分,共20分)11. 在Linux系统中,文件权限分为三种类型:读(______)、写(______)和执行(______)。
计算机专业英语试题含答案

计算机专业英语试题2Ⅰ. Vocabulary(词汇)(30分)(一).Translate the following words and expressions into Chinese(写出下列词组的汉语。
)(共10分,每题1分)1.operating system2.white box testing3.hard disk4.management information system5.electronic commerce6.relational database7.software engineering8. software maintenance9. menu bar10.network security(二).Fill in the blanks with the corresponding English abbreviations.(根据汉语写出相应的英语缩写。
) (共10分,每题1分)1.只读存储器 2.广域网3.传输控制协议 4.文件传送[输]协议5.通用串行总线 6.面向对象编程7.集成开发环境 8.结构化查询语言9.数据库管理系统 10.开放系统互连(三)Match the following words and expressions in the left column with those similar in meaning in the right column.(将左列的词汇与右列相应的汉语匹配。
)(10分,每空1分)1. application software a. 音频2. machine language b. 应用软件3. structured programming c. 机器语言4. functional testing d. 软件测试5. memory e. 结构化程序设计6. relational database f. 内存7. firewall g. 功能测试8. software testing h. 关系数据库9. hacker i. 黑客10. audio j. 防火墙1. 6.2. 7.3. 8.4. 9.5. 10.Ⅱ. Comprehension(阅读理解)(一)Fill in the blanks with suitable words or expressions from the list given below, and change the form wherenecessary. (从下面方框中选择合适的词或表达,以其适当的形式填空。
操作系统全英文期末考试题(带答案)

一.选择题〔20分,每题1分〕1. Generally speaking, which one is not the major concern for a operating system in the following four options?( D )A.Manage the computerB.Manage the system resourcesC.Design and apply the interface between user's program and computer hardware systemD.High-level programming language complier2.The main disadvantage of batch system is ( C )A.CPU utilization is lowB.Can not concurrentck of interactionD.Low degree of automation3.A process transforms from waiting state to ready state is caused by the ( B )A.Interrupt eventB.Process schedulingC.Create a process for a programD.Waiting for some events4.The concurrent process is refers to ( C )A.The process can be run in parallelB.The process can be run in orderC.The process can be run in the same timeD.The process can not be interrupted5.In multi-process system, in order to ensure the integrity of public variables, the processes should be mutually exclusive access to critical areas. The so-called critical area is ( D )A.A bufferB.A date areaC.Synchronization mechanismD.A program6.The orderly use of resources allocation strategy can destroy the condition ( D ) to avoid deadlock.A.Mutual exclusiveB.Hold and waitC.No preemptionD.Circular waiter's applications use the system resources to complete its operation by the support and services of ( C )A.clicking the mouseB.Keyboard commandC.System callD.Graphical user interface8.There are four jobs arrived at the same time and the execution time of each job is 2h. Now they run on one processor at single channel,then the average turnaround time is ( B )9.Among the job scheduling algorithms, ( B ) is related to the job's estimated running time.A.FCFS scheduling algorithmB.Short-job-first scheduling algorithmC.High response ratio algorithmD.Balanced scheduling10.In memory management, the purpose of using the overlay and swapping is ( C )A.Sharing main memoryB.Expanding main memory physicallyC.Saving main memory spaceD.Improving CPU utilization11.In the page-replacement algorithm,which one can cause the Belady phenomenon? ( A )A.FIFOB.LRUC.CLOCKINGD.OPT12.The following description of the system in safe state,which one is correct?( B )A.It must cause deadlock if the system is in insecure stateB.It may cause deadlock if the system is in insecure stateC.It may cause deadlock if the system is in secure stateD.All are wrong13.Generally, when we talk about"Memory Protection", the basic meaning is ( C )A.Prevent hardware memory from damagingB.Prevent program from losing in memoryC.Prevent the cross-border call between programsD.Prevent the program from being peeped14.The actual capacity of virtual memory is equal to ( B )A.The capacity of external memory(disk)B.The sum of the capacity of external memory and main memoryC.The space that the CPU logical address givesD.The smaller one between the option B and C15.Physical file's organization is determined by ( D )A.ApplicationsB.Main memory capacityC.External memory capacityD.Operating system16.A computer system is configured with two plotters and three printers,in order to properly drive these devices,system should provide ( C ) device driver program.17.When there are fewer number of channels in system ,it may cause "bottlenecks".To solve this problem,which of the follow options is not the effective way?( A )A.improving the speed of CPUing the virtual device technologyC.Adding some hardware buffer on the devicesD.Increasing the path between devices and channels18.When I/O devices and main memory are exchanging data, it can be achieved without CPU's frequently intervention,this way of exchanging data is called ( C )A.PollingB.InterruptsC.Direct memory accessD.None of them19.The following description of device management, which one is not correct?( B )A.All external devices are managed by the system in uniformB.Channel is a software of controlling input and outputC.The I/O interrupt events from the I/O channel are managed by device managementD.One of the responsibility of the operating system is to use the hardware effectively20.The operating system used ( A ), it realized a mechanism that we can use more space to save more time.A.SPOOLINGB.Virtual storageC.ChannelD.Overlay二.填空题〔20分,每空1分〕1.Software may trigger an interrupt by executing a special operation called a system call .(P7)2.If there is only one general-purpose CPU,then the system is a single-processor system.(p12)3. A process can be thought of as a program in execution. (p79)4.As a process executes,it changes state.Each process may be in one of the following states:new,running,waiting,ready or terminated .(p83)5.Long-term(job) scheduling is the selection of processes that will beallowed to contend for the CPU.And Short-term(CPU) scheduling is the selection of one process from the ready queue. (p116)6.The process executing in the operating system may be either independent processes or cooperating processes. Cooperating processes require an interprocess communication mechanism to communicate with each other.Principally,communication is achieved through two schemes: share memory and message passing. (p116)7.In modern operating systems, resource allocation unit is process, processor scheduling unit is thread .(p127)8.Most modern operating systems provide kernel support for threads;among these are Windows,as well as Solaris and Linux .(p146)scheduling is the basis of multiprogrammed operating systems.(p153)10.The FCFS algorithm is nonpreemptive;the RR algorithm is preemptive.11.Sometimes,a waiting process is never again able to change state,because the resources it has requested are held by other waiting processes.This situation is called deadlock . (p245)12.The main purpose of a computer system is to execute programs.These programs,together with the data they access,must be in main memory(at least partially) during execution.(P274)13. The various memory-management algorithms differ in may aspects.In comparing different memory-management strategies,we use the follow considerations:Hardware support,Performance,Fragmentation,Relocation, Swapping,Sharing and protection . (p310)14.A process is thrashing if it is spending more time paging than executing.15.Virtual memory is a technique that enables us to map a large logical address space onto a smaller physical memory.(p365)16.When we solve the major problems of page replacement and frame allocation,the proper design of a paging system requires that we consider page size,I/O,locking,process creation,program structure,and other issues.(p366) 17.The operating system abstracts from the physical properties of its storage devices to define a logical storage unit,the file . (p373)18.Since files are the main information-storage mechanism in most computer system,file protection is needed.(p408)19.The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector.(P457)20.The hardware mechanism that enables a device to notify the CPU is called an interrupt .(p499)三.简答题〔30分,每题6分〕1.What is the operating system?What role does the operating system play in a computer?开放题,解释操作系统概念,操作系统可以完成哪些根本功能?关键词:a.治理系统资源,操纵程序运行,改善人机界面,为其他应用软件提供支持。
操作系统英文样题

操作系统英文样题TestTrue / False Questions:1.T / F – An operating system controls the execution ofapplications and acts as an interface betweenapplications and the computer hardware.2.T / F – The operating system maintains informationthat can be used for billing purposes on multi-usersystems.3.T / F – The principal responsibility of the operatingsystem is to control the execution of processes.4.T / F – When one process spawns another, the spawningprocess is referred to as the child process and thespawned process is referred to as the parent process.5.T / F – The less-privileged processor execution mode isoften referred to as kernel mode.6.T / F – One kind of system interrupt, the trap, relates toan error or exception condition in the currentlyrunning process.7.T / F – The Process Image refers to the binary form ofthe program code.8.T / F – A typical UNIX system employs two Runningstates, to indicate whether the process is executing inuser mode or kernel mode.9.T / F – The short-term scheduler may limit the degreeof multiprogramming to provide satisfactory service to the current set of processes.10.T / F – The long-term scheduler is invoked wheneveran event occurs that may lead to the suspension orpreemption of the currently running process.11.T / F – In a multiprogramming system, main memoryis divided into multiple sections: one for the operating system (resident monitor, kernel) and one for the set of processes currently being executed.12.T / F – In the Dynamic Partitioning technique ofmemory management, compaction refers to shifting the processes into a contiguous block, resulting in all the free memory aggregated into in a single block.13.T / F – In a memory system employing paging, thechunks of a process (called frames) can be assigned to available chunks of memory (called pages).14.T / F – A memory system employing segmentationconsists of a number of user program segments thatmust be of the same length and have a maximumsegment length.15.T / F – The condition known as thrashing occurs whenthe majority of the processes in main memory require repetitive blocking on a single shared I/O device in the system.16.T / F – A Page Fault occurs when the desired pagetable entry is not found in the Translation Lookaside Buffer (TLB).17. T / F – Double buffering refers to the concept ofusing two buffers to alternatively fill and empty in order to facilitate the buffering of an I/O request.18. T / F – A pile file refers to the least complicatedform of file organization, where data are collected in sorted order and each record consists of one burst of data.19. T / F – In the general indexed file structure, thereare no key fields and variable-length records are allowed.20. T / F – Typically, an interactive user or a processhas associated with it a current directory, oftenreferred to as the working directory.21. T / F – In a uniprocessor machine, concurrent processescannot be overlapped; they can only be interleaved.22. T / F –In indirect addressing, as applied to message passing,messages are sent to a temporary shared data structuretypically known as a mailbox.23. T / F – Deadlock can be defined as the periodic blocking of aset of processes that either compete for system resources or communicate with each other.24. T / F – A reusable resource is one that can be safely used byonly one process at a time and is not depleted by that use.Multiple Choice Questions:1.A primary objective of an operating system is:a.Convenienceb.Efficiencyc.Ability to evolved.All of the above2.The operating system provides many types of servicesto end-users, programmers and system designers,including:a.Built-in user applicationsb.Error detection and responsec.Relational database capabilities with the internalfile systemd.All of the above3.The behavior of a processor can be characterized by examining:a.A single process traceb.Multiple process tracesc.The interleaving of the process tracesd.All of the above4.There are a number of conditions that can lead to process termination, including:a.Normal completionb.Bounds violationc.Parent terminationd.All of the above5.A Memory Table is an O/S control structure that is used by the O/S to:a.Manage I/O devicesb.Manage processesc.Provide information about system filesd.None of the above6.The type of scheduling that involves the decision to adda process to those that are at least partially in main memory and therefore available for execution is referred to as:a.Long-term schedulingb.Medium-term schedulingc.I/O schedulingd.None of the above7.In terms of frequency of execution, the short-term scheduler is usually the one that executes:a.Most frequentlyb.Least frequentlyc.About the same as the other schedulersd.None of the above8.A problem with the largely obsolete Fixed Partitioningmemory management technique is that of:a.Allowing only a fixed number of Processesb.Inefficient use of memoryc.Internal fragmentationd.All of the above9.An actual location in main memory is called a(n):a.Relative addressb.Logical addressc.Absolute addressd.None of the above10.The situation that occurs when the desired page tableentry is not found in the Translation Lookaside Buffer (TLB) is called a:a.TLB missb.TLB hitc.Page faultd.None of the above11.In a combined paging/segmentation system, a user’saddress space is broken up into a number of:a.Segments or pages, at the discretion of theprogrammerb.Fixed-size pages, which are in turn broken downinto variable-sized segmentsc.Variable-sized Segments, which are in turnbroken down into fixed-size pagesd.All of the above12. An example of a block-oriented I/O device is:a. CD-ROMb. Printerc. Modemd. All of the above13. Sequential files are optimal in scenariosinvolving:a. Applications that require frequent queriesb. Applications that require the processing ofall records in the filec. Applications that require infrequent updatesd. All of the above14. In a tree-structured directory, the series ofdirectory names that culminates in a file name is referred to as the:a. Pathnameb. Working directoryc. Symbolic named. None of the above15. In order to implement mutual exclusion on a critical resourcefor competing processes, only one program at a time should be allowed:a. In the critical section of the programb. To perform message passingc. To Exhibit cooperationd. None of the above16. A resource that can be created and destroyed is called a:a. Reusable resourceb. Producible resourcec. Consumable resourced. All of the above17. A condition of policy that must be present for a deadlock tobe possible is:a. Mutual exclusionb. Hold and waitc. No preemptiond. All of the above18. In deadlocked process recovery, selection criteria forchoosing a particular process to abort or rollback includes designating the process with the:a. Most estimated time remainingb. Lowest priorityc. Least total resources allocated so fard. All of the aboveFill-In-The-Blank Questions:1. The portion of the operating system that selectsthe next process to run is called the_______________.2. When the O/S creates a process at the explicitrequest of an existing process, the action isreferred to as _______________________.3. A process that cannot execute until some eventoccurs is said to be in the _______________ state.4. In a system that implements two suspend states,a process that has been swapped out of mainmemory and into secondary memory and that isalso awaiting an event is in the________/________ state.5. The task of assigning processes to the processoror processors over time, in a way that meetssystem objectives is called _______________.6. _______________-term scheduling is part of thesystem swapping function.7. _______________ is a scheduling policy in whichthe process with the shortest expectedprocessing time is selected next, but there is nopreemption.8.The task of subdividing memory between the O/S andprocesses is performed automatically by the O/S and iscalled ___________________.9.The phenomenon, in which there is wasted spaceinternal to a partition due to the fact that the block ofdata loaded is smaller than the partition, is referred to as ___________________.10.In the Dynamic Partitioning technique of memorymanagement, the process of shifting processes so they occupy a single contiguous block in memory is called ___________________.11.In a system that employs a paging memorymanagement scheme, the ___________________ shows the frame location for each page of the process.12.The situation where the processor spends most of itstime swapping process pieces rather than executinginstructions is called _______________.13.Most virtual memory schemes make use of a specialhigh-speed cache for page table entries, called a_______________.14. The term _______________ refers to the speedwith which data moves to and from the individual I/O device.15. A hard drive is an example of a_______________-oriented I/O device.16. The disk scheduling algorithm that implementsexactly 2 subqueues in a measure to avoid theproblem of “arm stickiness” is the_________________ policy.17. The file directory information element that holdsinformation such as the permitted actions on the file (e.g., reading, writing, executing, etc.) is the ______________ information element.18. Typically, an interactive user or a process hasassociated with it a current directory, oftenreferred to as the ______________.19. The data structure or table that is used to keeptrack of the portions assigned to a file is referred to as a ______________.20. UNIX employs ______________, which is acontrol structure that contains the keyinformation needed by the operating system for a particular file.21. The situation where Process 1 (P1) holds Resource 1 (R1),while P2 holds R2, and P1 needs R2 to complete and P2needs R1 to complete is referred to as _______________.22. When only one process is allowed in its critical code sectionat a time, then _______________ is enforced.23. A monitor supports _____________ by the use of conditionvariables that are contained within the monitor and accessible only within the monitor.24. All deadlocks involve conflicting needs for resources by_________ or more processes.。
Linux操作系统考试题库及答案

Linux操作系统考试题库及答案一、单项选择题1. Linux操作系统的创始人是()。
A. Bill GatesB. Linus TorvaldsC. Steve JobsD. Richard Stallman答案:B2. 在Linux系统中,查看当前路径的命令是()。
A. pwdB. lsC. cdD. mkdir答案:A3. 在Linux系统中,以下哪个命令用于查看文件内容?()A. catB. grepC. findD. touch答案:A4. 在Linux系统中,以下哪个命令用于创建目录?()A. touchB. mkdirC. rmdirD. rm答案:B5. 在Linux系统中,以下哪个命令用于删除文件?()A. mkdirB. rmdirC. rmD. touch答案:C6. 在Linux系统中,以下哪个命令用于查找文件?()A. grepB. findC. catD. ls答案:B7. 在Linux系统中,以下哪个命令用于查看当前登录用户?()A. whoB. userC. usersD. whoami答案:A8. 在Linux系统中,以下哪个命令用于查看系统运行时间和平均负载?()A. uptimeB. topC. psD. free答案:A9. 在Linux系统中,以下哪个命令用于查看磁盘空间使用情况?()A. dfB. duC. lsD. pwd答案:A10. 在Linux系统中,以下哪个命令用于查看网络配置?()A. ifconfigB. netstatC. routeD. all of the above答案:D二、多项选择题1. 在Linux系统中,以下哪些命令用于文本编辑?()A. viB. nanoC. emacsD. gedit答案:ABC2. 在Linux系统中,以下哪些命令用于文件权限管理?()A. chmodB. chownC. chgrpD. ls答案:ABC3. 在Linux系统中,以下哪些命令用于进程管理?()A. psB. topC. killD. free答案:ABC4. 在Linux系统中,以下哪些命令用于网络管理?()A. ifconfigB. netstatC. pingD. route答案:ABCD5. 在Linux系统中,以下哪些命令用于磁盘管理?()A. dfB. duC. fdiskD. mount答案:ABCD三、判断题1. Linux是一个开源的操作系统。
OS期末考试题及答案

OS期末考试题及答案一、选择题(每题2分,共20分)1. 在操作系统中,进程和程序的主要区别在于()。
A. 进程是动态的,程序是静态的B. 进程是静态的,程序是动态的C. 进程和程序没有区别D. 进程和程序是同一回事答案:A2. 操作系统的主要功能不包括()。
A. 进程管理B. 存储管理C. 文件管理D. 数据加密答案:D3. 在分页存储管理中,页表的作用是()。
A. 存储文件B. 存储设备驱动程序C. 存储进程信息D. 实现逻辑地址到物理地址的转换答案:D4. 死锁产生的四个必要条件中不包括()。
A. 互斥条件B. 占有和等待条件C. 不可剥夺条件D. 资源不足条件答案:D5. 操作系统中,文件的逻辑结构不包括()。
A. 顺序结构B. 索引结构C. 链式结构D. 物理结构答案:D6. 操作系统中,进程调度算法中,()算法可以保证长作业不会饿死。
A. 先来先服务B. 短作业优先C. 轮转D. 优先级答案:B7. 在操作系统中,虚拟存储器的主要目的是()。
A. 提高CPU的利用率B. 提高I/O设备的利用率C. 提供更大的逻辑地址空间D. 提高内存的利用率答案:C8. 在操作系统中,设备驱动程序的作用是()。
A. 控制CPUB. 控制内存C. 控制I/O设备D. 控制文件系统答案:C9. 操作系统中,进程同步机制不包括()。
A. 信号量B. 互斥锁C. 消息队列D. 共享内存答案:D10. 在操作系统中,文件系统的主要功能不包括()。
A. 文件存储B. 文件共享C. 文件保护D. 进程调度答案:D二、填空题(每题2分,共20分)1. 操作系统是计算机系统中的___________软件。
答案:系统2. 进程的三种基本状态包括就绪、运行和___________。
答案:阻塞3. 在操作系统中,___________是一种用于进程同步的高级通信机制。
答案:信号量4. 操作系统中的___________机制允许多个进程共享同一段内存。
《操作系统》试题及答案

《操作系统》试题及答案一、选择题(每题2分,共20分)1. 下列哪个操作系统不是分时系统?A. UnixB. LinuxC. Windows 98D. Windows Server答案:C2. 下列关于进程的说法,错误的是:A. 进程是系统进行资源分配和调度的一个独立单位B. 进程和线程是同一个概念C. 进程具有并发性、异步性和独立性D. 进程可以拥有多个线程答案:B3. 在操作系统中,下列哪个调度算法可能导致“饥饿”现象?A. 先来先服务(FCFS)B. 短作业优先(SJF)C. 最高响应比优先(HRRN)D. 时间片轮转(RR)答案:A4. 下列哪种文件系统不支持磁盘碎片整理?A. FAT16B. FAT32C. NTFSD. ReiserFS答案:A5. 下列关于虚拟存储的说法,错误的是:A. 虚拟存储可以扩大物理内存的容量B. 虚拟存储可以提高内存的利用率C. 虚拟存储可以降低程序的执行速度D. 虚拟存储可以实现程序的透明加载答案:C6. 下列哪种磁盘调度算法最适合磁盘I/O请求频繁的业务场景?A. FCFSB. SSTFC.SCAND. C-SCAN答案:B7. 下列关于线程的说法,正确的是:A. 线程是进程的组成部分,一个进程可以有多个线程B. 线程和进程具有相同的生命周期C. 线程之间的通信比进程之间的通信简单D. 线程可以独立执行程序答案:A8. 下列哪种操作系统用于嵌入式系统?A. LinuxB. Windows CEC. UnixD. Mac OS答案:B9. 下列关于中断的说法,错误的是:A. 中断是计算机系统对突发事件的处理机制B. 中断可以由硬件或软件触发C. 中断处理程序可以抢占CPU的执行权D. 中断处理程序可以无限循环执行答案:D10. 在操作系统中,下列哪个功能不属于进程管理?A. 进程创建与撤销B. 进程调度C. 进程同步与互斥D. 文件系统管理答案:D二、填空题(每题2分,共20分)1. 操作系统的主要功能包括进程管理、存储管理、文件管理和________管理。
操作系统全英文期末考试题

一.选择题(20分,每题1分)1. Generally speaking, which one is not the major concern for a operating system in the following four options( D )the computerthe system resourcesand apply the interface between user's program and computer hardware systemprogramming language complier2.The main disadvantage of batch system is ( C )A.CPU utilization is lowB.Can not concurrentck of interactionD.Low degree of automation3.A process transforms from waiting state to ready state is caused by the ( B )A.Interrupt eventB.Process schedulingC.Create a process for a programD.Waiting for some events4.The concurrent process is refers to ( C )A.The process can be run in parallelB.The process can be run in orderC.The process can be run in the same timeD.The process can not be interrupted5.In multi-process system, in order to ensure the integrity of public variables, the processes should be mutually exclusive access to critical areas. The so-called critical area is ( D )A.A bufferB.A date areaC.Synchronization mechanismD.A program6.The orderly use of resources allocation strategy can destroy the condition ( D ) to avoid deadlock.A.Mutual exclusiveB.Hold and waitC.No preemptionD.Circular waiter's applications use the system resources to complete itsoperation by the support and services of ( C )A.clicking the mouseB.Keyboard commandC.System callD.Graphical user interface8.There are four jobs arrived at the same time and the execution time of each job is 2h. Now they run on one processor at single channel,then the average turnaround time is ( B )9. the job scheduling algorithms, ( B ) is related to the job's estimated running time.A.FCFS scheduling algorithmB.Short-job-first scheduling algorithmC.High response ratio algorithmD.Balanced scheduling10.In memory management, the purpose of using the overlay and swapping is ( C )A.Sharing main memoryB.Expanding main memory physicallyC.Saving main memory spaceD.Improving CPU utilization11.In the page-replacement algorithm,which one can cause the Belady phenomenon ( A )A.FIFOB.LRUC.CLOCKINGD.OPT12.The following description of the system in safe state,which one is correct( B )A.It must cause deadlock if the system is in insecure stateB.It may cause deadlock if the system is in insecure stateC.It may cause deadlock if the system is in secure stateD.All are wrong13.Generally, when we talk about"Memory Protection", the basic meaning is ( C )A.Prevent hardware memory from damagingB.Prevent program from losing in memoryC.Prevent the cross-border call between programsD.Prevent the program from being peeped14.The actual capacity of virtual memory is equal to ( B )A.The capacity of external memory(disk)B.The sum of the capacity of external memory and main memoryC.The space that the CPU logical address givesD.The smaller one between the option B and C15.Physical file's organization is determined by ( D )A.ApplicationsB.Main memory capacityC.External memory capacityD.Operating system16.A computer system is configured with two plotters and three printers,in order to properly drive these devices,system should provide ( C ) device driver program.17.When there are fewer number of channels in system ,it may cause "bottlenecks".To solve this problem,which of the follow options is not the effective way( A )A.improving the speed of CPUing the virtual device technologyC.Adding some hardware buffer on the devicesD.Increasing the path between devices and channels18.When I/O devices and main memory are exchanging data, it can be achieved without CPU's frequently intervention,this way of exchanging data is called ( C )A.PollingB.InterruptsC.Direct memory accessD.None of them19.The following description of device management, which one is not correct( B )A.All external devices are managed by the system in uniformB.Channel is a software of controlling input and outputC.The I/O interrupt events from the I/O channel are managed by device managementD.One of the responsibility of the operating system is to use the hardware effectively20.The operating system used ( A ), it realized a mechanism that we can use more space to save more time.A.SPOOLINGB.Virtual storageC.ChannelD.Overlay二.填空题(20分,每空1分)1.Software may trigger an interrupt by executing a special operation called a system call .(P7)2.If there is only one general-purpose CPU,then the system is a single-processor system.(p12)3. A process can be thought of as a program in execution. (p79)4.As a process executes,it changes process may be in one of the following states:new,running,waiting,ready or terminated .(p83)5.Long-term(job) scheduling is the selection of processes that will beallowed to contend for the Short-term(CPU) scheduling is the selection of one process from the ready queue. (p116)6.The process executing in the operating system may be either independent processes or cooperating processes. Cooperating processes require an interprocess communication mechanism to communicate with each ,communication is achieved through two schemes: share memory and message passing. (p116)modern operating systems, resource allocation unit is process, processor scheduling unit is thread .(p127)modern operating systems provide kernel support for threads;among these are Windows,as well as Solaris and Linux .(p146)scheduling is the basis of multiprogrammed operating systems.(p153)FCFS algorithm is nonpreemptive;the RR algorithm is preemptive. ,a waiting process is never again able to change state,because the resources it has requested are held by other waiting situation is called deadlock . (p245)main purpose of a computer system is to execute programs,together with the data they access,must be in main memory(at least partially) during execution.(P274)13. The various memory-management algorithms differ in may comparing different memory-management strategies,we use the follow considerations:Hardwaresupport,Performance,Fragmentation,Relocation,Swapping,Sharing and protection . (p310)14.A process is thrashing if it is spending more time paging than executing.15.Virtual memory is a technique that enables us to map a largelogical address space onto a smaller physical memory.(p365)16.When we solve the major problems of page replacement and frame allocation,the proper design of a paging system requires that we consider page size,I/O,locking,process creation,program structure,and other issues.(p366)17.The operating system abstracts from the physical properties of its storage devices to define a logical storage unit,the file . (p373)18.Since files are the main information-storage mechanism in most computer system,file protection is needed.(p408)19.The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector.(P457)20.The hardware mechanism that enables a device to notify the CPU is called an interrupt .(p499)三.简答题(30分,每题6分)1.What is the operating systemWhat role does the operating system play in a computer开放题,解释操作系统概念,操作系统可以实现哪些基本功能关键词:a.管理系统资源,控制程序运行,改善人机界面,为其他应用软件提供支持。
操作系统答案(全)

[英文原版]操作系统_精髓与设计原理_第6版答案翻译Keys of Operating Systems Internals and Design Principles6th Edition第一章计算机系统概述复习题: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操作的三种技术。
(完整word版)操作系统英文版课后习题答案整理(word文档良心出品)

1.1What are the three main purposes of an operat ing system?⑴ In terface betwee n the hardware and user;(2) man age the resource of hardware and software;(3) abstracti on of resource;Answer;•Tb provide an environment ksr a computer user to execute programs on computer h日rchvare in n convenient and efficient manner.•Tb allocate the separate resources of the computer as needed to st)ke the problem given.The allcxation prtxzess should b? as fair and efficient as possible.•Asa control program it serves two major functions; (1) supervision of the execution 由user programs to prevent errors and improper use of the computer, and (2) management of the operatioji and control of I/O devices.1.2 List the four steps that are necessary to run a program on a completely dedicated machine. Preprocessing > Process ing > Linking > Executi ng.Answer:乩Reserxe machine time*b* Manually load program into memory.u Load starting address and begin exe匚Lition.cL Monitor and control execution of program fr(im console.b. In teractivec. Time shar ingd. Real timee. Networkf. DistributedAnswera” Batch, Jobs w计h similar reeds are batched together and run through the computer as a group by ^r\operator or automatic jc)b s^quenc^r. [^rformanct? i$ incr^a^ed by atteiTipting to keep CPU 3nd I/O devices busv 311 timesi through buffering, off-line operation^ spooling, and multiprogramming. Batch is good for executing 】arge jobs thjit need little interacticm; it can be submitted and piuked up later.b. Interactive. This system is cumpofied of m^nv short transactions where the results of thenext transactiiin may be unpredictablen Respond time needs tn be short (sectwids) since the user submits and waik for the result.u Time sharing. This systems u 船呂匚Pl sch<*duling ^nd multi programming to pmvidu eConoiniCcil interactive use of 蛊system. The CPL switches rapidly iri>m one user tn another Instead of having a job defined by spcxiled card images^ each program readsits next control card from the terminab and output is normally printed immediately to the screen.(_L Real time. Often tisvci in a dedicated application, this system reads information from sensors and must respond within a fixed amount of time to ensure correct performance.work.f.Distributed .This system distributes computation among several physical processors” TheprtKessors do not share menion- or a clock. Instead, each pnxzessor has its own kxzalmemory. They communicate with each other through various communication lines f such asa high-speed bus or telephone line.1.7 Wehave stressed the need for an operating system to make efficient use of the computing hardware. When is it appropriate for the operating system to forsake this principle and to waste ” resources? Why is such a system not really wasteful?Answer Single-user systems should maximize use of the system for the user A GUImight "xvastc * GPL' cycles, but it optimizes the user T s interaction with the system.2.2 How does the distinction between monitor mode and user mode function as a rudimentary form of protecti on (security) system?Answer: By establishing a set of privileged instructions that can be executed only when in tlie m(snitnr mt)de f the tiperating system is assured of controlling the entire system at all times.2.3 What are the differences between a trap and an interrupt? What is the use of eachfun cti on?Answer An interrupt is a ha rd \ v a re-^en era ted change-of-flow within the system. An interrupt handler is summoried to deal with the cause oF the interrupt; control is then re turned to the interrupted context and instruction. A trap is a software-j;enerated interrupt. An interrupt can be uwd to signal the compJrtio n “f an I/O obviate the nevd for polling. A trap can be used ti> call operating svstem routines or to catch arithmetic errors.2.5 Which of the follow ing in structi ons should be privileged?a. Set value of timer.b. Read the clock.c. Clear memory.d. Turn off interrupts.e. Switch from user to monitor mode.3OS Exercise BookClass No. NameAnswer: The following instructions should be privileged:Set value of timer,b.Clear memory.Jc.Turn off interrupts.d.Switch from user to monitor mode*2.8 Protecting the operating system is crucial to ensuring that the computer system operates correctly. Provision of this protection is the reason behind dual-mode operation, memory protection, and the timer. To allow maximum flexibility, however, we would also like to place mini mal con stra ints on the user.The following is a list of operations that are normally protected. What is the minimal setof in structi ons that must be protected?a. Change to user mode.b. Change to mon itor mode.c. Read from mon itor memory.d. Write into mon itor memory.e. Fetch an instruction from monitor memory.f. Tur n on timer in terrupt.g. Turn off timer interrupt.Answer: The minimal 5et of instructions that must be protected are:a.Change to monitor mtxle.b.Read from moni tor memory*c.Write into monitor me mor v.Jd.Turn off timer interrupt3.6 List five services provided by an operat ing system. Explain how each provides convenience to the users. Explain also in which cases it would be impossible for user-level programs to provide these services.Answer;«Program execution. The operating system loads thv contents (or sections) of a file into menidry and begins its execution. A user-level program could not be trusted to properly allocate CPU time.•I/O operations. Disks, tapes, serial lines;and other devices must be communicated with ata very low level. The user need only specify the dev ice and the operation to perform (in it,while the system converts that request into <ie\r ict^ or contr<i11er-spec i fit commands.User-level pnjgrams cannot be trusted to only access devices they should have access to and to only access them when they otherwise unused.«File-system manipulation, fhere are manv details in file creation, deletion/ alkKation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked, deleting a file requires remo\ ing the name file information and freeing the <ilkx:ated blocky I^ratections must also be checked to assure proper file access. User prc^grams could neither ensure adherence to protect]on methcxis nor be trusted to allocate only free block吕and deallocate bkxzks on file deletion.J•Communications. Message passing between systems requires messages be turned into packets of information, sent to the network controller, trannmitted across a community tk>ns medium, and reassembled by the destination system.卩acket ordering and data correction must take place. Again, user program吕might not c(sordinate ac cess to the network dev ice, or they might receive packets destined tor other processes^»Error detection. Error detection (occurs at both the hardware and soFtwart? levels. At tlie hardware level, all data transfers must be inspected to ensure that data hax e not beencorrupted in transit All data on media must be checked to be sure they have not changed since they uritten to the media. At the software level, media must bechecked for data ccnsistencj^; for instance, do the number of allocated and unallocated blocks of storage match the total number on the device. There, errors are frequently pnxzess-independent (for instance, the 匚omiption of data on a disk)5 sc there must be a global program (the operating system) that handles all h pes of errors. Also, by having errors pmc essed by the operating system, processes need not contain code to catch and ccjrrect all the ernjrs possible on a system.3.7 What is the purpose of system calls?Answer; Sv>ttn'. dlltnv ustr-levtl lu request str\ ices nt 11 it? uperating svs-tem.3.10 What is the purpose of system programs?J V USWCE Svstcm programs can be thought of as bundle!ti of useful system oils. Thev r provide bcisic functidcaliU users and sci users do not need to wnte their cwn programs to s<>k r e comnicMi problems,4.1 MS-DOS provided no means of con curre nt process ing. Discuss three major complicati onsthat con curre nt process ing adds to an operat ing system.5OS Exercise BookClass No. NameAnswer:*A method of time sharing must be implemented to allow each of several prcxzesses to have access to the system. This method involves the preemption of processes that do notvoluntarily give up the CPU (by using a system ca1]r for instance) and the kernel being reentrant (so more than one prtxzess may be executing kernel code concurrently).・[Vocesses and system resources must have protections and must be protected from each other. Any given process must be limited in the amount of memory it can use and tlie ope Mt ions 让can perform on devices like di^ks.•Care must be taken in the kernel to prevent deadkxzks between prucesses, so processesaren*t waiting for each other's allocated rest>urces,4.6 The correct producer —consumer algorithm in Section 4.4 allows only n-1 buffers to befull at any one time. Modify the algorithm to allow all buffers to be utilized fully.Answer: No answer.5.1 Provide two program ming examples of multithread ing givi ng improve performa nee overa sin gle-threaded soluti on.Answer (1) A Web server that services each request in a separate Lliread. (2) A parallelized application such as matrix multiplication where different parts of the matrix may be worked on in parallel. (3) An intEivictin GUI program such as a debugger where a thread is used to monitor user input, another thread represents the running application, and a third thread monitors performance.5.3 What are two differences between user-level threads and kernel-level threads? Underwhat circumsta nces is one type better tha n the other?Answer: Context switching between user threads is quite sinniliir to switching between kernel threads, although it is dependent on the threads library and how it maps user threads to kernel threads. In general, context switching between user threads involves taking a user thread of its LWP and replacing it with another thread. This act typically involves saving and restoring the stttte of the registers.6.3 Consider the following set of processes, with the length of the CPU-burst time given inmillisec on ds:Process Burst Time PriorityP1103P211P323F414P552The processes are assumed to have arrived in the order P l, F2, F3, F4, P5, all at time 0.a.Draw four Gantt charts illustrati ng the executi on of these processes using FCFS, SJF, a non preemptive priority (a smaller priority n umber implies a higher priority), and RR (qua ntum = 1) scheduli ng.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)?An swer:Answer;a.The four Gantt charts areb.Turnaround timeFCFS RR SJF Priority101919 16112 1 113 741814421919149 6 匚Waiting time (turnaround time minus burst time)FCFS RR SJF Priority卩】0996Pz10100心115216P*133118Ps14941d. Shortest Job First6.4 Suppose that the following processes arrive for execution at the times indicated. Eachprocess will run the listed amou nt of time. In an sweri ng the questi ons, use non preemptive scheduling and base all decisions on the information you have at the time the decisionmust be made.PtXKCSS Ai ri\ al Time Burst Time0.087OS Exercise BookClass No. NameP20.44l.D1a. 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 performa nee, but no tice that we chose to run process P1 at time0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is leftidle for the first 1 un it and the n SJF scheduli ng is used. Remember that processes P1 and P2 are wait ing dur ing this idle time, so their wait ing time may in crease. Thisalgorithm could be known as future-k no wledge scheduli ng.Answera.10.53b.9.53c.6,86Remember that turnaround time LS finishing time minus arrival time, so have to subtract the arrival tinier to compute thu turnaround times. FCFS is 11 if you forget to subtract arrival time.6.10 Explain the differences in the degree to which the following scheduling algorithms discrim in ate in favor of short processes:a.FCFSb.RRc.Multilevel feedback queuesAnswer:a.FCFS—discriminates against short jobs since any short jobs arriving after long jobs willhave a longer waiting time.b.RR一treats all jobs equally (giving them equal bursts of CPU time) so short jobs will beable to leave the system faster since they will finish first.c.Multilevel feedback queues—work similar to the RR algorithm—thev discriminatefa^r i>rably toward slusrt jobs.7.7 Show that, if the wait and sig nal operati ons are not executed atomically,then mutual exclusi on may be violated.Answer No answer.7.8 The Sleepi ng-Barber Problem. A barbershop con sists of a wait ing room with n chairs and the barber room containing the barber chair. If there are no customers to be served,the barber goes to sleep. If a customer en ters the barbershop and all chairs are occupied,then the customer leaves the shop .If the barber is busy but chairs are available, the nthe customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a program to coord in ate the barber and the customers.Answer: Please refer to the support ing Web s its for source code solution,8.2 Is it possible to have a deadlock involving only one single process? Explain your answer.Answer Ncx I'his folknvs directly from the hold-and-wait condition.8.4 Con sider the traffic deadlock depicted in Figure 8.11.a. Show that the four n ecessary con diti ons for deadlock in deed hold in this example.b. State a simple rule that will avoid deadlocks in this system.Answer No answer.8.13 Con sider the follow ing sn apshot of a system:Allocati on Max AvailableA B C D A B C D A B C DP00 0 1 20 0 1 2 1 5 2 0P1 1 0 0 0 1 7 5 0P2 1 3 5 4 2 3 5 6P30 6 3 20 6 5 2P40 0 1 40 6 5 6An swer the follow ing questi ons using th e ban ker s algorithm:a.What is the content of the matrix Need?b.Is the system in a safe state?c.If a request from process P1 arrives for (0,4,2,0), can the request be gran tedimmediately?Answer;A. Deadlcx^k cannot ixrcur because preemption exists,b. Yes. A process may never acquire all the resources 让needs if they are continuouslypreempted by a series of requests such as those of process C.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 efficie nt use of memory?Answer:a. First-fit:b* 212K is put in 500K partitionc. 417K is put in 600K partitiond* 112K is put in 288K partition (new partition 288K = 500K - 212K)e.426K must waitf.Best-fit:g.212K is put in 300K partition9OS Exercise BookClass No. Nameh.417K is put in 500K partitioni.112K is put in 200K partitionj.426K is put in 600K partitionk.Worst-fit:L 212K is put in 600K partitionm. 417K is put in 500K partitionn. 112K is put in 388K partitionc 426K must waitIn this example, Best-fit turns out to be the bE%t*9.8 Con sider a logical address space of eight pages of 1024 words each, mapped onto a physicalmemory of 32 frames.a. How many bits are there in the logical address?b. How many bits are there in the physical address?Answera,l.ogica) address: 13 bitsb.Physical address: 15 bitsJ9.16 Con sider the follow ing segme nt table:Segme nt Base Len gth02196001230014290100313275804195296What are the physical addresses for the follow ing logical addresses?a. 0,430b. 1,10c. 2,500d. 3,400e. 4,112Answer:a.219 + 430 = 649b.2300 + 10 = 2510u ill亡月ed reference, trap ki operating systemd.1327 -b 400 = 1727e.illegal reference, trap to operating system10.2 Assume that you have a page referenee string for a process with m frames (initiallyall empty). The page refere nee stri ng has len gth p with n disti net page n umbers occur init. For any page-replacement algorithms,a. What is a lower bou nd on the n umber of page faults?b. What is an upper bou nd on the n umber of page faults?Answer:a* nb»p1, 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 replaceme ntFIFO replaceme ntOptimal replaceme nt11OS Exercise BookClassNo.NameNumbei of frames1 2 3 4 5 6 711.7 Expla in the purpose of the ope n and close operati ons.Answer :» The o[fen operation informs the system that the named file is about to bect>me active^ * Tlie cluse operation informs the system that the named file )s nt> lunger in active use by the user who issued the dose operation.11.9 Give an example of an application in which data in a file should be accessed in the followi ng order: a. Seque ntially b. Ran domlyAnswer :a. Print the 匚 on tent of the file,b. Print the content of record /. This record can be found using hashing or index tech niques.11.12 Con sider a system that supports 5000 users. Suppose that you want to allow 4990 of these users to be able to access one file.a. How would you specify this protection scheme in UNIX?b. Could you suggest ano ther protecti on scheme that can be used more effectively for this purpose tha n the scheme provided by UNIX?Answer:a. There are twc methods for achieving this : L Create an access control list withtlu? names of all 4990 users.ii. Put these 4990 users in one ^roup and set the group access accordingly. This scheme cannot always be implemented since user groups are restricted by the system. b. The universe access information applies to all users unless their name appears in the access-control list with different access permission. With this scheme you simply put the names of the remaining ten users in the access control list but \v 让h no access pri\ ileges allovcexfLRUFIFOOptimal 20 20 20 18 18 15 15 16 11 10 14 8 8 10 7 7 10 7 7 77Answer12.1 Consider a file currently consisting of 100 blocks. Assume that the file control block (andthe index block, in the case of indexed allocation) is already in memory. Calculate howmany disk I/O operations are required for contiguous, linked, and indexed (single-level)allocati on strategies, if, for one block, the follow ing con diti ons hold. In thecon tiguousallocati on case, assume that there is no room to grow in the beg inning, but there is room to grow in the end. Assume that the block in formatio n to be added is stored in memory.a. The block is added at the beg inning.b. The block is added in the middle.c. The block is added at the end.d. The block is removed from the begi nning.e. The block is removed from the middle.f. The block is removed from the end.AnswerLinked Indexeda. 201 1 1b. 1015211 3 1d. 198 1 0e. 9852 0f. 0 100 013.2 Con sider the follow ing I/O sce narios on a sin gle-user PC.a. A mouse used with a graphical user in terfaceb. A tape drive on a multitasking operating system (assume no device preallocation is available)c. A disk drive containing user filesd. A graphics card with direct bus conn ecti on, accessible through memory-mappedI/OFor each of these I/O scenarios, would you design the operating system to use buffering, spooli ng, cachi ng, or a comb in ati on? Would you use polled I/O, or in terrupt-drive n I/O? Give reas ons for your choices.Answer:a. A mouse used with a graphical user interfaceBuffering may be needed to record mouse movement during times when higher- priority operations are taking place. Spooling and caching are inappropriate. Inter rupt driven I/O is most appropriate^b” A tape drive on a multitasking operating system (assume no device preAlkxzation is available)Buffering may be needed to manage throughput d让ferEria? behveen the tape drive and the sounzt? or destination of the I/O, C臼匚hing can be used to hold copies of that resides on the tape, for faster access. Spooling could be used to stage data to the device whenmultiple users desire to read from or write to it” Interrupt driven [/O is likely to allow the best performance.13OS Exercise BookClass No. Name匸* A disk drive containing user tilesBuffering can be used to hold data while in transit from user space to the disk, and visaversa. Caching can be used to hold disk-resident data for improved perfor mance.Spoc^ling is not necessary because disks are shared-access devices. Interrupt- driven T/O is best for devices such as disks that transfer data at slow rates,d. A graphics card w让h direct bus coi^nection, accessible through mem<irv-mapped I/OBuffering may be needed to control multiple access and for performance (doublebuffering can be used to hold the next screen image while displaying the current tme). Caching and spooling are not necessary r due to the fast and shared-access natures of the device. Polling and interrupts are only useful for input and for【/O completion detec tion f neither of which is needed for a mem()r y-ma pped device.14.2 Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130Start ing from the curre nt head positi on, what is the total dista nee (in cyli nders) thatthe disk arm moves to satisfy all the pending requests, for each of the follow ingdiskscheduli ngalgorithms?a. FCFSb. SSTFc. SCANd. LOOKe. C-SCANAnswer:乩The FCFS schedule is 143f 86f 1470, 913, 1774, 948, 1509, 1022, 1754), 130. The total seek distance is 7081.b. The SSTF schedule is 143, 130, 86. 913, 948, 1022, 1470, 1509. 1750r 1774. The total seekdistance is 1745.€. The SCAN schedule is 143, 913, 94«f1022f 1470, 1509,1750f 1774, 4999,130, 86. The to怙1 seek distance is 9769.d.The LOOK schedule is 143, 913, 948,1022, 1470,1509,1750,177< 130,86. The total seekdistance is 3319*e.The C-SCAN schedule is 143f 913,948,1022J 470,1509.1750,1774,4999,8& 130. The totalseek distance is 9813.f.(Bonus.) The C-LOOK schedule is 143,913,94& 1022,1470,1509.1750,1774, 86,130. Thetotal seek distance is 3363.1.1 1.62.3 2.53.7 6.3 6。
英文版计算机试题及答案

英文版计算机试题及答案一、选择题(每题2分,共20分)1. Which of the following is not a function of an operating system?A. Process managementB. Memory managementC. Data storageD. File management2. In a computer network, what does the term "bandwidth" refer to?A. The width of the network cableB. The maximum rate of data transferC. The number of users connectedD. The speed of the network processor3. What is the primary purpose of a firewall?A. To prevent unauthorized access to a networkB. To encrypt dataC. To manage network trafficD. To store user passwords4. Which of the following is a type of software used for creating and editing documents?A. Spreadsheet softwareB. Database softwareC. Word processing softwareD. Graphics software5. What is the term used to describe the process of converting data from one format to another?A. Data migrationB. Data transformationC. Data conversionD. Data translation6. What does the acronym "CPU" stand for in computing?A. Central Processing UnitB. Central Processing UnitC. Computer Processing UnitD. Computing Processing Unit7. What is the function of a router in a network?A. To connect multiple networksB. To store dataC. To provide power to devicesD. To print documents8. What is the process of finding and fixing errors in software called?A. DebuggingB. PatchingC. UpdatingD. Patching9. Which of the following is a type of computer virus that replicates itself by attaching to other programs?A. TrojanB. WormC. RansomwareD. Spyware10. What is the term for the graphical representation of data on a computer screen?A. Data visualizationB. Data representationC. Data graphingD. Data mapping二、填空题(每题2分,共20分)1. The _________ is the primary memory used by a computer to store data and instructions that are currently being processed.2. A _________ is a type of software that allows users to create and edit images.3. The process of converting analog signals to digital signals is known as _________.4. A _________ is a collection of data stored in a structured format.5. The _________ is a hardware component that connects a computer to a network.6. In computer programming, a _________ is a sequence of statements that perform a specific task.7. The _________ is a type of malware that hides its presence and waits for a trigger to activate.8. A _________ is a type of software that is designed to protect a computer from unauthorized access.9. The _________ is the process of organizing and managing data in a database.10. A _________ is a type of software that allows users tocreate and edit spreadsheets.三、简答题(每题10分,共30分)1. Describe the role of a server in a computer network.2. Explain the difference between a compiler and an interpreter in programming.3. Discuss the importance of data backup and recovery in a computing environment.四、编程题(每题15分,共30分)1. Write a simple program in Python that calculates the factorial of a given number.2. Create a function in Java that takes an array of integers and returns the largest number in the array.答案:一、选择题1. C2. B3. A4. C5. C6. A7. A8. A9. B10. A二、填空题1. RAM (Random Access Memory)2. Graphics software3. Analog-to-digital conversion4. Database5. Network interface card (NIC)6. Function or procedure7. Trojan8. Antivirus software9. Database management10. Spreadsheet software三、简答题1. A server in a computer network is a powerful computer or system that manages network resources, including hardware and software, and provides services to other computers on the network, such as file storage, web hosting, and print services.2. A compiler is a program that translates source codewritten in a programming language into machine code that a computer can execute. An interpreter, on the other hand, reads and executes the source code line by line without the need for a separate compilation step.3. Data backup and recovery are crucial in a computing environment to prevent data loss due to hardware failure, software bugs, or malicious attacks. Regular backups ensure that data can be restored to a previous state in case of corruption or deletion.四、编程题1. Python Program for Factorial Calculation:```pythondef factorial(n):if n == 0:return 1 else:。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一.选择题(20分,每题1分)1. Generally speaking, which one is not the major concern for a operating system in the following four options?( D )A.Manage the computerB.Manage the system resourcesC.Design and apply the interface between user's program and computer hardware systemD.High-level programming language complier2.The main disadvantage of batch system is ( C )A.CPU utilization is lowB.Can not concurrentck of interactionD.Low degree of automation3.A process transforms from waiting state to ready state is caused by the ( B )A.Interrupt eventB.Process schedulingC.Create a process for a programD.Waiting for some events4.The concurrent process is refers to ( C )A.The process can be run in parallelB.The process can be run in orderC.The process can be run in the same timeD.The process can not be interrupted5.In multi-process system, in order to ensure the integrity of public variables, the processes should be mutually exclusive access to critical areas. The so-called critical area is ( D )A.A bufferB.A date areaC.Synchronization mechanismD.A program6.The orderly use of resources allocation strategy can destroy the condition ( D ) to avoid deadlock.A.Mutual exclusiveB.Hold and waitC.No preemptionD.Circular waiter's applications use the system resources to complete its operation by the support and services of ( C )A.clicking the mouseB.Keyboard commandC.System callD.Graphical user interface8.There are four jobs arrived at the same time and the execution time of each job is 2h. Now they run on one processor at single channel,then the average turnaround time is ( B )A.1hB.5hC.2.5hD.8h9.Among the job scheduling algorithms, ( B ) is related to the job's estimated running time.A.FCFS scheduling algorithmB.Short-job-first scheduling algorithmC.High response ratio algorithmD.Balanced scheduling10.In memory management, the purpose of using the overlay and swapping is ( C )A.Sharing main memoryB.Expanding main memory physicallyC.Saving main memory spaceD.Improving CPU utilization11.In the page-replacement algorithm,which one can cause the Belady phenomenon? ( A )A.FIFOB.LRUC.CLOCKINGD.OPT12.The following description of the system in safe state,which one is correct?( B )A.It must cause deadlock if the system is in insecure stateB.It may cause deadlock if the system is in insecure stateC.It may cause deadlock if the system is in secure stateD.All are wrong13.Generally, when we talk about"Memory Protection", the basic meaning is ( C )A.Prevent hardware memory from damagingB.Prevent program from losing in memoryC.Prevent the cross-border call between programsD.Prevent the program from being peeped14.The actual capacity of virtual memory is equal to ( B )A.The capacity of external memory(disk)B.The sum of the capacity of external memory and main memoryC.The space that the CPU logical address givesD.The smaller one between the option B and C15.Physical file's organization is determined by ( D )A.ApplicationsB.Main memory capacityC.External memory capacityD.Operating system16.A computer system is configured with two plotters and three printers,in order to properly drive these devices,system should provide ( C ) device driver program.A.5B.3C.2D.117.When there are fewer number of channels in system ,it may cause "bottlenecks".To solve this problem,which of the follow options is not the effective way?( A )A.improving the speed of CPUing the virtual device technologyC.Adding some hardware buffer on the devicesD.Increasing the path between devices and channels18.When I/O devices and main memory are exchanging data, it can be achieved without CPU's frequently intervention,this way of exchanging data is called ( C )A.PollingB.InterruptsC.Direct memory accessD.None of them19.The following description of device management, which one is not correct?( B )A.All external devices are managed by the system in uniformB.Channel is a software of controlling input and outputC.The I/O interrupt events from the I/O channel are managed by device managementD.One of the responsibility of the operating system is to use the hardware effectively20.The operating system used ( A ), it realized a mechanism that we can use more space to save more time.A.SPOOLINGB.Virtual storageC.ChannelD.Overlay二.填空题(20分,每空1分)1.Software may trigger an interrupt by executing a special operation called a system call .(P7)2.If there is only one general-purpose CPU,then the system is a single-processor system.(p12)3. A process can be thought of as a program in execution. (p79)4.As a process executes,it changes state.Each process may be in one of the following states:new,running,waiting,ready or terminated .(p83)5.Long-term(job) scheduling is the selection of processes that will beallowed to contend for the CPU.And Short-term(CPU) scheduling is the selection of one process from the ready queue. (p116)6.The process executing in the operating system may be either independent processes or cooperating processes. Cooperating processes require an interprocess communication mechanism to communicate with each other.Principally,communication is achieved through two schemes: share memory and message passing. (p116)7.In modern operating systems, resource allocation unit is process, processor scheduling unit is thread .(p127)8.Most modern operating systems provide kernel support for threads;among these are Windows,as well as Solaris and Linux .(p146)9.CPU scheduling is the basis of multiprogrammed operating systems.(p153)10.The FCFS algorithm is nonpreemptive;the RR algorithm is preemptive.11.Sometimes,a waiting process is never again able to change state,because theresources it has requested are held by other waiting processes.This situation is called deadlock . (p245)12.The main purpose of a computer system is to execute programs.These programs,together with the data they access,must be in main memory(at least partially) during execution.(P274)13. The various memory-management algorithms differ in may aspects.In comparing different memory-management strategies,we use the follow considerations:Hardware support,Performance,Fragmentation,Relocation, Swapping,Sharing and protection . (p310)14.A process is thrashing if it is spending more time paging than executing.15.Virtual memory is a technique that enables us to map a large logical address space onto a smaller physical memory.(p365)16.When we solve the major problems of page replacement and frame allocation,the proper design of a paging system requires that we consider page size,I/O,locking,process creation,program structure,and other issues.(p366) 17.The operating system abstracts from the physical properties of its storage devices to define a logical storage unit,the file . (p373)18.Since files are the main information-storage mechanism in most computer system,file protection is needed.(p408)19.The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector.(P457)20.The hardware mechanism that enables a device to notify the CPU is called an interrupt .(p499)三.简答题(30分,每题6分)1.What is the operating system?What role does the operating system play in a computer?开放题,解释操作系统概念,操作系统可以实现哪些基本功能?关键词:a.管理系统资源,控制程序运行,改善人机界面,为其他应用软件提供支持。