版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rè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等.壓縮文件請(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- SG3-179-生命科學(xué)試劑-MCE
- SBN-284-生命科學(xué)試劑-MCE
- 2023年玉溪市紅塔區(qū)衛(wèi)生健康系統(tǒng)招聘高層次緊缺人才筆試真題
- 2023年山東泰安技師學(xué)院招聘筆試真題
- 2023年隴南文縣招聘公益性崗位人員考試真題
- 2024年特種工程塑料項(xiàng)目立項(xiàng)申請(qǐng)報(bào)告模板
- 2024年硫氰酸鹽項(xiàng)目申請(qǐng)報(bào)告模板
- 2023年白銀市衛(wèi)生健康事業(yè)單位引進(jìn)筆試真題
- 病蟲防控治理方案
- 班級(jí)活動(dòng)小白兔課程設(shè)計(jì)
- 計(jì)算機(jī)專業(yè)職業(yè)生涯規(guī)劃書(14篇)
- GB/T 22838.5-2024卷煙和濾棒物理性能的測(cè)定第5部分:卷煙吸阻和濾棒壓降
- 評(píng)標(biāo)專家?guī)煜到y(tǒng)系統(tǒng)總體建設(shè)方案
- 學(xué)校學(xué)生食堂“三防”制度
- 數(shù)學(xué)-湖湘名校教育聯(lián)合體2024年下學(xué)期高二10月大聯(lián)考試題和答案
- 2024年農(nóng)村合作社管理制度范本(二篇)
- 職業(yè)技能競賽-網(wǎng)絡(luò)與信息安全管理員理論題庫(附參考答案)
- 青島版科學(xué)三年級(jí)上冊(cè)全冊(cè)課件教材
- 二十屆三中全會(huì)知識(shí)點(diǎn)試題及答案【200題】
- 2024年高考真題-地理(甘肅卷) 含答案
- 《助產(chǎn)學(xué)》考試試題及答案
評(píng)論
0/150
提交評(píng)論