第二講計(jì)算機(jī)系統(tǒng)的結(jié)構(gòu)_第1頁(yè)
第二講計(jì)算機(jī)系統(tǒng)的結(jié)構(gòu)_第2頁(yè)
第二講計(jì)算機(jī)系統(tǒng)的結(jié)構(gòu)_第3頁(yè)
第二講計(jì)算機(jī)系統(tǒng)的結(jié)構(gòu)_第4頁(yè)
第二講計(jì)算機(jī)系統(tǒng)的結(jié)構(gòu)_第5頁(yè)
已閱讀5頁(yè),還剩24頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

OperatingSystemConcepts

第二講計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)本講主要內(nèi)容:計(jì)算機(jī)系統(tǒng)操作I/O結(jié)構(gòu)存儲(chǔ)系統(tǒng)的結(jié)構(gòu)分級(jí)的存儲(chǔ)體系硬件保護(hù)一般的系統(tǒng)結(jié)構(gòu)作業(yè):第二章2,3,4,5,6,7,8,9,10OperatingSystemConcepts計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)OperatingSystemConcepts計(jì)算機(jī)系統(tǒng)操作I/O設(shè)備和CPU可以并行地執(zhí)行。每一個(gè)設(shè)備控制器負(fù)責(zé)管理一種特定的設(shè)備。設(shè)備控制器通常都有本地的緩沖。CPUmovesdatafrom/tomainmemoryto/fromlocalbuffers。CPU需要在主存和設(shè)備控制器的本地緩沖之間傳送數(shù)據(jù)。I/Oisfromthedevicetolocalbufferofcontroller.I/O就是從設(shè)備到控制器的本地緩沖之間傳送數(shù)據(jù)。DevicecontrollerinformsCPUthatithasfinisheditsoperationbycausinganinterrupt.設(shè)備控制器在完成I/O操作后通過(guò)中斷通知CPU.OperatingSystemConceptsCommonFunctionsofInterrupts

中斷處理的公共操作Interrupttransferscontroltotheinterruptserviceroutinegenerally,throughtheinterruptvector,whichcontainstheaddressesofalltheserviceroutines.中斷一般來(lái)說(shuō)通過(guò)中斷向量將CPU的控制轉(zhuǎn)移給中斷服務(wù)程序。中斷向量包含有所有的服務(wù)程序的地址。Interruptarchitecturemustsavetheaddressoftheinterruptedinstruction.中斷處理的結(jié)構(gòu)要保存被中斷的指令的地址。inginterruptsaredisabledwhileanotherinterruptisbeingprocessedtopreventalostinterrupt.當(dāng)一個(gè)中斷被處理時(shí),新進(jìn)來(lái)的中斷被關(guān)閉,以避免中斷請(qǐng)求丟失。Atrapisasoftware-generatedinterruptcausedeitherbyanerrororauserrequest.陷阱是由軟件產(chǎn)生的中斷,通常是由執(zhí)行指令的錯(cuò)誤或用戶的請(qǐng)求(執(zhí)行陷阱指令)產(chǎn)生的。Anoperatingsystemisinterruptdriven.操作系統(tǒng)都是中斷驅(qū)動(dòng)的。OperatingSystemConceptsInterruptHandling

中斷處理TheoperatingsystempreservesthestateoftheCPUbystoringregistersandtheprogramcounter.操作系統(tǒng)通過(guò)存儲(chǔ)寄存器和程序計(jì)數(shù)器來(lái)保存CPU的狀態(tài)。Determineswhichtypeofinterrupthasoccurred(決定中斷的類(lèi)型的方法):Polling輪詢vectoredinterruptsystem中斷向量Separatesegmentsofcodedeterminewhatactionshouldbetakenforeachtypeofinterrupt單獨(dú)的代碼段決定對(duì)每一種中斷類(lèi)型要采取什么操作。OperatingSystemConceptsInterruptTimeLineForaSingleProcessDoingOutput

單個(gè)進(jìn)程做輸出操作的時(shí)序圖OperatingSystemConceptsI/OStructure

I/O結(jié)構(gòu)AfterI/Ostarts,controlreturnstouserprogramonlyuponI/Ocompletion.I/O操作開(kāi)始后,CPU的控制只有在I/O操作完成后才返回用戶程序。WaitinstructionidlestheCPUuntilthenextinterrupt等待指令在下一次中斷開(kāi)始之前使CPU處于空等狀態(tài)。Waitloop(contentionformemoryaccess).當(dāng)訪問(wèn)存儲(chǔ)器沖突時(shí),就插入等待節(jié)拍。AtmostoneI/Orequestisoutstandingatatime,nosimultaneousI/Oprocessing.任何時(shí)候最多只有一個(gè)中斷請(qǐng)求處于處理狀態(tài)。AfterI/Ostarts,controlreturnstouserprogramwithoutwaitingforI/Ocompletion.I/O操作開(kāi)始后,CPU的控制不等I/O操作完成就交給用戶程序。Systemcall–requesttotheoperatingsystemtoallowusertowaitforI/Ocompletion.系統(tǒng)調(diào)用-請(qǐng)求操作系統(tǒng)容許用戶等待I/O完成。Device-statustablecontainsentryforeachI/Odeviceindicatingitstype,address,andstate.設(shè)備狀態(tài)表中每個(gè)I/O設(shè)備包含一個(gè)項(xiàng)目表明設(shè)備的類(lèi)型,地址和狀態(tài)。OperatingsystemindexesintoI/Odevicetabletodeterminedevicestatusandtomodifytableentrytoincludeinterrupt.操作系統(tǒng)訪問(wèn)I/O設(shè)備表決定設(shè)備的狀態(tài),修改表項(xiàng)以加入中斷。OperatingSystemConceptsTwoI/OMethods

兩種方法Synchronous同步Asynchronous異步OperatingSystemConceptsDevice-StatusTable

設(shè)備狀態(tài)表OperatingSystemConceptsDirectMemoryAccessStructure

直接訪問(wèn)存儲(chǔ)器的結(jié)構(gòu)Usedforhigh-speedI/Odevicesabletotransmitinformationatclosetomemoryspeeds.用于高速I(mǎi)/O設(shè)備,以接近存儲(chǔ)器速度和、傳送信息。DevicecontrollertransfersblocksofdatafrombufferstoragedirectlytomainmemorywithoutCPUintervention.設(shè)備控制器不需要CPU的干預(yù)將一塊數(shù)據(jù)從緩沖直接傳送到存儲(chǔ)器。Onlyoninterruptisgeneratedperblock,ratherthantheoneinterruptperbyte.每個(gè)數(shù)據(jù)塊只產(chǎn)生一個(gè)中斷,而不是每個(gè)字節(jié)產(chǎn)生一個(gè)中斷。OperatingSystemConceptsStorageStructure

存儲(chǔ)結(jié)構(gòu)Mainmemory–onlylargestoragemediathattheCPUcanaccessdirectly.主存-CPU可以直接訪問(wèn)的存儲(chǔ)介質(zhì)。Secondarystorage–extensionofmainmemorythatprovideslargenonvolatilestoragecapacity.二級(jí)存儲(chǔ)器-主存的擴(kuò)展,提供大容量的永久存儲(chǔ)。Magneticdisks–rigidmetalorglassplatterscoveredwithmagneticrecordingmaterial磁盤(pán)-硬金屬或玻璃上覆蓋磁記錄材料。Disksurfaceislogicallydividedintotracks,whicharesubdividedintosectors.磁盤(pán)的表面從邏輯上分成磁道,磁道分為扇區(qū)。Thediskcontrollerdeterminesthelogicalinteractionbetweenthedeviceandthecomputer.磁盤(pán)控制器決定設(shè)備和計(jì)算機(jī)之間邏輯上相互作用。OperatingSystemConceptsMoving-HeadDiskMechanism

磁盤(pán)磁頭移動(dòng)的機(jī)制OperatingSystemConceptsStorageHierarchy

分級(jí)的存儲(chǔ)系統(tǒng)Storagesystemsorganizedinhierarchy.存儲(chǔ)系統(tǒng)根據(jù)以下因素組織成分級(jí)體系:Speed速度Cost成本Volatility非易失(永久存儲(chǔ))Caching–copyinginformationintofasterstoragesystem;mainmemorycanbeviewedasalastcacheforsecondarystorage.高速緩存-將信息拷貝到快速的存儲(chǔ)系統(tǒng)。主存可以二級(jí)存儲(chǔ)器的上一級(jí)的高速緩沖。OperatingSystemConceptsStorage-DeviceHierarchy

分級(jí)存儲(chǔ)設(shè)備OperatingSystemConceptsCaching

緩沖Useofhigh-speedmemorytoholdrecently-accesseddata.用高速主存保存最近訪問(wèn)的數(shù)據(jù)。Requiresacachemanagementpolicy.要求高速緩沖的策略。Cachingintroducesanotherlevelinstoragehierarchy.Thisrequiresdatathatissimultaneouslystoredinmorethanoneleveltobeconsistent.OperatingSystemConceptsMigrationofAFromDisktoRegister

將A從磁盤(pán)遷移到寄存器OperatingSystemConceptsHardwareProtection

硬件保護(hù)Dual-ModeOperation雙模式操作I/OProtectionI/O保護(hù)MemoryProtection存儲(chǔ)保護(hù)CPUProtectionCPU保護(hù)OperatingSystemConceptsDual-ModeOperation

雙模式操作Sharingsystemresourcesrequiresoperatingsystemtoensurethatanincorrectprogramcannotcauseotherprogramstoexecuteincorrectly.Providehardwaresupporttodifferentiatebetweenatleasttwomodesofoperations.1. Usermode–executiondoneonbehalfofauser.2. Monitormode(alsokernelmodeorsystemmode)–executiondoneonbehalfofoperatingsystem.OperatingSystemConceptsDual-ModeOperation(Cont.)

雙模式操作(續(xù))Modebitaddedtocomputerhardwaretoindicatethecurrentmode:monitor(0)oruser(1).Whenaninterruptorfaultoccurshardwareswitchestomonitormode.特權(quán)指令只有在管態(tài)或核心模式下才能執(zhí)行。

monitoruser中斷或異常設(shè)置用戶模式OperatingSystemConceptsI/OProtection

I/O保護(hù)AllI/Oinstructionsareprivilegedinstructions.所有的I/O指令都是特權(quán)指令。Mustensurethatauserprogramcouldnevergaincontrolofthecomputerinmonitormode(I.e.,auserprogramthat,aspartofitsexecution,storesanewaddressintheinterruptvector).必須確保用戶程序不能獲得核心模式(即用戶程序不能將中斷向量表修改成用戶程序的地址)OperatingSystemConceptsUseofASystemCalltoPerformI/O

使用系統(tǒng)調(diào)用執(zhí)行I/O操作OperatingSystemConceptsMemoryProtection

內(nèi)存保護(hù)Mustprovidememoryprotectionatleastfortheinterruptvectorandtheinterruptserviceroutines.至少要為中斷向量表和中斷服務(wù)程序提供存儲(chǔ)保護(hù)。Inordertohavememoryprotection,addtworegistersthatdeterminetherangeoflegaladdressesaprogrammayaccess:為了提供存儲(chǔ)保護(hù),使用以下兩個(gè)寄存器決定程序可以訪問(wèn)的合法的地址Baseregister–holdsthesmallestlegalphysicalmemoryaddress.基址寄存器-保存最小的合法的物理內(nèi)存的地址Limitregister–containsthesizeoftherange界限寄存器-表示合法地址的范圍Memoryoutsidethedefinedrangeisprotected.存儲(chǔ)器超出定義的范圍就受到保護(hù)。OperatingSystemConceptsUseofABaseandLimitRegister

使用基址寄存器和界限寄存器OperatingSystemConceptsHardwareAddressProtection

硬件地址保護(hù)OperatingSystemConceptsHardwareProtection

硬件保護(hù)Whenexecutinginmonitormode,theoperatingsystemhasunrestrictedaccesstobothmonitoranduser’smemory.當(dāng)操作系統(tǒng)在管態(tài)下執(zhí)行時(shí),系統(tǒng)和用戶的存儲(chǔ)空間都有沒(méi)有限制的訪問(wèn)權(quán)限。Theloadinstructionsforthebaseandlimitregistersareprivilegedi

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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)論