




已閱讀5頁,還剩30頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
Chapter1 1 Whatarethethreemainpurposesofanoperatingsystem 環(huán)境提供者 為計(jì)算機(jī)用戶提供一個(gè)環(huán)境 使得能夠在計(jì)算機(jī)硬件上方便 高效的執(zhí)行程序資源分配者 為解決問題按需分配計(jì)算機(jī)的資源 資源分配需盡可能公平 高效控制程序監(jiān)控用戶程序的執(zhí)行 防止出錯和對計(jì)算機(jī)的不正當(dāng)使用管理I O設(shè)備的運(yùn)行和控制 1 cont 2 Whatisthemainadvantageofmultiprogramming 高效地使用CPU 通過重疊來自不同用戶對CPU和I O設(shè)備的需求增加CPU的利用 設(shè)法讓CPU執(zhí)行有意義的指令 1 cont 3 Inamultiprogrammingandtime sharingenvironment severaluserssharethesystemsimultaneously Thissituationcanresultinvarioussecurityproblems a Whataretwosuchproblems b Canweensurethesamedegreeofsecurityinatime sharedmachineaswehaveinadedicatedmachine Explainyouranswer 用戶之間互相偷數(shù)據(jù) 代碼對系統(tǒng)資源使用的記賬信息 1 cont 4 Definetheessentialpropertiesofthefollowingtypesofoperatingsystems a Batch相似需求的Job分批 成組的在計(jì)算機(jī)上執(zhí)行 Job由操作員或自動Job程序裝置裝載 可以通過采用buffering off lineoperation spooling multiprogramming等技術(shù)使CPU和I O不停忙來提高性能批處理適合于需要極少用戶交互的Job b Interactive由許多短交易組成 下一次交易的結(jié)果可能不可預(yù)知需要響應(yīng)時(shí)間短 1 cont c Timesharing使用CPU調(diào)度和多道程序提供對系統(tǒng)的經(jīng)濟(jì)交互式使用 CPU快速地在用戶之間切換一般從終端讀取控制 輸出立即打印到屏幕d Realtime在專門系統(tǒng)中使用 從傳感器讀取信息 必須在規(guī)定時(shí)間內(nèi)作出響應(yīng)以確保正確的執(zhí)行 1 cont e Network在通用OS上添加聯(lián)網(wǎng) 通信功能遠(yuǎn)程過程調(diào)用文件共享f Distributed具有聯(lián)網(wǎng) 通信功能提供遠(yuǎn)程過程調(diào)用提供多處理機(jī)的統(tǒng)一調(diào)度調(diào)度統(tǒng)一的存儲管理分布式文件系統(tǒng) 1 cont 5 Describethedifferencesbetweensymmetricandasymmetricmultiprocessing Whatarethreeadvantagesandonedisadvantageofmultiprocessorsystems Symmetricmultiprocessing中所有處理器同等對待 I O可以在任意CPU上處理 Asymmetricmultiprocessing具有一個(gè)主CPU和多個(gè)從CPU 主CPU將任務(wù)分派到從CPU I O通常只能由主CPU處理 多處理機(jī)系統(tǒng)的優(yōu)點(diǎn)比多個(gè)計(jì)算機(jī)系統(tǒng)可能更省錢 同樣CPU個(gè)數(shù) 執(zhí)行程序更快可靠性更高缺點(diǎn) 軟硬件更復(fù)雜6 thinking whatkindoffeaturesmayexistinCC IOTorCPS Chapter2 1 Howdoesthedistinctionbetweenmonitormodeandusermodefunctionasarudimentaryformofprotection security system 通過建立一組只能在monitormode才能執(zhí)行的特權(quán)指令集 OS能夠確??偸悄芸刂普麄€(gè)系統(tǒng) 2 cont 2 Whatarethedifferencesbetweenatrapandaninterrupt Whatistheuseofeachfunction Aninterrupt是硬件產(chǎn)生的系統(tǒng)內(nèi)的流的改變Atrap是軟件產(chǎn)生的 中斷 interrupt可以被I O用來產(chǎn)生完成的信號 從而避免CPU對設(shè)備的輪詢Atrap可以用來調(diào)用OS的例程或者捕獲算術(shù)錯誤 2 cont 3 Whichofthefollowinginstructionsshouldbeprivileged a Setvalueoftimer b Readtheclock c Clearmemory d Turnoffinterrupts e Switchfromusertomonitormode a Setvalueoftimer c Clearmemory d Turnoffinterrupts e Switchfromusertomonitormode 2 cont 4 Protectingtheoperatingsystemiscrucialtoensuringthatthecomputersystemoperatescorrectly Provisionofthisprotectionisthereasonbehinddual modeoperation memoryprotection andthetimer Toallowmaximumflexibility however wewouldalsoliketoplaceminimalconstraintsontheuser Thefollowingisalistofoperationsthatarenormallyprotected Whatistheminimalsetofinstructionsthatmustbeprotected a Changetousermode b Changetomonitormode c Readfrommonitormemory d Writeintomonitormemory e Fetchaninstructionfrommonitormemory f Turnontimerinterrupt g Turnofftimerinterrupt b Changetomonitormode c Readfrommonitormemory d Writeintomonitormemory g Turnofftimerinterrupt Chapter3 1 Whatarethefivemajoractivitiesofanoperatingsysteminregardtoprocessmanagement 用戶和系統(tǒng)進(jìn)程地創(chuàng)建和刪除進(jìn)程的掛起和恢復(fù)提供進(jìn)程同步的機(jī)制提供進(jìn)程通信的機(jī)制提供死鎖處理的機(jī)制 3 cont 2 Whatarethethreemajoractivitiesofanoperatingsysteminregardtomemorymanagement 跟蹤內(nèi)存使用情況 哪一部分被使用 誰使用 當(dāng)內(nèi)存空間可用的時(shí)候 確定將哪些進(jìn)程調(diào)入內(nèi)存 job調(diào)度 按需要分配和回收內(nèi)存 3 cont 3 Whatarethethreemajoractivitiesofanoperatingsysteminregardtosecondary storagemanagement 剩余空間的管理存儲分配磁盤調(diào)度 3 cont 4 Whatarethefivemajoractivitiesofanoperatingsysteminregardtofilemanagement 文件創(chuàng)建和刪除目錄創(chuàng)建和刪除目錄和文件操作原語的支持文件到二級存儲的映射將文件備份到非易失存儲設(shè)備 3 cont 5 Whatisthepurposeofthecommandinterpreter Whyisitusuallyseparatefromthekernel 讀取命令 從用戶或者命令文件 并執(zhí)行 轉(zhuǎn)化成系統(tǒng)調(diào)用 可能會經(jīng)常改變 3 cont 6 Whatisthepurposeofsystemcalls 讓用戶級進(jìn)程可以請求操作系統(tǒng)所提供的服務(wù) 3 cont 7 Whatisthepurposeofsystemprograms 為程序開發(fā)和運(yùn)行提供了方便的環(huán)境給用戶提供基本的公共功能函數(shù) 為用戶在不用自己寫代碼的情況下解決公用問題8 試著安裝虛擬機(jī)VMWARE 然后在這臺虛擬機(jī)上安裝一個(gè)操作系統(tǒng)9 閱讀Linux源碼 給出某一個(gè)systemcall的源碼并分析 分析init main c給出流程圖 Chapter4 1 Describethedifferencesamongshort term medium term andlong termscheduling Short term CPU調(diào)度Long term job調(diào)度Medium term 分時(shí)系統(tǒng)中的中間調(diào)度級 4 cont 2 Describetheactionsakerneltakestocontextswitchbetweenprocesses 保存正在運(yùn)行的進(jìn)程的狀態(tài) 恢復(fù)欲調(diào)度到CPU進(jìn)程的狀態(tài) 4 cont 3 Whatarethebenefitsanddetrimentsofeachofthefollowing Considerboththesystemsandtheprogrammers levels a Symmetricandasymmetriccommunicationb Automaticandexplicitbufferingc Sendbycopyandsendbyreferenced Fixed sizedandvariable sizedmessages 4 cont 4 Thecorrectproducer consumeralgorithmintheppt allowsonlyn 1bufferstobefullatanyonetime Modifythealgorithmtoallowallbufferstobeutilizedfully 4 cont 5 Considertheinterprocess communicationschemewheremailboxesareused a SupposeaprocessPwantstowaitfortwomessages onefrommailboxAandonefrommailboxB Whatsequenceofsendandreceiveshoulditexecute b WhatsequenceofsendandreceiveshouldPexecuteifPwantstowaitforonemessageeitherfrommailboxAorfrommailboxB orfromboth c Areceiveoperationmakesaprocesswaituntilthemailboxisnonempty Eitherdeviseaschemethatallowsaprocesstowaituntilamailboxisempty orexplainwhysuchaschemecannotexist areceive A m1 receive B m2 send c m3 receive B m1 receive A m2 send c m3 breceive A m1 receive B m2 send c m3 receive B m1 receive A m2 send c m3 receive A m1 send c m3 receive B m2 receive B m1 send c m3 receive A m2 4 cont 6 閱讀分析Linux終止進(jìn)程的源碼7 編程 實(shí)現(xiàn)一個(gè)簡單網(wǎng)絡(luò)聊天程序 用到socket和fork 接受和發(fā)送在fork出的進(jìn)程中 Chapter5 1 Providetwoprogrammingexamplesofmultithreadinggivingimprovedperformanceoverasingle threadedsolution 可以并發(fā)的多任務(wù)Web瀏覽器 數(shù)據(jù)可并行處理2 Providetwoprogrammingexamplesofmultithreadingthatwouldnotimproveperformanceoverasingle threadedsolution 不可以并發(fā)的單任務(wù)用多個(gè)線程讀一個(gè)文件后續(xù)的結(jié)果必須依賴于前面的 5 cont 3 Whataretwodifferencesbetweenuser levelthreadsandkernel levelthreads Underwhatcircumstancesisonetypebetterthantheother 內(nèi)核可知與不可知調(diào)度者不同與進(jìn)程的關(guān)系運(yùn)行效率 內(nèi)核復(fù)雜度 用戶可控程度4 Whatresourcesareusedwhenathreadiscreated Howdotheydifferfromthoseusedwhenaprocessiscreated TCB 寄存器組 棧 調(diào)度信息PCB 所有與進(jìn)程執(zhí)行和調(diào)度相關(guān)的資源與信息 內(nèi)存 打開的文件 環(huán)境變量 5 cont 5 WriteamultithreadedPthreadorJavaprogramthatoutputsprimenumbers Thisprogramshouldworkasfollows Theuserwillruntheprogramandwillenteranumberonthecommandline Theprogramwillthencreateaseparatethreadthatoutputsalltheprimenumberslessthanorequaltothenumberthattheuserentered 6 編程 實(shí)現(xiàn)一個(gè)簡單網(wǎng)絡(luò)聊天程序 用到socket和pthread 接受和發(fā)送在pthread創(chuàng)建的線程中 Chapter6 1 ACPUschedulingalgorithmdeterminesanorderfortheexecutionofitsscheduledprocesses Givennprocessestobescheduledononeprocessor howmanypossibledifferentschedulesarethere Giveaformulaintermsofn N個(gè)進(jìn)程的排列問題Pnn n 2 Definethedifferencebetweenpreemptiveandnonpreemptivescheduling Statewhystrictnonpreemptiveschedulingisunlikelytobeusedinacomputercenter 對CPU控制權(quán)的主動還是被動放棄不可能采用純非剝奪機(jī)制 考慮到多道程序 分時(shí)共享 公平和輕重緩急 6 cont 3 Considerthefollowingsetofprocesses withthelengthoftheCPU bursttimegiveninmilliseconds TheprocessesareassumedtohavearrivedintheorderP1 P2 P3 P4 P5 allattime0 a DrawfourGanttchartsillustratingtheexecutionoftheseprocessesusingFCFS SJF anonpreemptivepriority asmallerprioritynumberimpliesahigherpriority andRR quantum 1 scheduling b Whatistheturnaroundtimeofeachprocessforeachoftheschedulingalgorithmsinparta c Whatisthewaitingtimeofeachprocessforeachoftheschedulingalgorithmsinparta d Whichoftheschedulesinpartaresultsintheminimalaveragewaitingtime overallprocesses 6 cont 6 3a b c d SJF 6 cont 4 Supposethatthefollowingprocessesarriveforexecutionatthetimesindicated Eachprocesswillrunthelistedamountoftime Inansweringthequestions usenonpreemptiveschedulingandbasealldecisionsontheinformationyouhaveatthetimethedecisionmustbemade a WhatistheaverageturnaroundtimefortheseprocesseswiththeFCFSschedulingalgorithm 8 0 12 0 4 13 1 0 3 10 53b WhatistheaverageturnaroundtimefortheseprocesseswiththeSJFschedulingalgorithm 8 0 13 0 4 9 1 0 3 9 53c TheSJFalgorithmissupposedtoimproveperformance butnoticethatwechosetorunprocessP1attime0becausewedidnotknowthattwoshorterprocesseswouldarrivesoon ComputewhattheaverageturnaroundtimewillbeiftheCPUisleftidleforthefirst1unitandthenSJFschedulingisused RememberthatprocessesP1andP2arewaitingduringthisidletime sotheirwaitingtimemayincrease Thisalgorithmcouldbeknownasfuture knowledgescheduling 14 0 6 0 4 2 1 0 3 6 87 6 cont 5 Considerthefollowingpreemptivepriority schedulingalgorithmbasedondynamicallychangingpriorities Largerprioritynumbersimplyhigherpriority WhenaprocessiswaitingfortheCPU inthereadyqueuebutnotrunning itsprioritychangesatarateA whenitisrunning itsprioritychangesatarateB Allprocessesaregivenapriorityof0whentheyenterthereadyqueue TheparametersAandBcanbesettogivemanydifferentschedulingalgorithms a WhatisthealgorithmthatresultsfromB A 0 b WhatisthealgorithmthatresultsfromA B 0 FCFSLIFO 6 cont 6 ManyCPUschedulingalgorithmsareparameteriz
溫馨提示
- 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)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工作、休息兩不誤的單身公寓布局規(guī)劃
- 工作中的危機(jī)管理與應(yīng)對
- 工業(yè)設(shè)計(jì)原理與產(chǎn)品設(shè)計(jì)流程
- 工業(yè)節(jié)能的途徑與方法
- 工業(yè)設(shè)計(jì)創(chuàng)新與產(chǎn)品升級路徑
- 工業(yè)風(fēng)辦公室裝修風(fēng)格探討
- 工作流程再造提高效率的方法
- 工程施工中的人性化管理
- 工廠設(shè)備清潔保養(yǎng)流程
- 工廠電氣設(shè)備的維護(hù)管理
- 養(yǎng)殖業(yè)技術(shù)知識培訓(xùn)課件
- 慢性傷口護(hù)理中的柔性可穿戴設(shè)備應(yīng)用
- 學(xué)生心理健康一生一策檔案表
- 2025年商洛柞水縣城鄉(xiāng)供水有限公司招聘筆試參考題庫含答案解析
- 浙江首考2025年1月普通高等學(xué)校招生全國統(tǒng)考政治試題及答案
- 實(shí)訓(xùn)美容手術(shù)操作基本技術(shù)美容外科學(xué)概論講解
- 學(xué)校消防安全管理與突發(fā)事件處置
- 《排球教學(xué)課件》課件
- 人為關(guān)懷在骨科護(hù)理中的應(yīng)用
- 2025年四川省廣元經(jīng)濟(jì)技術(shù)開發(fā)區(qū)招聘15人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- 幼小銜接全套課件
評論
0/150
提交評論