操作系统第二版第一章课后习题答案
现代操作系统(第二版)习题答案

MODERN OPERATING SYSTEMS SECOND EDITIONPROBLEM SOLUTIONSANDREW S. TANENBAUM Vrije Universiteit Amsterdam, The NetherlandsPRENTICE HALLUPPER SADDLE RIVER, NJ 07458SOLUTIONS TO CHAPTER 1 PROBLEMS1. An operating system must provide the users with an extended (i.e., virtual) machine, and it must manage the I/O devices and other system resources.2. Multiprogramming is the rapid switching of the CPU between multiple processes in memory. It is commonly used to keep the CPU busy while one or more processes are doing I/O.3. Input spooling is the technique of reading in jobs, for example, from cards, onto the disk, so that when the currently executing processes are finished, there will be work waiting for the CPU. Output spooling consists of first copying printable files to disk before printing them, rather than printing directly as the output is generated. Input spooling on a personal computer is not very likely, but output spooling is.4. The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete. If there is no DMA, the CPU is fully occupied doing I/O, so there is nothing to be gained (at least in terms of CPU utilization) by multiprogramming. No matter how much I/O a program does, the CPU will be 100 percent busy. This of course assumes the major delay is the wait while data are copied. A CPU could do other work if the I/O were slow for other reasons (arriving on a serial line, for instance).5. Second generation computers did not have the necessary hardware to protect the operating system from malicious user programs.6. It is still alive. For example, Intel makes Pentium I, II, and III, and 4 CPUs with a variety of different properties including speed and power consumption. All of these machines are architecturally compatible. They differ only in price and performance, which is the essence of the family idea.7. A 25×80 character monochrome text screen requires a 2000-byte buffer. The 1024 ×768 pixel 24-bit color bitmap requires 2,359,296 bytes. In 1980 these two options would have cost $10 and $11,520, respectively. For current prices, check on how much RAM currently costs, probably less than $1/MB.8. Choices (a), (c), and (d) should be restricted to kernel mode.9. Personal computer systems are always interactive, often with only a single user. Mainframe systems nearly always emphasize batch or timesharing with many users. Protection is much more of an issue on mainframe systems, as is efficient use of all resources.10. Every nanosecond one instruction emerges from the pipeline. This meansthe machine is executing 1 billion instructions per second. It does not matter at all how many stages the pipeline has. A 10-stage pipeline with 1 nsec per2 PROBLEM SOLUTIONS FOR CHAPTER 1stage would also execute 1 billion instructions per second. All that matters is how often a finished instructions pops out the end of the pipeline.11. The manuscript contains 80 × 50 × 700 = 2.8 million characters. This is, of course, impossible to fit into the registers of any currently available CPU and is too big for a 1-MB cache, but if such hardware were available, the manuscript could be scanned in 2.8 msec from the registers or 5.8 msec from the cache. There are approximately 2700 1024-byte blocks of data, so scanning from the disk would require about 27 seconds, and from tape 2 minutes 7 seconds. Of course, these times are just to read the data. Processing and rewriting the data would increase the time.12. Logically, it does not matter if the limit register uses a virtual address or a physical address. However, the performance of the former is better. If virtual addresses are used, the addition of the virtual address and the base register can start simultaneously with the comparison and then can run in parallel. If physical addresses are used, the comparison cannot start until the addition is complete, increasing the access time.13. Maybe. If the caller gets control back and immediately overwrites the data, when the write finally occurs, the wrong data will be written. However, if the driver first copies the data to a private buffer before returning, then the caller can be allowed to continue immediately. Another possibility is to allow the caller to continue and give it a signal when the buffer may be reused, but this is tricky and error prone.14. A trap is caused by the program and is synchronous with it. If the program is run again and again, the trap will always occur at exactly the same position in the instruction stream. An interrupt is caused by an external event and its timing is not reproducible.15. Base = 40,000 and limit = 10,000. An answer of limit = 50,000 is incorrect for the way the system was described in this book. It could have been implemented that way, but doing so would have required waiting until the address + base calculation was completed before starting the limit check, thus slowing down the computer.16. The process table is needed to store the state of a process that is currently suspended, either ready or blocked. It is not needed in a single process system because the single process is never suspended.17. Mounting a file system makes any files already in the mount point directory inaccessible, so mount points are normally empty. However, a system administrator might want to copy some of the most important files normally located in the mounted directory to the mount point so they could be found in their normal path in an emergency when the mounted device was being checked or repaired.PROBLEM SOLUTIONS FOR CHAPTER 1 318. Fork can fail if there are no free slots left in the process table (and possibly if there is no memory or swap space left). Exec can fail if the file name given does not exist or is not a valid executable file. Unlink can fail if the file to be unlinked does not exist or the calling process does not have the authority to unlink it. 19. If the call fails, for example because fd is incorrect, it can return −1. It can also fail because the disk is full and it is not possible to write the number of bytes requested. On a correct termination, it always returns nbytes.20. It contains the bytes: 1, 5, 9, 2.21. Block special files consist of numbered blocks, each of which can be read or written 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 files. 22. System calls do not really have names, other than in a documentation sense. When the library procedure read traps to the kernel, it puts the number of the system call in a register or on the stack. This number is used to index into a table. There is really no name used anywhere. On the other hand, the name of the library procedure is very important, since that is what appears in the program.23. Yes it can, especially if the kernel is a message-passing system.24. As far as program logic is concerned it does not matter whether a call to a library procedure results in a system call. But if performance is an issue, if a task can be accomplished without a system call the program will run faster. Every system call involves overhead time in switching from the user context to the kernel context. Furthermore, on a multiuser system the operating system may schedule another process to run when a system call completes, further slowing the progress in real time of a calling process.25. Several UNIX calls have no counterpart in the Win32 API:Link: a Win32 program cannot refer to a file by an alternate name or see it in more than one directory. Also, attempting to create a link is a convenient way to test for and create a lock on a file.Mount and umount: a Windows program cannot make assumptions about standard path names because on systems with multiple disk drives the drive name part of the path may be different.Chmod: Windows programmers have to assume that every user can access every file.Kill: Windows programmers cannot kill a misbehaving program that is not cooperating.4 PROBLEM SOLUTIONS FOR CHAPTER 126. The conversions are straightforward:(a) A micro year is 10−6 × 365× 24× 3600= 31.536 sec. (b) 1000 meters or 1 km.(c) There are 240 bytes, which is 1,099,511,627,776 bytes. (d) It is 6 × 1024 kg. SOLUTIONS TO CHAPTER 2 PROBLEMS1. The transition from blocked to running is conceivable. Suppose that a process is blocked on I/O and the I/O finishes. If the CPU is otherwise idle, the process could go directly from blocked to running. The other missing transition,from ready to blocked, is impossible. A ready process cannot do I/O or anything else that might block it. Only a running process can block.2. You could have a register containing a pointer to the current process table entry. 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.3. Generally, high-level languages do not allow one the kind of access to CPU hardware that is required. For instance, an interrupt handler may be required to enable and disable the interrupt servicing a particular device, or to manipulate data within a process’stack area. Also, interrupt service routines must execute as rapidly as possible.4. There are several reasons for using a separate stack for the kernel. Two of them are as follows. First, you do not want the operating system to crash because a poorly written user program does not allow for enough stack space. Second, if the kernel leaves stack data in a user program’ s memory space upon return from a system call, a malicious user might be able to use this data to find out information about other processes.5. It would be difficult, if not impossible, to keep the file system consistent. Suppose that a client process sends a request to server process 1 to update a file. This process updates the cache entry in its memory. Shortly thereafter, another client process sends a request to server 2 to read that file. Unfortunately, if the file is also cached there, server 2, in its innocence, will return obsolete data. If the first process writes the file through to the disk after caching it, and server 2 checks 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 trying to avoid.PROBLEM SOLUTIONS FOR CHAPTER 2 56. When a thread is stopped, it has values in the registers. They must be saved, just as when the process is stopped the registers must be saved. Timesharing threads is no different than timesharing processes, so each thread needs its own register save area.7. No. If a single-threaded process is blocked on the keyboard, it cannot fork.8. A worker thread will block when it has to read a Web page from the disk. If user-level threads are being used, this action will block the entire process, destroying the value of multithreading. Thus it is essential that kernel threads are used to permit some threads to block without affecting the others.9. Threads in a process cooperate. They are not hostile to one another. If yielding is needed for the good of the application, then a thread will yield. After all, it is usually the same programmer who writes the code for all of them.10. User-level threads cannot be preempted by the clock uless the whole process’ quantum has been used up. Kernel-level threads can be preempted individually. In the latter case, if a thread runs too long, the clock will interrupt the current process and thus the current thread. The kernel is free to pick adifferent thread from the same process to run next if it so desires.11. In the single-threaded case, the cache hits take 15 msec and cache misses take 90 msec. The weighted average is 2/3×15+ 1/3 ×90. Thus the mean request takes 40 msec and the server can do 25 per second. For a multithreaded server, all the waiting for the disk is overlapped, so every request takes 15 msec, and the server can handle 66 2/3 requests per second.12. Yes. If the server is entirely CPU bound, there is no need to have multiple threads. It just adds unnecessary complexity. As an example, consider a telephone directory assistance number (like 555-1212) for an area with 1 million people. If each (name, telephone number) record is, say, 64 characters, th e entire database takes 64 megabytes, and can easily be kept in the server’ s memory to provide fast lookup.13. The pointers are really necessary because the size of the global variable is unknown. It could be anything from a character to an array of floating-point numbers. If the value were stored, one would have to give the size to create3global, which is all right, but what type should the second parameter of set3global be, and what type should the value of read3global be?14. It could happen that the runtime system is precisely at the point of blocking or unblocking a thread, and is busy manipulating the scheduling queues. This would be a very inopportune moment for the clock interrupt handler to begin inspecting those queues to see if it was time to do thread switching, since they might be in an inconsistent state. One solution is to set a flag when the runtime system is entered. The clock handler would see this and set its own flag,6 PROBLEM SOLUTIONS FOR CHAPTER 2then return. When the runtime system finished, it would check the clock flag, see that a clock interrupt occurred, and now run the clock handler.15. Yes it is possible, but inefficient. A thread wanting to do a system call first sets an alarm timer, then does the call. If the call blocks, the timer returns control to the threads package. Of course, most of the time the call will not block, and the timer has to be cleared. Thus each system call that might block has to be executed as three system calls. If timers go off prematurely, all kinds of problems can develop. This is not an attractive way to build a threads package.16. The priority inversion problem occurs when a low-priority process is in its critical region and suddenly a high-priority process becomes ready and is scheduled. If it uses busy waiting, it will run forever. With user-level threads, it cannot happen that a low-priority thread is suddenly preempted to allow a high-priority thread run. There is no preemption. With kernel-level threads this problem can arise.17. Each thread calls procedures on its own, so it must have its own stack for the local variables, return addresses, and so on. This is equally true for user-level threads as for kernel-level threads.18. A race condition is a situation in which two (or more) processes are about to perform some action. Depending on the exact timing, one or the other goesfirst. If one of the processes goes first, everything works, but if another one goes first, a fatal error occurs.19. Yes. The simulated computer could be multiprogrammed. For example, while process A is running, it reads out some shared variable. Then a simulated clock tick happens and process B runs. It also reads out the same variable. Then it adds 1 to the variable. When process A runs, if it also adds one to the variable, we have a race condition.20. Yes, it still works, but it still is busy waiting, of course.21. It certainly works with preemptive scheduling. In fact, it was designed for that case. When scheduling is nonpreemptive, it might fail. Consider the case in which turn is initially 0 but process 1 runs first. It will just loop forever and never release the CPU.22. Yes it can. The memory word is used as a flag, with 0 meaning that no one is using the critical variables and 1 meaning that someone is using them. Put a 1 in the register, and swap the memory word and the register. If the register contains a 0 after the swap, access has been granted. If it contains a 1, access has been denied. When a process is done, it stores a 0 in the flag in memory. PROBLEM SOLUTIONS FOR CHAPTER 2 723. To do a semaphore operation, the operating system first 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 check to 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 completed, interrupts can be enabled again.24. 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 first 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 process 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, first 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.25. If the program operates in phases and neither process may enter the next phase until both are finished with the current phase, it makes perfect sense to use a barrier.26. With round-robin scheduling it works. Sooner or later L will run, and eventually it will leave its critical region. The point is, with priority scheduling, Lnever gets to run at all; with round robin, it gets a normal time slice periodically, so it has the chance to leave its critical region.27. With kernel threads, a thread can block on a semaphore and the kernel can run some other thread in the same process. Consequently, there is no problem using semaphores. With user-level threads, when one thread blocks on a semaphore, the kernel thinks the entire process is blocked and does not run it ever again. Consequently, the process fails.28. It is very expensive to implement. Each time any variable that appears in a predicate on which some process is waiting changes, the runtime 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 ona signal primitive.8 PROBLEM SOLUTIONS FOR CHAPTER 229. The employees communicate by passing messages: orders, food, and bags in this case. In UNIX terms, the four processes are connected by pipes. 30. It does not lead to race conditions (nothing is ever lost), but it is effectively busy waiting.31. If a philosopher blocks, neighbors can later see that he is hungry by checking his state, in test, so he can be awakened when the forks are available.32. The change would mean that after a philosopher stopped eating, neither of his neighbors could be chosen next. In fact, they would never be chosen. Suppose that philosopher 2 finished eating. He would run test for philosophers 1 and 3, and neither would be started, even though both were hungry and both forks were available. Similary, if philosopher 4 finished eating, philosopher 3 would not be started. Nothing would start him.33. Variation 1: readers have priority. No writer may start when a reader is active. When a new reader appears, it may start immediately unless a writer is currently active. When a writer finishes, if readers are waiting, they are all started, 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 finishes, 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 finishes, 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.34. It will need nT sec.35. If a process occurs multiple times in the list, it will get multiple quanta per cycle. This approach could be used to give more important processes a larger share of the CPU. But when the process blocks, all entries had better be removed from the list of runnable processes.36. In simple cases it may be possible to determine whether I/O will be limiting by looking at source code. For instance a program that reads all its input filesinto buffers at the start will probably not be I/O bound, but a problem that reads and writes incrementally to a number of different files (such as a compiler) is likely to be I/O bound. If the operating system provides a facility such as the UNIX ps command that can tell you the amount of CPU time used by a program , you can compare this with total time to complete execution of the program. This is, of course, most meaningful on a system where you are the only user.37. For multiple processes in a pipeline, the common parent could pass to the operating system information about the flow of data. With this information PROBLEM SOLUTIONS FOR CHAPTER 2 9the OS could, for instance, determine which process could supply output to a process blocking on a call for input.38. The CPU efficiency 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 process switch for S. Thus (a) and (b) have an efficiency 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 efficiency here is thenT + ST/Q T 333333333which reduces to Q/(Q + S), which is the answer to (c). For (d), we just substitute Q for S and find that the efficiency is 50 percent. Finally, for (e), as Q → 0 the efficiency goes to 0.39. Shortest job first is the way to minimize average response time. 0 < X≤ 3: X , 3, 5, 6, 9.3 < X≤ 5: 3, X , 5, 6, 9.5 < X≤ 6: 3, 5, X , 6, 9.6 < X≤ 9: 3, 5, 6, X , 9.X >9: 3, 5, 6, 9, X.40. For round robin, during the first 10 minutes each job gets 1/5 of the CPU. At the end of 10 minutes, C finishes. During the next 8 minutes, each job gets 1/4 of the CPU, after which time D finishes. Then each of the three remaining jobs gets 1/3 of the CPU for 6 minutes, until B finishes, and so on. The finishing times for the five jobs are 10, 18, 24, 28, and 30, for an average of 22 minutes. For priority scheduling, B is run first. After 6 minutes it is finished. The other jobs finish at 14, 24, 26, and 30, for an average of 18.8 minutes. If the jobs run in the order A through E, they finish at 10, 16, 18, 22, and 30, for an average of 19.2 minutes. Finally, shortest job first yields finishing times of 2, 6, 12, 20, and 30, for an average of 14 minutes.41. The first time it gets 1 quantum. On succeeding runs it gets 2, 4, 8, and 15, so it must be swapped in 5 times.42. A check could be made to see if the program was expecting input and did anything with it. A program that was not expecting input and did not process it would not get any special priority boost.43. The sequence of predictions is 40, 30, 35, and now 25.44. The fraction of the CPU used is 35/50 + 20/100 + 10/200 + x/250. To beschedulable, this must be less than 1. Thus x must be less than 12.5 msec. 45. Two-level scheduling is needed when memory is too small to hold all the ready processes. Some set of them is put into memory, and a choice is made 10 PROBLEM SOLUTIONS FOR CHAPTER 2from that set. From time to time, the set of in-core processes is adjusted. This algorithm is easy to implement and reasonably efficient, certainly a lot better than say, round robin without regard to whether a process was in memory or not.46. The kernel could schedule processes by any means it wishes, but within each process it runs threads strictly in priority order. By letting the user process set the priority of its own threads, the user controls the policy but the kernel handles the mechanism.47. A possible shell script might beif [ ! –f numbers ]; then echo 0 > numbers; fi count=0 while (test $count != 200 ) docount=‘expr $count + 1 ‘ n=‘tail –1 numbers‘ expr $n + 1 >>numbers doneRun the script twice simultaneously, by starting it once in the background (using &) and again in the foreground. Then examine the file 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 file before entering the critical area, and unlocking it upon leaving the critical area. This can be done like this:if ln numbers numbers.lock then n=‘tail –1 numbers‘ expr $n + 1 >>numbersrm numbers.lock fiThis version will just skip a turn when the file is inaccessible, variant solutions could put the process to sleep, do busy waiting, or count only loops in which the operation is successful.SOLUTIONS TO CHAPTER 3 PROBLEMS1. In the U.S., consider a presidential election in which three or more candidates are trying for the nomination of some party. After all the primary electionsPROBLEM SOLUTIONS FOR CHAPTER 3 11are finished, when the delegates arrive at the party convention, it could happen that no candidate has a majority and that no delegate is willing to change his or her vote. This is a deadlock. Each candidate has some resources (votes) but needs more to get the job done. In countries with multiple political parties in the parliament, it could happen that each party supports a different version of the annual budget and that it is impossible to assemble a majority to pass the budget. This is also a deadlock.2. If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’ t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big.Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the fil e that won’ t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.3. The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that4. Yes. It does not make any difference whatsoever.5. Yes, illegal graphs exist. We stated that a resource may only be held by a single process. An arc from a resource square to a process circle indicates that the process owns the resource. Thus a square with arcs going from it to two or more processes means that all those processes hold the resource, which violates the rules. Consequently, any graph in which multiple arcs leave a square and end in different circles violates the rules. Arcs from squares to squares or from circles to circles also violate the rules.6. A portion of all such resources could be reserved for use only by processes owned by the administrator, so he or she could always run a shell and programs needed to evaluate a deadlock and make decisions about which processes to kill to make the system usable again.7. Neither change leads to deadlock. There is no circular wait in either case.8. Voluntary relinquishment of a resource is most similar to recovery through preemption. The essential difference is that computer processes are not expected to solve such problems on their own. Preemption is analogous to the operator or the operating system acting as a policeman, overriding the normal rules individual processes obey.12 PROBLEM SOLUTIONS FOR CHAPTER 39. The process is asking for more resources than the system has. There is no conceivable way it can get these resources, so it can never finish, even if no other processes want any resources at all.10. If the system had two or more CPUs, two or more processes could run in parallel, leading to diagonal trajectories.11. Yes. Do the whole thing in three dimensions. The z-axis measures the number of instructions executed by the third process.12. The method can only be used to guide the scheduling if the exact instant at which a resource is going to be claimed is known in advance. In practice, this is rarely the case.13. A request from D is unsafe, but one from C is safe.14. There are states that are neither safe nor deadlocked, but which lead to deadlocked states. As an example, suppose we have four resources: tapes, plotters, scanners, and CD-ROMs, as in the text, and three processes competing for them. We could have the following situation:Has Needs Available。
实用操作系统教程【第2版】课后习题参考答案

习题 1 操作系统概述一、选择题题号 1 2 3 4 5 6 7 8 9 10 答案 B D C D C D A C D D题号11 12 13 14 15 16 17 18 19 20 答案 B C C C B D B B B A二、综合题1、答:并发性和并行性是既相似又有区别的两个概念。
并行性是指两个或多个事件在同一时刻发生;而并发性是指两个或多个事件在同一时间间隔内发生。
、在单处理器系统中只有一条指令流水线,一个多功能的操作部件,某时刻处理机只能执行一个进程,进程与进程之间不能并行执行,只能并发执行。
但在各种I/O控制技术的帮助下,处理机、通道和设备之间都能进行并发。
(1)处理机和设备之间的并行,能够发生。
(2)处理机和通道之间的并行,能够发生。
(3)通道和通道之间的并行,能够发生。
(4)设备和设备之间的并行,能够发生。
2、答:以多道程序技术为基础的现代操作系统具有4个基本特征:(1)并发性:多个程序并发执行,宏观并行,微观串行。
(2)共享性:多个程序共享系统中的所有资源(3)虚拟性:操作系统为每个进程都虚拟出了一整套其所需的软硬件资源,让进程所属的用户感觉到自己独占整个系统。
操作系统通过进程状态转换实现虚拟性。
当进程被切换出去运行态时,它的运行环境被操作系统保存,当把再次被调度程序选中切换到运行态时恢复其运行环境继续上次运行状态继续运行。
(4)异步性:并发执行的各个进程之间运行时间、运行顺序具有不确定性,即异步性,程序执行已经失去的封闭性和可再现性。
操作系统通过同步机制保证多个进程能够正确的执行。
3、答:多道程序设计技术是指同时把多个程序放入内存并允许交替执行和共享系统中的各类资源,当一个程序因某种原因(如I/O请求)而暂停执行时,CPU立即转去执行另一个程序。
操作系统在引入多道程序设计技术后,使得系统内有了多个程序(进程),它们宏观上看同时执行,微观上看仍然是串行。
多道程序设计技术的优点:多道程序交替穿插执行,提高了CPU、内存和I/O设备的利用率;在保持CPU、I/O设备不断工作的同时,导致系统吞吐量的上升。
现代操作系统第二版中文版答案

MODERN OPERATING SYSTEM第一章答案1. 操作系统必须向用户提供一台扩展(即,实际上)的机器,和它必须管理I/O设备和其它系统资源。
2. 多道程序就是CPU在内存中多个进程之间迅速切换。
它一般被用来使CPU保持忙碌,当有一个或多个进程进行I/O时。
3. 输入spooling是作业中的读入技术,例如,从卡片在磁盘,这样当当前执行的进程完成时,将等候CPU。
输出spooling在打印之前首先复制打印文件,而非直接打印。
在个人计算机上的输入spooling很少,但是输出spooling非常普遍。
4. 多道程序的主要原因是当等候I/O完成时CPU有事可做。
如果没有DMA,I/O操作时CPU 被完全占有,因此,多道程序无利可图(至少在CPU利用方面)。
无论程序作多少I/O操作,CPU都是100%的忙碌。
当然,这里假定主要的延迟是数据复制时的等待。
如果I/O很慢的话,CPU可以做其它工作。
5. 第二代计算机没有必要的硬件保护操作系统免受恶意的用户程序的侵害。
6. 它依然存在。
例如,Intel以各种各样的不同的属性包括速度和能力消耗来生产Pentium I, II, III和4。
所有这些机器的体系结构都是兼容的,仅仅是价格上的不同,这些都是家族思想的本质。
7. 25 X 80字符的单色文本屏幕需要2000字节的缓冲器。
1024 X 768象素24位颜色的位图需要2359296字节。
1980年代这两种选择将分别地耗费$10和$11520。
而对于当前的价格,将少于$1/MB。
8. 选择(a),(c),(d)应该被限制在内核模式。
9. 个人的计算机系统总是交互式的,而且经常只有一个用户。
而大型机系统几乎总有许多用户强调批处理或者分时。
除了对所有资源的有效使用,大型机系统上的保护更加重要。
10. 从管道中每纳秒出现一条指令。
意味着该机器每秒执行十亿条指令。
它对于管道有多少个阶段全然不予理睬。
即使是10-阶段管道,每阶段1 nsec,也将执行对每秒十亿条指令。
linux操作系统第二版答案

linux操作系统第二版答案【篇一:linux系统教程课后习题答案】t>1.什么是linux?linux是一套免费使用和自由传播的类unix操作系统,源代码开放,能运行于各类硬件平台,包括intel x86系列和risc处理器。
这个系统是由世界各地成千上万的程序员设计和实现的。
其目的是建立不受任何商品化软件的版权制约的、全世界都能自由使用的unix兼容产品。
2. linux有哪些特性?(1)开放性(2)多用户(3)多任务(4)良好的用户界面(5)设备独立性(6)丰富的网络功能(7)可靠的系统安全(8)良好的可移植性3. linux与windows操作系统的主要区别是什么?(1)从发展的背景看,linux是从一个比较成熟的操作系统发展而来的,而其他操作系统,如windows等,都是自成体系,无对应的相依托的操作系统(2)从使用费用上看,linux是一种开放、免费的操作系统,windows是封闭的系统,需要有偿使用。
(3)linux上丰富的应用软件也是自由的,而在windows下,几乎所有的软件都有独立的版权,需要购买使用,即使某些软件可以免费使用,也一般不提供其源代码,更不用说由用户修改扩充其功能了。
(4)windows对硬件配置要求高,而linux在低端pc系统上仍然可以流畅运行4. linux与unix的共同点与不同点是什么?共同点:由于linux是从unix发展来到,它遵循unix开放标准,基本支持同样的软件、程序设计环境和网络特性,可以说linux是unix的pc版本,linux在pc机上提供了相当于unix工作站的性能。
与商用unix的不同点有:1)linux是免费软件,用户可以从网上下载,而商用的unix除了软件本身的价格外,用户还需支付文档、售后服务费用;2)linux拥有gnu软件支持,linux能够运行gnu计划的大量免费软件,这些软件包括应用程序开发、文字处理、游戏等方面的内容;3)linux的开发是开放的,任何志愿者都可以对开发过程做出贡献;而商用unix则是由专门的软件公司进行开发的。
操作系统第二版课后习题答案

操作系统第二版课后习题答案操作系统第二版课后习题答案操作系统是计算机科学中的重要领域,它负责管理计算机硬件和软件资源,为用户提供良好的使用体验。
在学习操作系统的过程中,课后习题是巩固和深化知识的重要方式。
本文将为大家提供操作系统第二版课后习题的答案,帮助读者更好地理解和掌握操作系统的知识。
第一章:引论1. 操作系统的主要功能包括进程管理、内存管理、文件系统管理和设备管理。
2. 进程是指正在执行的程序的实例。
进程控制块(PCB)是操作系统用来管理进程的数据结构,包含进程的状态、程序计数器、寄存器等信息。
3. 多道程序设计是指在内存中同时存放多个程序,通过时间片轮转等调度算法,使得多个程序交替执行。
4. 异步输入输出是指程序执行期间,可以进行输入输出操作,而不需要等待输入输出完成。
第二章:进程管理1. 进程调度的目标包括提高系统吞吐量、减少响应时间、提高公平性等。
2. 进程调度算法包括先来先服务(FCFS)、最短作业优先(SJF)、优先级调度、时间片轮转等。
3. 饥饿是指某个进程长时间得不到执行的情况,可以通过调整优先级或引入抢占机制来解决。
4. 死锁是指多个进程因为争夺资源而陷入无限等待的状态,可以通过资源预分配、避免环路等方式来避免死锁。
第三章:内存管理1. 内存管理的主要任务包括内存分配、内存保护、地址转换等。
2. 连续内存分配包括固定分区分配、可变分区分配和动态分区分配。
3. 分页和分段是常见的非连续内存分配方式,分页将进程的地址空间划分为固定大小的页,分段将进程的地址空间划分为逻辑段。
4. 页面置换算法包括最佳置换算法、先进先出(FIFO)算法、最近最久未使用(LRU)算法等。
第四章:文件系统管理1. 文件是操作系统中用来存储和组织数据的逻辑单位,可以是文本文件、图像文件、音频文件等。
2. 文件系统的主要功能包括文件的创建、删除、读取、写入等操作。
3. 文件系统的组织方式包括层次目录结构、索引结构、位图结构等。
linux操作系统(第二版)课后习题答案

linux操作系统(第二版)课后习题答案Linux操作系统(第二版)课后习题答案在学习Linux操作系统的过程中,课后习题是非常重要的一部分。
通过做课后习题,我们可以更好地巩固所学的知识,加深对Linux操作系统的理解。
下面我将为大家总结一些常见的课后习题答案,希望对大家的学习有所帮助。
1. 什么是Linux操作系统?它有哪些特点?答:Linux操作系统是一种开源的Unix-like操作系统,具有多用户、多任务和多线程的特点。
它具有稳定性高、安全性好、性能优越等特点。
2. 请简要介绍Linux文件系统的组成结构。
答:Linux文件系统的组成结构包括根目录、用户目录、系统目录、设备文件、普通文件等。
其中根目录是整个文件系统的起点,用户目录是每个用户的个人目录,系统目录包括系统文件和程序文件,设备文件用于访问设备,普通文件包括文本文件、二进制文件等。
3. 请简要介绍Linux系统的启动过程。
答:Linux系统的启动过程包括硬件初始化、引导加载程序启动、内核初始化、用户空间初始化等步骤。
其中硬件初始化是指计算机硬件的自检和初始化,引导加载程序启动是指引导加载程序加载内核,内核初始化是指内核加载并初始化各种设备和服务,用户空间初始化是指启动系统的用户空间进程。
4. 请简要介绍Linux系统的文件权限管理。
答:Linux系统的文件权限管理包括文件所有者、文件所属组、文件权限等。
文件所有者是指文件的所有者,文件所属组是指文件所属的组,文件权限包括读、写、执行权限等。
5. 请简要介绍Linux系统的进程管理。
答:Linux系统的进程管理包括进程的创建、销毁、调度等。
进程的创建是指创建新的进程,进程的销毁是指销毁已有的进程,进程的调度是指对进程进行调度和管理。
通过以上课后习题的答案总结,我们可以更好地了解Linux操作系统的基本知识和常见操作。
希望大家在学习过程中多做课后习题,加深对Linux操作系统的理解,提高自己的操作技能。
操作系统(第二版)课后习题答案

故需要一次间接寻址,就可读出该数据
如果要求读入从文件首到263168Byte处的数据(包括这个数据),读岀过程:首先根据直接寻
址读出前10块;读出一次间接索引指示的索引块1块;将索引下标从0〜247对应的数据块全部 读入。即可。共读盘块数10+1+248=259块
3.某文件系统采用索引文件结构,设文件索引表的每个表目占用3Byte,存放盘块的块号,盘块 的大小为512Byte。此文件系统采用直接、一次间接、二次间接、三次间接索引所能管理的最大
(1)|100-8|+|18-8|+|27-18|+|129-27|+|110-129|+|186-110|+|78-186|+|147-78|+|41-147|+ |10-47|+|64-10|+|12-64|=728
8:00
10:00
120mi n
1
2
8:50
50min
10:00
10:50
120mi n
3
9:00
10mi n
10:50
11:00
120mi n
12
4
9:50
20mi n
11:00
11:20
90mi n
平均周转时间T=,平均带权周转时间W=
②SJF短作业优先法)
作业
到达时间
运行时间
开始时间
完成时间
周转时间
页面长度为4KB,虚地址空间共有土)个页面
3.某计算机系统提供24位虚存空间,主存空间为218Byte,采用请求分页虚拟存储管理,页面尺
寸为1KB。假定应用程序产生虚拟地址(八进制),而此页面分得的块号为100(八进制),说明
计算机操作系统第二版答案

计算机操作系统第二版答案习题一1. 1. 什么是操作系统?它的主要功能是什么?什么是操作系统?它的主要功能是什么?答:操作系统是用来管理计算机系统的软、硬件资源,合理地组织计算机的工作流程,以方便用户使用的程序集合;其主要功能有进程管理、存储器管理、设备管理和文件管理功能。
管理功能。
2. 2. 2. 什么是多道程序设计技术?多道程序设计技什么是多道程序设计技术?多道程序设计技术的主要特点是什么?答:多道程序设计技术是把多个程序同时放入内存,使它们共享系统中的资源;特点:多道,即计算机内存中同时存放多道相互独立的程序;宏观上并行,是指同时进入系统的多道程序都处于运行过程中;微观上串行,是指在单处理机环境下,内存中的多道程序轮流占有CPU CPU,交替执行。
,交替执行。
3. 3. 批处理系统是怎样的一种操作系统?它的特点是什批处理系统是怎样的一种操作系统?它的特点是什么?答:批处理操作系统是一种基本的操作系统类型。
在该系统中,用户的作业被成批的输入到计算机中,然后在操作系统的控制下,用户的作业自动地执行;特点是:资源利用率高、系统吞吐量大、平均周转时间长、无交互能力。
长、无交互能力。
4. 4. 4. 什么是分时系统?什么是实时系统?什么是分时系统?什么是实时系统?试从交互性、及时性、独立性、多路性和可靠性几个方面比较分时系统和实时系统。
较分时系统和实时系统。
答:分时系统:一个计算机和许多终端设备连接,每个 答:分时系统:一个计算机和许多终端设备连接,每个用户可以通过终端向计算机发出指令,请求完成某项工作,在这样的系统中,用户感觉不到其他用户的存在,好像独占计算机一样。
计算机一样。
实时系统:对外部输入的信息,实时系统能够在规定的 实时系统:对外部输入的信息,实时系统能够在规定的时间内处理完毕并作出反应。
比较:交互性:实时系统具时间内处理完毕并作出反应。
有交互性,但人与系统的交互,仅限于访问系统中某些特定的专用服务程序。
《Linux操作系统》第2版完整习题答案-电子工业出版社

《Linux操作系统》第2版完整习题答案-电子工业出版社参考答案第1章1. 思考题(1)C语言。
(2)UNIX系统的特点有以下几点:(1)多任务;(2)多用户;(3)并行处理能力;(4)设备无关性;(5)工具;(6)错误处理;(7)强大的网络功能;(8)开放性。
(3)Linux是一个功能强大的操作系统,同时它是一个自由软件,是免费的、源代码开放的,可以自由使用的类UNIX产品。
其创始人是Linus。
(4)Linux操作系统的诞生、发展和成长过程始终依赖着的重要支柱有以下几点:(1)UNIX操作系统;(2)MINIX操作系统;(3)GNU计划;(4)POSIX标准;(5)Internet 网络。
(5)Linux系统的特点有以下几点:1)自由软件;2)良好的兼容性;3)良好的界面;4)丰富的网络功能;5)支持多种平台。
(6)常见的Linux的发行版本有以下几种:1)Red Hat Linux;2)Caldera OpenLinux;3)SuSE Linux;4)TurboLinux;5)红旗Linux;6)中软Linux。
(7)略。
2. 单项选择(1)-(5):BCCBA第2章1. 思考题(1)Linux系统有哪些运行级别?其含义为何?答:Linux/Unix有7个运行级或运行状态,定义如下(参见/etc/inittab),具体级别与含义如下:0:关闭系统;1:单用户模式;2:多用户使用模式,但没有NFS功能;3:完全多用户模式;4:没有使用,用户可自定义;5:完全多用户模式,且支持X-Windows(默认运行级);6:重新启动。
(2)Linux系统下经常使用的两种桌面环境是什么?答:GNOME他KDE(3)什么是X-Window系统?它有什么特点?答:图形界面(X-Window)就是在Linux操作系统中提供图形化用户界面(GUI),支持的视窗系统,也被称为X。
X-Window的工作方式跟Microsoft Windows有着本质的不同。
操作系统原理与应用(第2版)清大版第1章习题参考答案

第1章习题参考答案1、操作系统(OS)——是管理计算机系统资源(硬件和软件)的系统软件,它为用户使用计算机提供方便、有效和安全可靠的工作环境。
基本功能:处理器(处理机、CPU)管理、存储器管理、设备管理、文件管理、工作管理(系统交互与界面的有效利用)。
2、一个计算机系统是由硬件和软件两大部分组成。
硬件通常指诸如CPU、存储器、外设等这样一类用以完成计算机功能的各种部件。
计算机软件指为计算机编制的程序,加上执行程序时所需要的数据及说明使用该程序的文档资料。
计算机软件包括应用软件和系统软件两大部分。
3、批处理系统的主要特点是:多道、成批、处理过程中不需要人工干预。
分时系统的主要特点是:同时性、交互性、独立性、及时性。
实时系统的主要特点是:及时性、交互性、安全可靠性、多路性。
4、操作系统的不确定性,不是说操作系统本身的功能不确定,也不是说在操作系统控制下运行的用户程序结果不确定,而是说在操作系统控制下多个作业的执行次序和每个作业的执行时间是不确定的。
具体地说,同一批作业,两次或多次运行的执行序列可能是不同的。
如P1、P2、P3,第一次可能是P1、P2、P3;第二次可能是P2、P1、P3。
5、例如,老师在课堂上给学生讲课就是分时系统。
6、关于文件的所有操作就得到操作系统的服务。
7、网络系统软件中的主要部分是网络操作系统,有人也将它称为网络管理系统,它与传统的单机操作系统有所不同,它是建立在单机操作系统之上的一个开放式的软件系统,它面对的是各种不同的计算机系统的互连操作,面对各种不同的单机操作系统之间的资源共享,用户操作协调和与单机操作系统的交互,从而解决多个网络用户(甚至是全球远程的网络用户)之间争用共享资源的分配与管理。
8、良好的用户界面、树形结构的文件系统、字符流式文件、丰富的核外程序、对现有技术的精选和发展。
9、启动输入设备---接受输入数据---保存到内存---到CPU上运行---启动输出设备---在输出设备输出数据。
操作系统(第一章课后习题徐宗元)

操作系统第2版(徐宗元)课后习题答案第1章引论1.6.3选择题1.(1) (5) (6) (7) (10)2. A—(2) B—(1) C—(1) D—(4) E--(3)3. A—(3) B—(4) C—(1) D—(3) E—(4)4. A—(8) B--(9) C—(1) D—(5) E—(2)5. A—(5) B—(2)6. A—(2) B—(3) C—(4) E—(1)7. A—(2) B—(1) C—(3) E—(4)8. A—(2) B—(4) C—(3)9. A—(4) B—(5)10. A—(4) B—(2)11. A—(3) B—(1) C—(1) D—(3) E--(4)12. A—(3) B—(2) C—(4) D—(1) E--(2)13. A—(2)14. A—(1)15. A—(3) B—(4)16. A—(1)17. A—(2) B—(4) C—(3) D—(1)18. A—(3)19. A—(4)问答:1. OS的作用可表现为哪几个方面?a. OS作为用户与计算机硬件系统之间的接口;b. OS作为计算机系统资源的管理者;c. OS作为扩充机器.2.什么是多道程序设计,引入多道程序设计的起因和目的是什么?a.所谓多道程序设计指的是允许多个程序同时进入一个计算机系统的主存储器并启动进行计算的方法。
也就是说,计算机内存中可以同时存放多道(两个以上相互独立的)程序,它们都处于开始和结束之间。
从宏观上看是并行的,多道程序都处于运行中,并且都没有运行结束;从微观上看是串行的,各道程序轮流使用CPU,交替执行。
b.引入多道程序设计技术的根本目的是为了提高CPU的利用率,充分发挥计算机系统部件的并行性,现代计算机系统都采用了多道程序设计技术。
3.试从系统目标、多路性、独立性、交互性、及时性和可靠性等方面比较批处理操作系统分时操作系统及实时操作系统。
通过比较请写出它们三个各适合什么场合?a. 分时系统是一种通用系统,主要用于运行终端用户程序,因而它具有较强的交互能力;而实时系统虽然也有交互能力,但其交互能力不及前者.b. 实时信息系统对实用性的要求与分时系统类似,都是以人所能接收的等待时间来确定;而实时控制系统的及时性则是以控制对象所要求的开始截止时间和完成截止时间来确定的.c. 实时系统对系统的可靠性要求要比分时系统对系统的可靠性要求高4.操作系统的特征1.并发性在多道程序环境下,并发性是指两个或多个事件在同一时间间隔内发生,即宏观上有多道程序同时执行,而微观上,在单处理机系统中每一个时刻仅能执行一道程序。
操作系统第二版罗宇_课后答案

操作系统第二版罗宇_课后答案操作系统部分课后习题答案1.2操作系统以什么方式组织用户使用计算机?请问:操作系统以进程的方式非政府用户采用计算机。
用户所须要顺利完成的各种任务必须由适当的程序去表达出来。
为了同时实现用户的任务,必须使适当功能的程序执行。
而进程就是指程序的运转,操作系统的进程调度程序同意cpu在各进程间的转换。
操作系统为用户提供更多进程建立和完结等的系统调用功能,并使用户能建立崭新进程。
操作系统在初始化后,可以为每个可能将的系统用户建立第一个用户进程,用户的其他进程则可以由母进程通过“进程建立”系统调用展开建立。
1.4早期监督程序(monitor)的功能是什么?请问:早期监督程序的功能就是替代系统操作员的部分工作,自动控制作业的运转。
监督程序首先把第一道作业调到主存,并启动该作业。
运转完结后,再把下一道作业调到主存启动运转。
它如同一个系统操作员,负责管理批作业的i/o,并自动根据作业控制说明书以单道以太网的方式掌控作业运转,同时在程序运行过程中通过提供更多各种系统调用,掌控采用计算机资源。
1.7试述多道程序设计技术的基本思想。
为什么采用多道程序设计技术可以提高资源利用率?请问:多道程序设计技术的基本思想就是,在主存同时维持多道程序,主机以交错的方式同时处置多道程序。
从宏观来看,主机内同时维持和处置若干道已开始运行但尚未完结的程序。
从微观来看,某一时刻处理机只运转某道程序。
可以提高资源利用率的原因:由于任何一道作业的运行总是交替地串行使用cpu、外设等资源,即使用一段时间的cpu,然后使用一段时间的i/o设备,由于采用多道程序设计技术,加之对多道程序实施合理的运行调度,则可以实现cpu和i/o设备的高度并行,可以大大提高cpu与外设的利用率。
1.8什么就是分时系统?其主要特征就是什么?适用于于哪些应用领域?答:分时系统是以多道程序设计技术为基础的交互式系统,在此系统中,一台计算机与多台终端相连接,用户通过各自的终端和终端命令以交互的方式使用计算机系统。
《Linux操作系统(第2版) )》课后习题答案

《Linux操作系统(第2版)》课后习题答案练习题一、选择题1. Linux最早是由计算机爱好者 B 开发的。
A. Richard PetersenB. Linus TorvaldsC. Rob PickD. Linux Sarwar2. 下列 C 是自由软件。
A. Windows XPB. UNIXC. LinuxD. Windows 20003. 下列 B 不是Linux的特点。
A. 多任务B. 单用户C. 设备独立性D. 开放性4. Linux的内核版本是 A 的版本。
~A. 不稳定B. 稳定的C. 第三次修订D. 第二次修订5. Linux安装过程中的硬盘分区工具是 D 。
A. PQmagicB. FDISKC. FIPSD. Disk Druid6. Linux的根分区系统类型是 C 。
A. FATl6B. FAT32C. ext4D. NTFS二、填空题1. GNU的含义是:GNU's Not UNIX。
2. Linux一般有3个主要部分:内核(kernel)、命令解释层(Shell或其他操作环境)、实用工具。
3. 安装Linux最少需要两个分区,分别是swap交换分区和/(根)分区。
4. Linux默认的系统管理员账号是root 。
;三、简答题(略)1.简述Red Hat Linux系统的特点,简述一些较为知名的Linux发行版本。
2.Linux有哪些安装方式安装Red Hat Linux系统要做哪些准备工作3.安装Red Hat Linux系统的基本磁盘分区有哪些4.Red Hat Linux系统支持的文件类型有哪些练习题一、选择题1. C 命令能用来查找在文件TESTFILE中包含四个字符的行A. grep’’TESTFILEB. grep’….’TESTFILEC. grep’^$’TESTFILED. grep’^….$’TESTFILE—2. B 命令用来显示/home及其子目录下的文件名。
操作系统课后习题答案(第一章)

习题一1-1 存储程序式计算机的主要特点是什么?答:1.存储程序:用户将解决的问题的步骤事先告诉计算机,成为程序;2.程序控制:计算机所作的任何事情都是通过CPU执行程序来完成的。
1-2 批处理系统和分时系统各具有什么特点?为什么分时系统的响应比较快?答:批处理系统:先将程序加载到内存中然后再由CPU执行。
分时系统:分时系统是把处理机时间划分成很短的时间片(如几百毫秒)轮流地分配给各个联机作业使用,如果某个作业在分配的时间片用完之前还未完成计算,该作业就暂时中断。
分时系统由于是时间片轮转来运行程序,所以比多道处理系统响应更快。
1-3 实时系统的特点是什么?实时信息处理系统和分时系统从外表看来很相似,它们有什么本质的区别?答:实时系统的特点是快速响应。
实时系统:实时系统是指计算机对于外来信息能够在被控制对象允许的截止期限内反应的系统。
分时系统:分时系统是把处理机时间划分成很短的时间片(如几百毫秒)轮流地分配给各个联机作业使用,如果某个作业在分配的时间片用完之前还未完成计算,该作业就暂时中断。
1-4 什么是多道程序设计技术?试述多道程序运行的特征?答:多道程序设计技术是在计算机主存中同时存放几道相互独立的程序,使它们在管理程序控制之下,相互穿插地运行。
特征:多道——计算机主存中同时存放几道相互独立的程序;宏观上并行——同时进入系统的几道程序都处于运行过程中,即它们先后开始了各自的运行,但都未运行完毕;微观上串行——从微观上看,主存中的多道程序轮流或分时地占有处理机,交替执行。
(注:基于现在系统的发展,逐渐出现了多核CPU,所以出现了在微观上可以并行的特征)1-5 什么是操作系统?从资源管理的角度去分析操作系统,它的主要功能是什么?答:操作系统是一个大型的程序系统,它负责计算机系统软、硬件资源的分配和管理;控制和协调并发活动;提供用户借口,使用户获得良好的工作环境。
操作系统资源管理的目标是提高系统资源的利用率和方便用户使用。
linux操作系统(第二版)课后习题答案

linux操作系统(第二版)课后习题答案Linux操作系统(第二版)课后习题答案Linux操作系统是一种开源的操作系统,广泛应用于各个领域。
在学习Linux操作系统的过程中,课后习题是一个非常重要的部分,通过解答习题可以加深对知识点的理解和应用能力的提升。
本文将为大家提供一些关于Linux操作系统(第二版)课后习题的答案,希望能对大家的学习有所帮助。
一、选择题1. Linux操作系统最早由谁创建?答:Linus Torvalds2. Linux操作系统是哪种类型的操作系统?答:开源操作系统3. Linux操作系统的内核是?答:Linux内核4. Linux操作系统的特点是?答:稳定、安全、可定制性强5. Linux操作系统最早是为了什么目的而创建的?答:为了个人电脑而创建的二、判断题1. Linux操作系统只能运行在服务器上,不能用于个人电脑。
答:错误2. Linux操作系统的文件系统是大小写敏感的。
答:正确3. Linux操作系统只能使用命令行界面,不能使用图形界面。
答:错误4. Linux操作系统不支持多用户同时登录。
答:错误5. Linux操作系统没有商业公司支持,完全由志愿者维护。
答:错误三、填空题1. Linux操作系统的命令行界面称为______。
答:Shell2. Linux操作系统的默认Shell是______。
答:Bash3. Linux操作系统的配置文件一般存放在______目录下。
答:/etc4. Linux操作系统的进程管理工具是______。
答:ps5. Linux操作系统的软件包管理工具是______。
答:apt四、简答题1. 请简要介绍一下Linux操作系统的文件系统结构。
答:Linux操作系统的文件系统结构是由根目录/开始的,包括了多个目录和文件。
常见的目录包括/bin、/etc、/home、/usr等。
其中/bin存放了一些系统命令,/etc存放了系统的配置文件,/home存放了用户的主目录,/usr存放了系统的应用程序和文件。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
第一章作业
2、什么是操作系统(OS)?它的主要功能是什么?
操作系统是控制和管理计算机系统内各种硬件和软件资源,有效地组织多道程序运行的系统软件(或程序集合),是用户和计算机之间的接口。
操作系统的主要功能有以下5个方面:存储管理、作业和进程管理、设备管理、文件管理和用户接口服务。
存储管理的主要功能包括:内存分配、地址映射、内存保护和内存扩充。
作业和进程管理的功能包括:作业和进程调度、进程控制和进程通信。
设备管理的主要功能包括:缓冲区管理、设备分配、设备驱动和设备无关性。
文件管理的功能包括:文件存储空间的管理、文件操作的一般管理、目录管理、文件的读写管理和存取控制。
用户接口是操作系统对外提供多种服务的手段,使得用户可以方便、有效地使用计算机硬件和运行自己的程序。
3、在计算机系统中操作系统处于什么地位?
操作系统是裸机之上的第1层软件,它只在核心态模式下运行,受硬件保护,与硬件关系尤为密切。
操作系统是整个计算机系统的控制管理中心,其他所有软件都建立在操作系统
之上。
操作系统对它们既具有支配权力,又为其运行建造必备环境。
(P9)
6、操作系统的基本特征是什么?
操作系统的基本特征:
(1)并发:指两个或多个活动在同一给定的时间间隔中进行。
(2)共享:指计算机系统中的资源被多个进程所共用。
(3)不确定性:指系统中各种事件发生顺序的不可预测性。
8、解释以下术语: 多道程序设计、并发、吞吐量、分时、实时、系统调用
多道程序设计:内存中同时存放多道程序,在管理程序的控制下交替地执行。
这些作业共享CPU和系统中的其他资源。
并发:两个或多个活动在同一个给定的时间间隔中运行,它是宏观上的概念。
吞吐量:在一段给定的时间内,计算机所能完成的总工作量。
分时:就是对时间的共享。
在分时系统中,分时主要是指若干并发程序对CPU时间的共享。
实时:表示“及时”或“即时”。
系统调用:是用户在程序中能以“函数调用”形式调用的、由操作系统提供的子功能的集合。
每一个子功能称作一条系统调用命令。
它是操作系统对外的接口,是用户级程序取得操作系统服务的唯一途径。
12、什么是处理机的核心态和用户态?为什么要设置这两种不同的状态?
当执行操作系统程序时,处理机处于核心态。
它具有较高的特权,可以执行所有的指令,包括一般用户程序中不能使用的特权指令,从而能对所有寄存器和内存进行访问、启动I/O 操作等。
用户程序是在用户态下执行,它的的权限较低,只能执行指令集中非特权指令。
设置这两种不同状态的目的是为了保护操作系统程序(特别是其内核部分),防止受到用户程序的损害。
主要问题:
1、第1题:部分同学没有写操作系统的主要功能;
2、第3题“在计算机系统中操作系统处于什么地位” :
回答不完整.
3、第8题:部分同学没有解释术语“系统调用”。
4、第12题“什么是处理机的核心态和用户态?为什么要
设置这两种不同的状态?
”,没有回答第一个小问题或第二个小问题。
5、下次作业不准使用单页纸,一律用
本。
6、
7、
8、
9、(注:文档可能无法思考全面,请浏览后下载,供参考。
)
10、
11、
12、
13、
14、
15、。