操作系統(tǒng)復(fù)習(xí)題Eli_第1頁
操作系統(tǒng)復(fù)習(xí)題Eli_第2頁
操作系統(tǒng)復(fù)習(xí)題Eli_第3頁
操作系統(tǒng)復(fù)習(xí)題Eli_第4頁
操作系統(tǒng)復(fù)習(xí)題Eli_第5頁
已閱讀5頁,還剩4頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、Multiple Choice1. What are the major activities of an operating system?A:User managementB:Main Memory management(存儲(chǔ)管理)C:I/O system management設(shè)備管理 D:File management文件管理Answer:BCD2. The way that operating system components are interconnected and modeled into a kernel can be?A:Simple structureB:Micro k

2、ernelsC:Layered approachD:Prototype approachAnswer:ABC3. What state is a process in when it can not run because it needs a resource to become available?A:ReadyB:InterruptC:BlockedD:RunningAnswer:C4. Which are the major differences between user-level threads and kernel-level threads?A:User-level thre

3、ads are unknown by the kernel, whereas the kernel is aware of kernel threads.B:User threads are scheduled by the thread library and the kernel schedules kernel threads.C:Kernel threads need not be associated with a process whereas every user thread belongs to a process.D:One user-level thread can be

4、 only mapped by one kernel thread.Answer:ABC5. Which of the following free-space management strategies are supported by an operating system?A:Bit VectorB:Linked listC:Grouping D:CountingAnswer:ABCD6. What refers to the page replacement algorithm which replaces the page that has not been used for the

5、 longest period of time?A:FIFOB:LRUC:OPTD:LFUAnswer:B7. Which of the followings is a condition for deadlock?A:Starvation B:Circular WaitC:No PreemptionD:Mutual ExclusionAnswer:BCD8. The basic function of the file system is accessing files by names. The function can be realized by A directory-managem

6、ent B boosting the speed of the file-accessingC file-protectingD improving the utilization of storage9. A main memory space B cpu managementC I/O system managementD Tape management10.Which of the following strategies need base register and length register?A:pagingB:segmentationC:segmentation with pa

7、gingD:fixed sized partitions memory managementAnswer:ABCConcept Explanations 1.System call系統(tǒng)調(diào)用。獲取操作系統(tǒng)所提供的服務(wù)的接口。系統(tǒng)調(diào)用的類型:進(jìn)程控制文件管理設(shè)備管理信息維護(hù)通信。2. Critical section臨界區(qū)。假如某個(gè)系統(tǒng)有n個(gè)進(jìn)程P0,P1,,Pn。每個(gè)進(jìn)程有一個(gè)代碼段稱為臨界區(qū),在該區(qū)中進(jìn)程可能改變共同變量、更新一個(gè)表、寫一個(gè)文件等。沒有兩個(gè)進(jìn)程可同時(shí)在臨界區(qū)內(nèi)執(zhí)行。3.Directory計(jì)算機(jī)的文件系統(tǒng)可以非常大。為了管理這些數(shù)據(jù),需要組織它們。這種管理涉及使用目錄。目錄記錄一

8、個(gè)分區(qū)中所有文件的的信息,如名稱、位置、大小和類型等。目錄可看做符號(hào)表。它將文件名稱轉(zhuǎn)換成目錄條目。4.Overlay覆蓋:一個(gè)作業(yè)的若干程序段,或幾個(gè)作業(yè)的某些部分共享某一個(gè)存儲(chǔ)空間。引入:在多道程序環(huán)境下擴(kuò)充內(nèi)存的方法,用以解決在較小的存儲(chǔ)空間中運(yùn)行較大程序時(shí)遇到的問題。原理:一個(gè)程序的幾個(gè)代碼段和數(shù)據(jù)段,按照時(shí)間先后來占用公共的內(nèi)存空間。(并不是作業(yè)的每一部分都是時(shí)時(shí)要用的)。 把程序劃分為若干個(gè)功能上相互獨(dú)立的程序段,按照其自身的邏輯結(jié)構(gòu)將那些不會(huì)同時(shí)執(zhí)行的程序段共享同一塊內(nèi)存區(qū)域。 程序段先保存在磁盤上,當(dāng)有關(guān)程序段的前一部分執(zhí)行結(jié)束后,把后續(xù)程序段調(diào)入內(nèi)存,覆蓋前面的程序段。Bri

9、ef Answers1. What is the difference between process and program? What is the difference between process and thread?1.1 程序和進(jìn)程的區(qū)別:程序是完成所需求的功能時(shí),所應(yīng)采取的順序步驟,是執(zhí)行指令的有序集合。進(jìn)程是執(zhí)行中的程序,包括程序計(jì)數(shù)器,進(jìn)程棧和數(shù)據(jù)段,還可能包括堆。程序和進(jìn)程的區(qū)別:程序本身不是進(jìn)程。程序只是被動(dòng)實(shí)體,如存儲(chǔ)在磁盤上的可執(zhí)行文件。進(jìn)程是活動(dòng)實(shí)體,不只是程序代碼,還包括當(dāng)前活動(dòng)。隨程序的執(zhí)行而發(fā)生,隨程序的結(jié)束而消亡。.多個(gè)進(jìn)程可與同一程序相關(guān)。并且這些進(jìn)程

10、被當(dāng)做獨(dú)立的執(zhí)行序列。靜止?fàn)顟B(tài)的程序和數(shù)據(jù)是相互獨(dú)立的信息集合,進(jìn)程中的程序和數(shù)據(jù)是一個(gè)不可分割的實(shí)體。1.2 線程與進(jìn)程的區(qū)別線程是CPU使用的基本單元,進(jìn)程是系統(tǒng)工作的基本單元,資源分配的最小單位。線程劃分的尺度小,所以并發(fā)性高,而進(jìn)程劃分的尺度相對(duì)較大。線程是CPU執(zhí)行的基本單元,而進(jìn)程是內(nèi)存分配的基本單元。進(jìn)程是運(yùn)行中的程序,是一個(gè)動(dòng)態(tài)的概念,獲得了計(jì)算機(jī)資源,執(zhí)行了任務(wù)。而線程是進(jìn)程中的一個(gè)單一的組成部分,一叫做輕量級(jí)進(jìn)程,是程序執(zhí)行的最小單位。2. What is the cause of trashing? How does the system detect thrashing

11、? Once it detects thrashing, what can the system do to eliminate this problem? 顛簸,頻繁的頁調(diào)度行為。一個(gè)進(jìn)程在換頁上用的時(shí)間要多于執(zhí)行的時(shí)間,那么這個(gè)進(jìn)程就在顛簸。顛簸的原因:進(jìn)程總的需求大于可用幀的數(shù)量。那么有的進(jìn)程就會(huì)得不到足夠的幀,從而出現(xiàn)顛簸。系統(tǒng)怎么探測(cè)顛簸?系統(tǒng)可通過對(duì)比多道程序的程度來估計(jì)CPU利用率的程度,以此來檢測(cè)顛簸。怎么消除?降低多道程序的程度可以消除顛簸。3. What is spooling? Describe how spooling works using printer as an

12、 example 假脫機(jī)是用來保存設(shè)備輸出的緩沖區(qū)。這些設(shè)備不能接受交叉的數(shù)據(jù)流。它是OS用來協(xié)調(diào)并發(fā)輸出的一種方法。 從一個(gè)應(yīng)用軟件打印文稿時(shí),應(yīng)用程序的輸出先是假脫機(jī)到一個(gè)獨(dú)立的磁盤文件上,當(dāng)這個(gè)假脫機(jī)文件創(chuàng)建完畢,OS就將控制權(quán)交給應(yīng)用程序,然后,這個(gè)假脫機(jī)文件將在后臺(tái)被送往打印機(jī)打印出來。Consider a system consisting of 4 resources of the same type that are shared by three processes,each of which needs at most 2 resources. Show that the

13、system is deadlock free. 發(fā)生死鎖的條件假設(shè)該系統(tǒng)陷入死鎖。這意味著,每一個(gè)進(jìn)程只持有一個(gè)資源,并且正等待另一個(gè)資源。因?yàn)橛?個(gè)進(jìn)程和4個(gè)資源,有一個(gè)進(jìn)程必須獲取2個(gè)資源,該進(jìn)程并不需要更多的資源。不滿足死鎖產(chǎn)生的占有并等待條件。Comprehensive1. Consider a memory management system with paging.There are three jobs, J1, J2, J3 , are in the memory now. J2 has 4 pages,which are stored in the 3rd ,4rh ,6r

14、h and 8 rh block of the main memory respectively.Suppose the page size is 1024 bytes, and the main is 10K bytes, please answer the following two questions:(1)Draw the page table of J2;2100/1024=2, 2對(duì)應(yīng)的幀號(hào)為6,2100%1024=52,頁偏移為52物理地址為:6*1024+52=6196J2的頁表:03142638(2)If J2 meets the instruction “MOV2100,3

15、100” at its logical address 500(decimal),give the physical addresses of the two operands above. 2.Consider the following snapshot of a system:AllocationMaxAvailable R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4 P0 0 0 1 2 0 0 1 2 2 1 0 0 P1 2 0 0 0 2 7 5 0 P2 0 0 3 4 6 6 5 6 P3 2 3 5 4 4 3 5 6 P4 0 3 3 2 0 6

16、5 21. How many instances of each resource type in the system?2. What is the content of the matrix need?3. Is the system in a safe state? Why?4. If a request from process P2 arrives for (0,1,0,0), can the request be granted immediately?Answer:1. 各種資源的實(shí)例數(shù)量總數(shù)等于各個(gè)進(jìn)程所分配的各種資源的實(shí)例數(shù)量與各種資源現(xiàn)有的實(shí)例數(shù)量之和。即(R1,R2,R3

17、,R4)=(6,7,12,12)2. Need矩陣中的各個(gè)資源的數(shù)值等于每個(gè)進(jìn)程的最大需求Max矩陣-每個(gè)進(jìn)程現(xiàn)在所分配的各個(gè)資源實(shí)例數(shù)量Allocation矩陣,即 Need R1 R2 R3 R4 P0 0 0 0 0 P1 0 7 5 0 P2 6 6 2 2 P3 2 0 0 2 P4 0 3 2 0 3. 如果可以找到一個(gè)安全序列,那么該系統(tǒng)就處于安全狀態(tài),否則,系統(tǒng)就處于不安全狀態(tài)。因?yàn)檎业叫蛄?lt;P0,P3,P4,P1,P2>滿足安全要求,所以系統(tǒng)安全。4. P2的Request2 =(0,1,0,0)。首先檢測(cè)Request2 <Need2, 其值為真,然后檢測(cè)

18、 Request2 <Available,其值為真。接著假定這個(gè)請(qǐng)求被滿足,會(huì)產(chǎn)生如下新狀態(tài):Allocation NeedAvailable R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4 P0 0 0 1 2 0 0 1 2 2 0 0 0 P1 2 0 0 0 2 7 5 0 P2 0 1 3 4 6 5 2 2P3 2 3 5 4 4 3 5 6P4 0 3 3 2 0 6 5 2必須確定此狀態(tài)是否安全,為此,執(zhí)行安全算法。找不到一安全序列,故不能立即允許進(jìn)程P2的這個(gè)請(qǐng)求。3. Consider the following page reference

19、string:2、3、4、5、3、4、1、2、3、5、1、4、2、4、5、1、3、2、1、3. Please write processes of the following replacement algorithms and give the number of page faults, assuming 3 frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each.1. FIFO replacement:先進(jìn)先出頁置換 置換最舊的頁2.

20、LRU replacement:最近最少使用頁置換 置換最長(zhǎng)時(shí)間沒有使用的頁3. Optimal replacement:最優(yōu)頁置換 置換將來最長(zhǎng)時(shí)間不使用的頁Answer:FIFO: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 5 5 3 3 3 4 4 4 1 1 1 3 3 3 1 1 1 5 5 5 2 2 2 3 3 4 4 4 2 2 2 1 1 1 5 5 5 2頁錯(cuò)誤次數(shù):15LRU: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 1 1 1 5 5 5 2 2 1 1 1 3 3 3 3 2 2 2 1 1 1 5 5 5 2 4 4 4 4 3 3 3 4 4 4 4 3 3頁錯(cuò)誤次數(shù):15OPT: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 5 5 5 5 1 1 3 3 3 3 3 1 4 4 3 4 4 1 2 2 2 2 2頁錯(cuò)次數(shù):10 運(yùn)用FIFO4.Consider the following set of processes, with the length

溫馨提示

  • 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)論