操作系统习题(英文版)
操作系统设计与实现课后习题答案(英文)

操作系统设计与实现课后习题答案(英⽂)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">。
操作系统全英文期中考试题(带答案)

D.3 8.Generally speaking, we can deal with deadlock problem in three ways. Deadlock prevention is based on( A.allocate enough system resources B.make a reasonable process C.one of the destruction of the four necessary conditions D.prevent the system go into a state of insecurity. 9.In the operating system,wait( ) and signal( ) operation is a kind of ( A.machine instruction B.system calls C.job controls command D.low-level process communication primitives 10.In the job scheduling algorithms,if all jobs come at the same time,which algorithm has the shortest average waiting time? ( A. FCFS scheduling algorithm B. Priority scheduling algorithm C. Round-robin scheduling algorithm D. Shortest-job-first scheduling algorithm 11.Which starvation?( of the d) following scheduling algorithms could result in d) d) c)
操作系统习题(英文版)

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 system programs butare not typically available to application programs.4.T / F – Data registers are general purpose in nature, but may be restricted tospecific tasks such as performing floating-point operations.5.T / F – The Program Status Word contains status information in the form ofcondition codes, which are bits typically set by the programmer as a result of program operation.6.T / F – The processing required for a single instruction on a typical computersystem is called the Execute Cycle.7.T / F – A fetched instruction is normally loaded into the Instruction Register(IR).8.T / F – An interrupt is a mechanism used by system modules to signal theprocessor 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 the processortransfers control to the interrupt handler routine is the program 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 a small,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 must repeatedlyinterrogate 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:er-visible and Control/Status registersb.Control and Status registerser-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 next instruction tobe 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 processing are: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 the processor, thedevice sends this type of signal to the processor:a.Interrupt signalb.Halt signalc.Handler signald.None of the abovermation that must be saved prior to the processor transferring controlto 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 processor efficiencyby: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 inboard memory tooffline 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 memory iscalled: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 following informationfrom 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 and acts asan 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 the hardwareand operating systems did not exist.6.T / F – In a batch-processing system, the phrase “control is passed to a job”means that the processor is now fetching and executing instructions in auser 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 at regularintervals, but due to relatively slow human reaction time this occurrence isusually transparent to the user.9.T / F – A process can be defined as a unit of activity characterized by a singlesequential thread of execution, a current state, and an associated set ofsystem resources.10.T / F – A virtual memory address typically consists of a page number and anoffset within the page.11.T / F – Implementing priority levels is a common strategy for short-termscheduling, which involves assigning each process in the queue to theprocessor according to its level of importance.12.T / F – Complex operating systems today typically consist of a few thousandlines of instructions.13.T / F – A monolithic kernel architecture assigns only a few essential functionsto the kernel, including address spaces, interprocess communication andbasic scheduling.14.T / F – The hardware abstraction layer (HAL) maps between generichardware commands/responses and those unique to a specific platform.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, in that:a.It runs on a special processor, completely separated from the rest ofthe systemb.It frequently relinquishes control of the system processor and mustdepend 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 failsers will only purchase software that has a current copyright datec.New hardware is designed and implemented in the computer systemd.All of the above21.A major problem with early serial processing systems was:a.Setup timeck of input devicesc.Inability to get hardcopy outputd.All of the above22.An example of a hardware feature that is desirable in a batch-processingsystem is:a.Privileged instructionsb. A completely accessible memory arearge 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 is to: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 development createdproblems 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 for dynamicmapping 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, accesscontrol typically refers to:a.Proving that security mechanisms perform according to specificationb.The flow of data within the systemc.Regulating user and process access to various aspects of the systemd.None of the above28. A common problem with full-featured operating systems, due to their sizeand difficulty of the tasks they address, is:a.Chronically late in deliverytent bugs that show up in the fieldc.Sub-par performanced.All of the above29. A technique in which a process, executing an application, is divided intothreads that can run concurrently is called:a.Multithreadingb.Multiprocessingc.Symmetric multiprocessing (SMP)d.None of the above QUESTIONS2.1,2.3,2.4,2.7,2.10PROBLEMS2.1,2.2,2.3,2.4。
《unix操作系统设计》英文版习题答案4

S.15Unix Internals (April/May-2012, Set-4) JNTU-AnantapurB.T ech. III-Year II-Sem.( JNTU-Anantapur)Code No.: 9A05602/R09B.Tech. III Year II Semester Regular ExaminationsApril/May - 2012UNIX INTERNALS( Computer Science and Engineering )Time: 3 HoursMax. Marks: 70Answer any FIVE Questions All Questions carry equal marks- - -1.(a)Draw and explain the block diagram for the system kernel. (Unit-I, Topic No. 1.5.1)(b)Describe in detail about the sleep and wakeup procedures. (Unit-V, Topic No. 5.6)2.(a)With the help of a neat sketch, explain the buffer header. (Unit-II, Topic No. 2.1)(b)Describe an algorithm that asks for and receives any fee buffer from the buffer pool. (Unit-II, Topic No. 2.2)3.Explain the mechanism of assigning an inode to a new file. (Unit-III, Topic No. 3.6)4.(a)Explain the open system call with its syntax, algorithm and data structure. (Unit-IV, Topic No. 4.1)(b)Write and explain the algorithm for creating a file. (Unit-IV, Topic No. 4.4)5.Discuss in detail about the following,(a)Allocating a region(b)Attaching a region to a process (c)Changing the size of a region (d)Freeing a region. (Unit-V, Topic No. 5.5)6.(a)Explain the role of fork in creation of a new process. (Unit-VI, Topic No. 6.1)(b)Distinguish between exit and wit system calls. (Unit-VI, Topic No. 6.3)7.(a)Explain the various system calls for time. (Unit-VII, Topic No. 7.2)(b)Explain how to control the process priorities with suitable examples. (Unit-VII, Topic No. 7.1)8.(a)Draw and explain the architecture for driver entry points. (Unit-VIII, Topic No. 8.1)(b)Present an algorithm for closing a device.(Unit-VIII, Topic No. 8.1)S.16Spectrum ALL-IN-ONE Journal for Engineering Students, 2013B.T ech. III-Year II-Sem.( JNTU-Anantapur)Answer :April/May-12, Set-4, Q1(a)For answer refer Unit-I, Q10.(b)Describe in detail about the sleep and wakeup procedures.Answer :April/May-12, Set-4, Q1(b)For answer refer Unit-V , Q17.Q2.(a)With the help of a neat sketch, explain the buffer header.Answer :April/May-12, Set-4, Q2(a)For answer refer Unit-II, Q1.(b)Describe an algorithm that asks for and receives any free buffer from the buffer pool.Answer :April/May-12, Set-4, Q2(b)Input: File system numberBlock numberOutput : Locked buffer which can now be used for block.Step 1 : Do the following till the buffer is not found.Step 2 : If the block is in hash queue goto step (3) else go to step (9).Step 3 : If the buffer is busy goto step (4) else goto step (6).Step 4 : Goto sleep and wait for the event buffer becomes free.Step 5 : Goto step (1).Step 6 : Mark the buffer busy.Step 7 : Remove buffer from free list.Step 8 : Return the buffer.Step 9 : If there are no buffers on free list then goto step(10) else goto step (12).Step 10 : Goto sleep and wait for event any buffer becomes free.Step 11 : Goto step (1).Step 12 : Remove buffer from free list.Step 13 : If buffer is marked for delayed write then goto step (14) else goto step (16).Step 14 : Perform asynchronous write buffer to disk.Step 15 : Goto step (1).Step 16 : Remove buffer from old hash queue.Step 17 : Put buffer onto new hash queue.Step 18 : Return buffer.Q3.Explain the mechanism of assigning an inode to a new file.Answer :April/May-12, Set-4, Q3For answer refer Unit-III, Q12.Q4.(a)Explain the open system call with its syntax, algorithm and data structure.Answer :April/May-12, Set-4, Q4(a)Open system callFor answer refer Unit-IV , Q1(a), Topic: Open( )S.17Unix Internals (April/May-2012, Set-4) JNTU-AnantapurB.T ech. III-Year II-Sem.( JNTU-Anantapur)AlgorithmInput : file nametype of openfile permissions for creation type of open.Output : file descriptorStep 1 : Convert the filename to inode using algorithm nameiStep 2 : If the file not exist or do not have access permission then goto step (3) else goto step (4)Step 3 : Return errorStep 4 : Allocate file table entry for inode, initialize count, offsetStep 5 : Allocate user file abscriptor entry and set pointer to file table entry.Step 6 : If type of open specifies truncate file then goto step (7) else goto step (8)Step 7 : Free all file blocks using algorithm free Step 8 : Unlock inodeStep 9 : Return user file descriptor.DatastructureConsider the following code,filedes 1 = open(“/etc/passwd”, O_RDONLY);filedes 2 = open(“local”, O_RDWR);filedes 3 =open(“/etc/password”, O_WRONLY);When a process executes the above code then file names “/etc/passwd”, is opened for two times. One time in read-only mode and second time in-write-only mode. In addition to this, a file named “local” is opened in read-write mode.The data structures after open system call is shown in figure below.0User file1234567Descriptor tableCount 1 ReadCount 1 Rd-WrtCount 1 WriteCount 2Count 1Inode tableFile tableFigure : Data Structure After Open System CallThe above figure illustrates the relationship between the inode table, file table and user file descriptor data structures.When a process calls “Open” system call then a file descriptor is returned to it and the entry in the user file descriptor table points to a unique entry in the kernel file table even though the file “/etc/passwd” is opened for two times. The file table entries of all instances of an open file point to one entry in-core inode table. The file “/etc/passwd” can read or write by the process in only through file descriptor 2 and 6.S.18Spectrum ALL-IN-ONE Journal for Engineering Students, 2013(b)Write and explain the algorithm for creating a file.Answer :April/May-12, Set-4, Q4(b) Input : File name and permission settingsOutput : File descriptorStep 1 : Obtain inode for file name using algorithm nameiStep 2 : If file already exists then goto step(3) else goto step (6)Step 3 : If permission is not accessed then goto step(4) else goto step(6)Step 4 : Release inode using algorithm inputStep 5 : Return errorStep 6 : Assign free inode from file system using algorithm illocStep 7 : Create new directory entry in parent directory and in new file name and newly assigned inode number.Step 8 : Allocate file table entry for inode and unitialize countStep 9 : If file exits at the time of creation then goto step(10) else goto step(11)Step 10 : Free all file blocks using algorithm freeStep 11 : Unlock inodeStep 12 : Return user file descriptor.Q5.Discuss in detail about the following,(a)Allocating a region(b)Attaching a region to a process(c)Changing the size of a region(d)Freeing a region.Answer :April/May-12, Set-4, Q5 (a)Allocating a RegionFor answer refer Unit-V, Q13, Topic: Allocating a Region(b)Attaching a Region to a ProcessFor answer refer Unit-V, Q14, Topic: Allocating a Region to a Process, Example and Example for attaching a region to a process.(c)Changing the Size of a RegionFor answer refer Unit-V, Q15.(d)Freeing a RegionFor answer refer Unit-V, Q13, Topic: Freeing a RegionQ6.(a)Explain the role of fork in creation of a new process.Answer :April/May-12, Set-4, Q6(a) For answer refer Unit-VI, Q2.(b)Distinguish between exit and wit system calls.Answer :April/May-12, Set-4, Q6(b) exit( ) system callFor answer refer Unit-VI, Q11.wait( ) system callFor answer refer Unit-VI, Q12.B.T ech. III-Year II-Sem.( JNTU-Anantapur)S.19Unix Internals (April/May-2012, Set-4) JNTU-AnantapurB.T ech. III-Year II-Sem.( JNTU-Anantapur)Q7.(a)Explain the various system calls for time.Answer :April/May-12, Set-4, Q7(a)For answer refer Unit-VII, Q6.(b)Explain how to control the process priorities with suitable examples.Answer :April/May-12, Set-4, Q7(b)For answer refer Unit-VII, Q1.Q8.(a)Draw and explain the architecture for driver entry points.Answer :April/May-12, Set-4, Q8(a)The following figure illustrates the architecture for driver entry points,File SubsystemDriverOpen Close DriverBuffer cacheOpen Close Read Write ioctlOpen Close Read Write ioctlCharacter device switch tableDevice Interrupt handlermountunmountRead WriteOpen CloseBlock device switch tableDevice Interrupt handlercallsStrategyInterrupt vector Interrupt vectorDevice Interrupts Figure : Architecture for Driver Entry PointsFor remaining answer refer Unit-VIII, Q2.(b)Present an algorithm for closing a device.Answer :April/May-12, Set-4, Q8(b)For answer refer Unit-VIII, Q5, Topic: Algorithm to Close Advice.。
操作系统英文版

Introduction to Operating Systems(Spring 2001)Final Exam SolutionsNote: There are 17 questions, one of which is extra credit. Each question is worth 10 points.1. Early Intel processors such as the 8086 did not support dual-mode operation (user and supervisor modes). This had a fairly major impact on the type of system that could be implemented on these processors, and most did not support multi-user operation. Discuss a few potential problems that could arise in trying to support multi-user operation on such a system.There are many problems with multi-user operation on such a system. In effect, everything that we protect in modern operation systems is unprotected. This means that:∙Memory is unprotected. A process could read or overwrite another process memory. A process could also read or overwrite the kernel'smemory.∙Timers are unprotected. A process could change the timers arbitrarily and mess up other processes execution or run as long as it wanted.∙Devices are unprotected. A process could arbitrarily access devices, messing up permanent storage, interfering with other processes' useof the devices, etc.∙Special instructions are unprotected. Any process could halt the machine or cause other problematic operations to execute.∙Etc.2. What are the differences between traps and interrupts? What is the use of each?Traps and interrupts are both methods for calling operating system functions by non-operating system entities. The difference is what entity does thecalling, and how the "call" is done. Traps allow user programs to call OS functions by calling a special trap instruction. Interrupts allow devices to "call" operating system functions by raising a signal on a special hardware bus. They also differ in terms of how the "parameters" are passed, and in terms of what operations are supported by each.3. What is a process? What information does an operating system generally need to keep about running processes in order to execute them?A process is an executing program.An operating system needs to know a number of things about each running program:∙Process name∙Address translation information (e.g., page table)∙Program counter∙Register values∙Process Status∙Recent past behaviour (for scheduling)∙...4. Memory management is important in operating systems. Discuss the main problems that can occur if memory is managed poorly.Many problems can occur if memory is managed poorly:∙Poor performance (i.e., lots of paging)∙Thrashing∙Protection violations (i.e., multiple processes accessing the same page)∙...5. What are the five major activities of an operating system in regard to file management? Why is the file interface used in many modern systems to interact with devices as well as files?1.Create2.Open3.Close4.Read5.Write6.DeleteHmmm, I guess there are really 6. Many people talked about different aspects, and I looked in the book (chapter 3 or 4, I don't have it in front of me right now) and found a discussion that was somewhat different - it talked about file management, storage management, directories, etc. So, any combination of these will get full credit.The file interface is used in many modern systems to interact with devices as well as files because it provides a simple abstraction for device interaction: open a connection to the device, read or write from/to it, close the connection. This interface also provides uniform and simple naming and protection mechanisms.6. User-level threads are threads that are scheduled directly by the process they are part of rather than by the kernel - the kernel schedules the processes, and any process that has threads schedules them however it wants within its time slice. Describe briefly how such a scheme would work. Can you think of any problems with such an implementation? Each process would have to keep track of the threads to be executed. It would have to allocated stack space for each one. It would have to have a program counter and stack pointer for each one. It would also have to manage the registers associated with these values, filling in the appropriate values for the thread it wants to execute. Finally, it will need to have a timer (provided by the OS) to wake up the scheduler thread, and that thread will do context switching among the other threads as appropriate.Possible problems include:Scheduling difficulties: Scheduling is not a trivial thing to program.Having user。
操作系统练习题(全)

答案仅供参考1.How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system? (内核态和用户态作为保护系统有什么区别)答:内核态和用户态的区别有以下方式,某些指令只有当CPU处于内核态时才可以执行。
同样地,某些硬件设备只有当程序在内核态下执行才能够被访问。
只有在CPU处于内核态时,才能够控制中断。
因此,CPU处于用户态时的能力有限,从而强制保护关键的资源。
2. Which of the following instructions should be privileged? (下列哪个指令是受保护的)a. Set value of timer.设置计时器的值b. Read the clock.读时钟c. Clear memory.清除内存d. Issue a trap instruction.解决一个陷阱指令e. Turn off interrupts.关中断f. Modify entries in device-status table.修改设备状态表中的条目g. Switch from user to kernel mode.从用户态转到内核态h. Access I/O device.访问I/O设备答:受保护的:a、c、e、f、h,剩下的可以在用户态执行。
3.Why should an application programmer prefer programming according to an API rather than invoking actual system call? (为什么应用程序设计者更喜欢根据API编程)答:使用API编程的一个好处是程序的可移植性:程序员用API设计的程序可以在任何支持相同API的系统上编译和运行,并且,对于一个应用程序来说,实际系统调用比API更加复杂和困难,总之,API调用和与其相关的内核中的系统调用有着很强的相关性。
操作系统全英文期中考试题(带答案)
XX大学2011——2012学年第一学期《操作系统》期中考试试题(A)一、选择(每题1分,共20分)1.Which function does the operating system can not complete directly of the following four options? ( b )A.Managing computer's hard drivepile the programC.Virtual memoryD.Delete files2.Considering the function of the operating system, ( b ) must give timely response for the external request within the specified time.A.multiuser time sharing systemB.real-time operating systemC.batch operating systemwork operating system3. A process can transform from waiting state to ready state relying on ( d )A.programmer commandB.system serviceC.waiting for the next time sliceD.wake-up of the 'cooperation' process4.As we all know,the process can be thought of as a program in execution.We can deal with the the problem about ( b ) easier after importing the concept of process.A.exclusive resourcesB.shared resourcesC.executing in orderD.easy to execute5.CPU-scheduling decisions may take place under the following circumstances except which one?(D )A.When a process switches from the running state to the waiting stateB.When a process switches from the running state to the ready stateC.When a process switches from the waiting state to the ready stateD.When a process switches from the ready state to the waiting state6.In the four common CPU scheduling algorithm, Which one is the best choice for the time-sharing system in general?( C )A.FCFS scheduling algorithmB.Priority scheduling algorithmC.Round-robin scheduling algorithmD.Shortest-job-first scheduling algorithm7.If the initial value of semaphore S is 2 in a wait( ) and signal( ) operation,its current value is -1,that means there are ( B ) processes are waiting。
操作系统英文样题
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 byexamining: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 toprocess termination, including:a.Normal completionb.Bounds violationc.Parent terminationd.All of the above5.A Memory Table is an O/S control structure that isused 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 mainmemory and therefore available for execution isreferred to as:a.Long-term schedulingb.Medium-term schedulingc.I/O schedulingd.None of the above7.In terms of frequency of execution, the short-termscheduler 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 includesdesignating 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 is also 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 no preemption.8.The task of subdividing memory between the O/S andprocesses is performed automatically by the O/S and is called ___________________.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.[文档可能无法思考全面,请浏览后下载,另外祝您生活愉快,工作顺利,万事如意!]11 / 11。
操作系统全英文期末考试题
一.选择题(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操作的三种技术。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
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 on a 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 system modules 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 must repeatedlyinterrogate 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 anassociated 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 strategy forshort-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。