




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030中国环境美化及园艺服务行业产业运行态势及投资规划深度研究报告
- 服务贸易统计培训课件
- 学生学习风格与个性化教学策略
- 教师职业发展与教学质量的提升策略研究
- 退换货培训课件
- 教育数字化转型中的技术革新与挑战
- 智慧城市公共服务平台的数据管理与分析
- 钢结构焊接培训课件
- 教育大数据在教学管理中的创新应用
- 抖音商户短视频播放量分析反馈制度
- 重庆市旋挖成孔灌注桩工程技术规程
- 贵州省黔西南布依族苗族自治州2023-2024学年六年级下学期6月期末数学试题
- DL∕T 5783-2019 水电水利地下工程地质超前预报技术规程
- 100MW400MWh全钒液流电池储能电站项目可行性研究报告写作模板-拿地申报
- 老版入团志愿书表格完整
- 中考字音字形练习题(含答案)-字音字形专项训练
- 四柱万能液压机液压系统 (1)讲解
- 广东省中山市2022-2023学年三年级下学期语文期末考试试卷(含答案)
- 思想道德与法治智慧树知到期末考试答案章节答案2024年复旦大学
- 2024届新高考物理冲刺复习:“正则动量”解决带电粒子在磁场中的运动问题
- 2023年第二次广东省高中历史学业水平合格考试卷真题(含答案详解)
评论
0/150
提交评论