操作系統(tǒng)概念(中文版)課后答案1_第1頁
操作系統(tǒng)概念(中文版)課后答案1_第2頁
操作系統(tǒng)概念(中文版)課后答案1_第3頁
操作系統(tǒng)概念(中文版)課后答案1_第4頁
操作系統(tǒng)概念(中文版)課后答案1_第5頁
已閱讀5頁,還剩29頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Chapter 1n1. What are the three main purposes of an operating system?n環(huán)境提供者,為計(jì)算機(jī)用戶提供一個(gè)環(huán)境,使得能夠在計(jì)算機(jī)硬件上方便、高效的執(zhí)行程序n資源分配者,為解決問題按需分配計(jì)算機(jī)的資源,資源分配需盡可能公平、高效n控制程序n監(jiān)控用戶程序的執(zhí)行,防止出錯(cuò)和對(duì)計(jì)算機(jī)的不正當(dāng)使用n管理I/O設(shè)備的運(yùn)行和控制1-cont.n2. What is the main advantage of multiprogramming?n高效地使用CPU,通過重疊來自不同用戶對(duì)CPU和I/O設(shè)備的需求n增加CPU的利用,設(shè)法讓CPU執(zhí)行

2、有意義的指令1-cont.n3. In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation can result in various security problems.na. What are two such problems?nb. Can we ensure the same degree of security in a time-shared machine as we have in a dedicated m

3、achine? Explain your answer.n用戶之間互相偷數(shù)據(jù)、代碼n對(duì)系統(tǒng)資源使用的記賬信息1-cont.n4. Define the essential properties of the following types of operating systems:na. Batchn相似需求的Job分批、成組的在計(jì)算機(jī)上執(zhí)行,Job由操作員或自動(dòng)Job程序裝置裝載;n可以通過采用 buffering, off-line operation, spooling, multiprogramming 等技術(shù)使CPU 和 I/O不停忙來提高性能n批處理適合于需要極少用戶交互的Job。

4、nb. Interactiven由許多短交易組成,下一次交易的結(jié)果可能不可預(yù)知n需要響應(yīng)時(shí)間短1-cont.nc. Time sharingn使用CPU調(diào)度和多道程序提供對(duì)系統(tǒng)的經(jīng)濟(jì)交互式使用,CPU快速地在用戶之間切換n一般從終端讀取控制,輸出立即打印到屏幕nd. Real timen在專門系統(tǒng)中使用,從傳感器讀取信息,必須在規(guī)定時(shí)間內(nèi)作出響應(yīng)以確保正確的執(zhí)行1-cont.ne. Networkn在通用OS上添加n聯(lián)網(wǎng)、通信功能n遠(yuǎn)程過程調(diào)用n文件共享nf. Distributedn具有聯(lián)網(wǎng)、通信功能n提供遠(yuǎn)程過程調(diào)用n提供多處理機(jī)的統(tǒng)一調(diào)度調(diào)度n統(tǒng)一的存儲(chǔ)管理n分布式文件系統(tǒng)1-cont.

5、n5. Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems?nSymmetric multiprocessing中所有處理器同等對(duì)待,I/O可以在任意CPU上處理。nAsymmetric multiprocessing具有一個(gè)主CPU和多個(gè)從CPU,主CPU將任務(wù)分派到從CPU,I/O通常只能由主CPU處理。n多處理機(jī)系統(tǒng)的優(yōu)點(diǎn)n比多個(gè)計(jì)算機(jī)系統(tǒng)可能更省

6、錢(同樣CPU個(gè)數(shù))n執(zhí)行程序更快n可靠性更高n缺點(diǎn):軟硬件更復(fù)雜n6. thinking: what kind of features may exist in CC, IOT or CPS?Chapter 2n1. How does the distinction between monitor mode and user mode function as a rudimentary form of protection (security) system?n通過建立一組只能在monitor mode才能執(zhí)行的特權(quán)指令集,OS能夠確保總是能控制整個(gè)系統(tǒng)。2-cont.n2. What ar

7、e the differences between a trap and an interrupt? What is the use of each function?nAn interrupt是硬件產(chǎn)生的系統(tǒng)內(nèi)的流的改變nA trap是軟件產(chǎn)生的“中斷”。ninterrupt可以被I/O用來產(chǎn)生完成的信號(hào),從而避免CPU對(duì)設(shè)備的輪詢 nA trap可以用來調(diào)用OS的例程或者捕獲算術(shù)錯(cuò)誤 2-cont.n3. Which of the following instructions should be privileged?na. Set value of timer.nb. Read the

8、clock.nc. Clear memory.nd. Turn off interrupts.ne. Switch from user to monitor mode.na. Set value of timer.nc. Clear memory.nd. Turn off interrupts.ne. Switch from user to monitor mode.2-cont.n4. Protecting the operating system is crucial to ensuring that the computer system operates correctly. Prov

9、ision of this protection is the reason behind dual-mode operation, memory protection, and the timer. To allow maximum flexibility, however, we would also like to place minimal constraints on the user. The following is a list of operations that are normally protected. What is the minimal set of instr

10、uctions that must be protected?na. Change to user mode.nb. Change to monitor mode.nc. Read from monitor memory.nd. Write into monitor memory.ne. Fetch an instruction from monitor memory.nf. Turn on timer interrupt.ng. Turn off timer interrupt.nb. Change to monitor mode.nc. Read from monitor memory.n

11、d. Write into monitor memory.ng. Turn off timer interrupt.Chapter 3n1. What are the five major activities of an operating system in regard to process management?n用戶和系統(tǒng)進(jìn)程地創(chuàng)建和刪除n 進(jìn)程的掛起和恢復(fù)n 提供進(jìn)程同步的機(jī)制n 提供進(jìn)程通信的機(jī)制n 提供死鎖處理的機(jī)制3-cont.n2. What are the three major activities of an operating system in regard to

12、 memory management?n跟蹤內(nèi)存使用情況(哪一部分被使用、誰使用)n當(dāng)內(nèi)存空間可用的時(shí)候,確定將哪些進(jìn)程調(diào)入內(nèi)存(job調(diào)度)n按需要分配和回收內(nèi)存3-cont.n3. What are the three major activities of an operating system in regard to secondary-storage management?n剩余空間的管理n存儲(chǔ)分配n磁盤調(diào)度3-cont.n4. What are the five major activities of an operating system in regard to file m

13、anagement?n文件創(chuàng)建和刪除n目錄創(chuàng)建和刪除n目錄和文件操作原語的支持n文件到二級(jí)存儲(chǔ)的映射n將文件備份到非易失存儲(chǔ)設(shè)備3-cont.n5. What is the purpose of the command interpreter? Why is it usually separate from the kernel?n讀取命令(從用戶或者命令文件)并執(zhí)行(轉(zhuǎn)化成系統(tǒng)調(diào)用)n可能會(huì)經(jīng)常改變3-cont.n6. What is the purpose of system calls?n讓用戶級(jí)進(jìn)程可以請(qǐng)求操作系統(tǒng)所提供的服務(wù)3-cont.n7. What is the purpose

14、 of system programs?n為程序開發(fā)和運(yùn)行提供了方便的環(huán)境n給用戶提供基本的公共功能函數(shù),為用戶在不用自己寫代碼的情況下解決公用問題n8.試著安裝虛擬機(jī)試著安裝虛擬機(jī)VMWARE,然后在這臺(tái)虛擬機(jī)上安,然后在這臺(tái)虛擬機(jī)上安裝一個(gè)操作系統(tǒng)裝一個(gè)操作系統(tǒng)n9.閱讀閱讀Linux源碼,給出某一個(gè)源碼,給出某一個(gè)system call的源碼并的源碼并分析,分析分析,分析init/main.c給出流程圖給出流程圖Chapter 4n1. Describe the differences among short-term, medium-term, and long-term schedu

15、ling.nShort-term,CPU調(diào)度nLong-term,job調(diào)度nMedium-term,分時(shí)系統(tǒng)中的中間調(diào)度級(jí)4-cont.n2. Describe the actions a kernel takes to context switch between processes.n保存正在運(yùn)行的進(jìn)程的狀態(tài)、恢復(fù)欲調(diào)度到CPU進(jìn)程的狀態(tài)4-cont.n3. What are the benefits and detriments of each of the following? Consider both the systems and the programmers levels.

16、na. Symmetric and asymmetric communicationnb. Automatic and explicit bufferingnc. Send by copy and send by referencend. Fixed-sized and variable-sized messages4-cont.n4. The correct producerconsumer algorithm in the ppt, allows only n - 1 buffers to be full at any one time. Modify the algorithm to a

17、llow all buffers to be utilized fully.4-cont.n5. Consider the interprocess-communication scheme where mailboxes are used.na. Suppose a process P wants to wait for two messages, one from mailbox A and one from mailbox B. What sequence of send and receive should it execute?nb. What sequence of send an

18、d receive should P execute if P wants to wait for one message either from mailbox A or from mailbox B (or from both)?nc. A receive operation makes a process wait until the mailbox is nonempty. Either devise a scheme that allows a process to wait until a mailbox is empty, or explain why such a scheme

19、 cannot exist.nanreceive(A,m1) receive(B,m2) send(c,m3) nreceive(B,m1) receive(A,m2) send(c,m3)nbnreceive(A,m1) receive(B,m2) send(c,m3) nreceive(B,m1) receive(A,m2) send(c,m3)nreceive(A,m1) send(c,m3) receive(B,m2)nreceive(B,m1) send(c,m3) receive(A,m2) 4-cont.n6.閱讀分析閱讀分析Linux終止進(jìn)程的源碼終止進(jìn)程的源碼n7.編程,實(shí)現(xiàn)

20、一個(gè)簡單網(wǎng)絡(luò)聊天程序,用到編程,實(shí)現(xiàn)一個(gè)簡單網(wǎng)絡(luò)聊天程序,用到socket和和fork()(接受和發(fā)送在(接受和發(fā)送在fork出的進(jìn)程中)出的進(jìn)程中)Chapter 5n1. Provide two programming examples of multithreading giving improved performance over a single-threaded solution.n可以并發(fā)的多任務(wù)nWeb瀏覽器,數(shù)據(jù)可并行處理n2. Provide two programming examples of multithreading that would not improve

21、 performance over a single-threaded solution.n不可以并發(fā)的單任務(wù)n用多個(gè)線程讀一個(gè)文件n后續(xù)的結(jié)果必須依賴于前面的5 cont.n3. What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?n內(nèi)核可知與不可知n調(diào)度者不同n與進(jìn)程的關(guān)系n運(yùn)行效率、內(nèi)核復(fù)雜度、用戶可控程度n4. What resources are used when

22、 a thread is created? How do they differ from those used when a process is created?nTCB,寄存器組,棧,調(diào)度信息nPCB,所有與進(jìn)程執(zhí)行和調(diào)度相關(guān)的資源與信息,內(nèi)存,打開的文件,環(huán)境變量5-cont.n5. Write a multithreaded Pthread or Java program that outputs prime numbers. This program should work as follows: The user will run the program and will ent

23、er a number on the command line. The program will then create a separate thread that outputs all the prime numbers less than or equal to the number that the user entered.n6.編程,實(shí)現(xiàn)一個(gè)簡單網(wǎng)絡(luò)聊天程序,用到編程,實(shí)現(xiàn)一個(gè)簡單網(wǎng)絡(luò)聊天程序,用到socket和和pthread(接受和發(fā)送在(接受和發(fā)送在pthread創(chuàng)建的線程中)創(chuàng)建的線程中)Chapter 6n1. A CPU scheduling algorithm d

24、etermines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many possible different schedules are there? Give a formula in terms of n.nN個(gè)進(jìn)程的排列問題nPnn = n!n2. Define the difference between preemptive and nonpreemptive scheduling. State why s

25、trict nonpreemptive scheduling is unlikely to be used in a computer center.n對(duì)CPU控制權(quán)的主動(dòng)還是被動(dòng)放棄n不可能采用純非剝奪機(jī)制:考慮到多道程序、分時(shí)共享,公平和輕重緩急6-cont.n3. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:nThe processes are assumed to have arrived in the order P1, P2,

26、 P3, P4, P5, all at time 0.na. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling.nb. What is the turnaround time of each process for each of the schedul

27、ing algorithms in part a?nc. What is the waiting time of each process for each of the scheduling algorithms in part a?nd. Which of the schedules in part a results in the minimal average waiting time (over all processes)?6-cont.n6.3 na. n b. n c. nd. SJF6-cont.n4. Suppose that the following processes

28、 arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made.na. What is the average turnaround time for these processes

29、 with the FCFS scheduling algorithm? (8-0)+(12-0.4)+(13-1.0)/3 = 10.53 nb. What is the average turnaround time for these processes with the SJF scheduling algorithm? (8-0)+(13-0.4)+(9-1.0)/3 = 9.53nc. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at

30、 time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may

31、increase. This algorithm could be known as future-knowledge scheduling. (14-0)+(6-0.4)+(2-1.0)/3 = 6.876-cont.n5. Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger priority numbers imply higher priority. When a process is waiting for the

32、 CPU (in the ready queue but not running), its priority changes at a rate A; when it is running, its priority changes at a rate B. All processes are given a priority of 0 when they enter the ready queue. The parameters A and B can be set to give many different scheduling algorithms.na. What is the algorithm that results from BA0?nb. What is the algorithm that results from AB0?nFCFSnLIFO6-cont.n6. Many CPU sc

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論