操作系統(tǒng)第3次作業(yè)_第1頁
操作系統(tǒng)第3次作業(yè)_第2頁
操作系統(tǒng)第3次作業(yè)_第3頁
全文預(yù)覽已結(jié)束

下載本文檔

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

文檔簡介

1、ACPUschedulingalgorithmdeterminesanorderfortheexecutionofitsscheduledprocesses.Givennprocessestobescheduledononeprocessor,howmanypossibledifferentschedulesarethere?Giveaformulaintermsofn.答:共有n!=n*(n-1)*(n-2)*1種不同樣度方法。2.Definethedifferencebetweenpreemptiveandnonpreemptivescheduling.Statewhystrictnonp

2、reemptiveschedulingisunlikelytobeusedinacomputercenter.答:非占式度:一旦CPU被分配一個程,那么程會素來使用CPU直到程止或切到等待狀主放CPU??烧际蕉龋寒?dāng)一個程在CPU上運行,程序的CPU使用可以被另一個新程剝,被占的程序的狀被保存在PCB中,并入就列,等待下一次運行。若是一個系采用的是非可占式度,并采用先度,那么先比低的程可能永都在等待被行,造成。種情況就需要采用老化技來防范。因此一個算機(jī)中心最好不要采用格的非占式度。Considerthefollowingsetofprocesses,withthelengthoftheCPU-b

3、ursttimegiveninmilliseconds:TheprocessesareassumedtohavearrivedintheorderP1,P2,P3,P4,P5,allattime0.a.DrawfourGanttchartsillustratingtheexecutionoftheseprocessesusingFCFS,SJF,anonpreemptivepriority(asmallerprioritynumberimpliesahigherpriority),andRR(quantum=1)scheduling.b.Whatistheturnaroundtimeofeac

4、hprocessforeachoftheschedulingalgorithmsinparta?c.Whatisthewaitingtimeofeachprocessforeachoftheschedulingalgorithmsinparta?d.Whichoftheschedulesinpartaresultsintheminimalaveragewaitingtime(overallprocesses)?FCFSP1P2P3P4P501011131419答:a)非搶占式SJFP2P4P3P5P10124919非搶占式優(yōu)先級P2P5P1P3P4016161819RR(時間片=1)P1P2P

5、3P4P5P1P3P5P1P5P1P5P1P5P1P1P1P1P1012345678910111213141516171819)周轉(zhuǎn)時間:FCFS:P1=10;P2=11;P3=13;P4=14;P5=19;SJF:P1=19;P2=1;P3=4;P4=2;P5=9;非搶占式優(yōu)先級:P1=16;P2=1;P3=18;P4=19;P5=6;RR:P1=19;P2=2;P3=7;P4=4;P5=14;c)等待時間:FCFS:P1=0;P2=10;P3=11;P4=13;P5=14;SJF:P1=9;P2=0;P3=2;P4=1;P5=4;非搶占式優(yōu)先級:P1=6;P2=0;P3=16;P4=18;

6、P5=1;RR:P1=9;P2=1;P3=5;P4=3;P5=9;d)平均等待時間:FCFS:(0+10+11+13+14)/5=9.6SJF:(9+0+2+1+4)/5=3.2非搶占式優(yōu)先級:(6+0+16+18+1)/4=10.25RR:(9+1+5+3+9)/4=6.75因此,SJF算法的平均等待時間最少。Supposethatthefollowingprocessesarriveforexecutionatthetimesindicated.Eachprocesswillrunthelistedamountoftime.Inansweringthequestions,usenonpre

7、emptiveschedulingandbasealldecisionsontheinformationyouhaveatthetimethedecisionmustbemade.a.WhatistheaverageturnaroundtimefortheseprocesseswiththeFCFSschedulingalgorithm?b.WhatistheaverageturnaroundtimefortheseprocesseswiththeSJFschedulingalgorithm?c.TheSJFalgorithmissupposedtoimproveperformance,but

8、noticethatwechosetorunprocessP1attime0becausewedidnotknowthattwoshorterprocesseswouldarrivesoon.ComputewhattheaverageturnaroundtimewillbeiftheCPUisleftidleforthefirst1unitandthenSJFschedulingisused.RememberthatprocessesP1andP2arewaitingduringthisidletime,sotheirwaitingtimemayincrease.Thisalgorithmcouldbeknownasfuture-knowledgescheduling.答:a)執(zhí)行序次為:P1,P2,P3;平均

溫馨提示

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

評論

0/150

提交評論