




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、Modern Operating Systems ReviewZhang YangSpring 2014Chapter 1 Introduction nWhat is an OS?It is an extended machineIt is a resource managernHistory of OSFirst generation, no OSSecond generation, early batch systemThird generation, multiprogramming, spooling and timesharingFourth generationnOperating
2、 System StructureMonolithic SystemLayered SystemMicrokernelClient-Server Model Virtual MachineExokernelChapter 2 Process (1) nProcess ModelMultiprogramming, concurrencynProcessDefinition: an executing programProcess vs. programProgramp The collection of instruction, static conceptpA program can be t
3、he execution program of multiple processProcesspDescribe concurrency, dynamic conceptpA process include program ,data ,and PCBpTemporarypA process can call multiple programChapter 2 Process (2) nProcess StatesThree states: running, ready, blockTransition between StatesnProcess Control BlockA data st
4、ructure in the operating system kernel containing the information needed to manage a particular process. OS maintains a PCB for each process.Chapter 2 Process (3) Chapter 2 Process (4) nProcess Context SwitchSwitch CPU from one process to another, performed by scheduler Expensive (1-1000ms), no usef
5、ul work is done (pure overhead)Chapter 2 Process (5) nProcess Creation EventsSystem InitializationExecution of a process creation system callUser request to create a new processInitiation of a batch jobnLinux Process Creation: fork( )nProcess Termination EventsNormal exit (voluntary)Error exit (volu
6、ntary)Fatal error (involuntary)Killed by another process (involuntary)Chapter 2 Process (6) nThreadDefinition: A sequential execution stream within a process (also called lightweight process)Advantages nCreating a thread is (much) cheaper than a process (10-20 times)nSwitching to a different thread
7、in same process is (much) cheaper (5-50 times)nThreads within same process can share data and other resources more conveniently and efficiently (without copying or messages)nThreads within a process are not protected from each otherChapter 2 Process (7) nThreadThe Thread ModelImplementation: user sp
8、ace, kernel space, hybridChapter 2 Process (8) nProcess vs.ThreadProcessnUnit of resource ownership with respect to the execution of a single programnCan encompass more than one thread of executionnProcesses are largely independentnExpensive creationnExpensive context switchingThreadnUnit of executi
9、onnBelongs to a processnThreads are part of the same “job” and are actively and closely cooperatingnInexpensive creationnInexpensive context switchingChapter 2 Process (9)User-LevelnManaged by applicationnKernel not aware of threadnContext switching cheapnCreate as many as needednMust be used with c
10、areKernel-LevelnManaged by kernelnConsumes kernel resourcesnContext switching expensive nNumber limited by kernel resourcesnSimpler to useKey issue: kernel threads provide virtual processors to user-level threads, but if all of kthreads block, then all user-level threads will block even if the progr
11、am logic allows them to proceedUser-LevelnManaged by applicationnKernel not aware of threadnContext switching cheapnCreate as many as needednMust be used with careKernel-LevelnManaged by kernelnConsumes kernel resourcesnContext switching expensive nNumber limited by kernel resourcesnSimpler to usen
12、User-Level vs. Kernel ThreadsChapter 2 Process (10) nIPCRace conditionnThe situation where several processes access and manipulate shared data concurrently. The final value of the shared data depends upon which process finishes last.Critical region or sectionnPart of the process code that affects th
13、e shared resource.nFour requirementsSemaphore and PV operationsClassical IPC problemsnUsing semaphore to solveProducer-Consumer ProblemReaders and Writers ProblemDining Philosophers ProblemSemaphore as Synchronization Tool nExecute B in Pj only after A executed in PinUse semaphore S initialized to 0
14、nCode:Pi PjA P(S)V(S) BChapter 2 Process (11) nProcess ScheduleWhen to schedulenA new process startsnThe running process exitsnThe running process is blocked nI/O interrupt (some processes will be ready)nClock interrupt (e.g. every 10 milliseconds)Schedule algorithmnBatch systemsFirst-Come First-Ser
15、ved (FCFS)Short Job FirstnInteractive systemRound RobinPriority SchedulingMulti Queue & Multi-level FeedbackChapter 3 Memory Management (1) nBasic Memory ManagementStatic RelocationnAt load time, OS adjusts addresses in process to reflect position in memorynOS cannot move process after relocatio
16、n Dynamic RelocationnRun-time mapping of virtual address into physical address with the support of some hardware mechanism nHardware adds relocation register (base) to virtual address to get physical addressFree Space ManagementnBit mapnLinked listChapter 3 Memory Management (2) nBasic Memory Manage
17、ment (ctd.)Storage Placement StrategynFirst fitnNext fitnBest fitnWorst fitnPagingAddress translation schemePage tables, TLB, multi-level page tables, inverted page tablesPage faultChapter 3 Memory Management (3) nPage Replacement AlgorithmOptimalFIFO: Beladys anomalySecond chanceNRUClockLRUNFUAging
18、Working setnA processs working set is the set of pages that it currently “needs”.Working set clockChapter 3 Memory Management (4) nDesign Issues for PagingResident Set ManagementnSet of a process pages which are in main memorynReplacement ScopeLocal ReplacementGlobal ReplacementnResident Set SizeFix
19、ed AllocationVariable AllocationnSegmentationAddress translationChapter 4 File System (1)nFile A named collection of related information that is recorded on secondary storage.nFile System A method for storing and organizing files and the data they contain to make it easy to find and access them.nBas
20、ic Functions of File SystemPresent logical (abstract) view of files and directoriesFacilitate efficient use of storage devicesSupport sharingnFile TypesRegular file: ASCII, BinaryDirectoryCharacter special fileBlock special fileChapter 4 File System (2) nDirectoryOne-level directory systemTwo-level
21、directory systemHierarchical directory systemnFile Storage ImplementationContiguous allocationLinked list allocation: FATIndexed allocation: i nodeChapter 4 File System (3) nShared Files Hard linkSymbolic linknBlock SizenDisk Space ManagementLinked listBit mapnFile System BackupLogical dump algorith
22、mnFile System ConsistencyChecking blockChecking directorynUnix V7 file systemChapter 5 Input/Output (1) nGoals of I/O softwareDevice IndependenceUniform NamingError HandlingSynchronous vs. Asynchronous TransferBufferingSharable vs. Dedicated Devices File access nPrincipals of I/O SoftwareProgrammed
23、I/OInterrupt-driven I/OI/O using DMAChapter 5 Input/Output (2) nI/O Software LayersInterrupt handlersDevice driversnAccept abstract read/write requests from the device-independent software above and translate them into concrete I/O-module-specific commandsnSchedule requests: optimize queued request
24、order for best device utilization (eg: disk arm)nInitialize the device, if needednManage power requirements and log device eventsDevice independent OS SoftwarenUniform interfacing to device deriversnBufferingnError reportingnAllocating and releasing dedicated devicesnProviding a device-independent block sizeUser-level I/O SoftwareChapter 5 Input/Output (3) nCylinder skewnDis
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 職業(yè)病賠償標(biāo)準考核試卷
- 全球家電產(chǎn)品認證要求考核試卷
- 融資政策精準對接考核試卷
- 內(nèi)河運輸企業(yè)盈利能力研究考核試卷
- 樂器批發(fā)商渠道合作效果評估方法考核試卷
- 2025年中國PU剎車腳輪數(shù)據(jù)監(jiān)測研究報告
- 2025年中國IC一卡通管理系統(tǒng)數(shù)據(jù)監(jiān)測報告
- 2025年中國49鍵電子琴數(shù)據(jù)監(jiān)測研究報告
- 2025年中國107膠數(shù)據(jù)監(jiān)測報告
- 2025至2030年中國高爾夫柄市場分析及競爭策略研究報告
- 水泥攪拌樁施工項目進度管理措施
- 人工智能賦能教師數(shù)字素養(yǎng)提升
- 換電站合同范例
- 【超星學(xué)習(xí)通】馬克思主義基本原理(南開大學(xué))爾雅章節(jié)測試網(wǎng)課答案
- (CNAS-CL01-2018認可準則)內(nèi)審核查表
- 2024年模型模具加工合同范本
- 廣東省高州市2023-2024學(xué)年高一下學(xué)期期中考試數(shù)學(xué)
- 食堂工作人員考核方案
- 國家基本公衛(wèi)(老年人健康管理)考試復(fù)習(xí)題及答案
- 臨床營養(yǎng)(043)(正高級)高級衛(wèi)生專業(yè)技術(shù)資格考試試卷及答案指導(dǎo)(2025年)
- 重慶市旋挖成孔灌注樁工程技術(shù)規(guī)程
評論
0/150
提交評論