版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Modern Operating Systems Chapter 1 - IntroductionZhang YSpring 2013Content of this lecture1.1 What is an Operating System?1.2 History of Operating Systems1.3 Computer Hardware Review1.4 The Operating System Zoo 1.5 Operating System Concepts1.6 System Calls1.7 Operating System StructureSummary1.1 Wha
2、t is an Operating System?1.2 History of Operating Systems1.3 Computer Hardware Review 1.4 The Operating System Zoo1.5 Operating System Concepts1.6 System Calls1.7 Operating System StructureSummaryWhat is an Operating System?(1)A modern computer consists of One or more processorsMain memoryDisksPrint
3、ersVarious input/output devicesManaging all these components requires a layer of software the operating systemWhat is an Operating System ? (2)An Operating System is a program that acts as an intermediary/interface between a user of a computer and the computer hardware.Figure 1-1. Where the operatin
4、g system fits in.What is an Operating System ? (3)Operating System GoalsConvenience (user goals)Ease of useOften the goal with personal computer systems, i.e., single-user systemsAlso, often the goal with computer novices, and people who dont have a goal of learning more about computersHuman factors
5、 importantEfficiency (system goals)Maximize hardware resource utilizationOften a goal with server systems or “mainframe” computers, i.e., multiple-user systemsAlso, sometimes the goal with computer expertsEasy to design, implement, maintainWhat Is an OS? Real life example?2-3 persons group discussio
6、n2 minutesWhat is an Operating System?(4)The Operating System as an Extended MachineThe OS hides the messy details which must be performed-Provide standard Library (I.e., abstract resources)The OS implements a virtual machine on top of the machine that is easier to use (i.e. write programs for)This
7、is the “top down” (or external view) of an operating system.What is an Operating System?(5)The Operating System as an Extended Machine (ctd.)What is an Operating System?(6)ExampleTo copy bytes from one device (e.g. a CD-ROM to another (e.g. a fixed disk) a programmer must issue several instructions
8、that:Check to see if the device is availableCopy a chunk of bits from the CD-ROM drive into memory Set a status bit to 1 to indicate that there is data in memory that must now be transferred to the disk Generate a signal to the processor to indicate that bytes can now be transferred from memory to t
9、he diskEvery program that needs to carry out this operation would have to include code to do soProgram might have to be modified when devices are changed (e.g. a faster CD-ROM is installed in the computer).What is an Operating System?(7)Example (ctd.)Programming computer hardware directly is difficu
10、ltOperating systems provide a layer between applications and computer hardware:Abstract computer hardware detailsPromote portabilityEnable efficient and safe shared use of hardware resourcesWhat is an Operating System? (8)The Operating System as a Resource ManagerAllow multiple programs to run at th
11、e same timeManage and protect memory, I/O devices, and other resources.Includes multiplexing (sharing) resources in two different ways:In timeIn spaceThis is the “bottom-up” (or internal) view of an OS1.1 What is an Operating System?1.2 History of Operating Systems1.3 Computer Hardware Review1.4 The
12、 Operating System Zoo 1.5 Operating System Concepts1.6 System Calls1.7 Operating System StructureSummaryHistory of Operating Systems (1)Two distinct phases of historyPhase 1: Computers are expensiveGoal: Use computers time efficientlyMaximize throughput (i.e., jobs per second)Maximize utilization (i
13、.e., percentage busy)Phase 2: Computers are inexpensiveGoal: Use peoples time efficientlyMinimize response timeHistory of Operating Systems (2)First Generation 1945 1955 Vacuum tubes, plug boards, punched cards (no OS)Second Generation 1955 1965Transistors, batch systemsThird Generation 1965 1980 IC
14、s, multiprogramming, spooling, timesharingFourth Generation 1980 present Large scale integrationPersonal computers, hand-held devices, sensorsNext Generation?Systems connected by high-speed networks?Wide area resource management?History of Operating Systems (3)First Generation 1945 1955: direct inpu
15、tVacuum tubes, plug boards Machine language,no OSPunched cards(by the early 1950s)Second Generation 1955 1965Transistors, batch systemsMainframe, job (a program or set of programs), FORTRAN or assembler, punched cardsFMS (the Fortran Monitor System), IBSYS (IBMs OS for the 7094)History of Operating
16、Systems (4)History of Operating System (5)Figure 1-3. An early batch system(a) Programmers bring cards to 1401(b) 1401 reads batch of jobs onto tape(c) Operator carries input tape to 7094(d) 7094 does computing(e) Operator carries output tape to 1401(f) 1401 prints outputHistory of Operating Systems
17、 (6)Figure 1-4. Structure of a typical FMS job History of Operating System (7)Second Generation 1955 1965 (ctd.)Goal of OS: Better throughput and utilizationBatch: Group of jobs submitted togetherOperator collects jobs; orders efficiently; runs one at a timeAdvantagesAmortize setup costs over many j
18、obsOperator more skilled at loading tapesKeep machine busy while programmer thinksImproves throughput and utilizationProblemsUser must wait until batch is done for resultsMachine idle when job is reading from cards and writing to printersHistory of Operating Systems (8)Third Generation 1965 1980 ICs
19、, multiprogramming, spooling, timesharingA family of software compatible computers, IBM 360 series, OS/360UniprogrammingProcessor must wait for I/O instruction to complete before precedingHistory of Operating Systems (9)Third Generation 1965 1980 (ctd.)MultiprogrammingWhen one program needs to wait
20、for I/O, the processor can switch to the other programHistory of Operating Systems (10)Third Generation 1965 1980 (ctd.)Multiprogramming (ctd.)Figure 1-5. A multiprogramming system with three jobs in memory Multiple jobs in memory Protected from one another Operating system protected from each job a
21、s well Resources (time, hardware) split between jobs Still not interactive User submits job Computer runs it User gets results minutes (hours, days) laterHistory of Operating Systems (11)Third Generation 1965 1980 (ctd.) SpoolingOriginal batch systems used tape drivesLater batch systems used disks f
22、or bufferingOperator read cards onto disk attached to the computerComputer read jobs from diskComputer wrote job results to diskOperator directed that job results be printed from diskDisks enabled simultaneous peripheral operation on line (spooling)Computer overlapped I/O of one job with execution o
23、f anotherBetter utilization of the expensive CPUStill only one job active at any given timeHistory of Operating Systems (12)Third Generation 1965 1980 (ctd.)TimesharingUsing multiprogramming to handle multiple interactive jobsProcessors time is shared among multiple usersMultiple users simultaneousl
24、y access the system through terminalsCompatible Time-Sharing System (CTSS) First time-sharing system developed at MITMULTiplexed Information and Computing Services (MULTICS)History of Operating Systems (13)Fourth Generation 1980 present Windows is the other Dominant Family of OSCP/M was first PC Ope
25、rating SystemDOS (Disk Operating System) later to be renamed MS-DOS dominated the PC Market.Windows provided GUI for DOS (up to Windows 3.x)Windows 95 was first free standing version of WindowsFollowed by Windows 98Windows NT was first 32-bit OSWindows 2000 was introduced as Windows NT version 4Wind
26、ows VISTAWindows 7History of Operating Systems (14)Fourth Generation 1980 present (ctd.)UnixLinuxCurrent Systems Conclusion: OS changes due to both hardware and usersCurrent TrendsNetworked Operating SystemsDistributed Operating SystemsOS code base is largeMillions of lines of code1000 person-years
27、of workCode is complex and poorly understoodSystem outlives any of its buildersSystem will always contain bugsBehavior is hard to predict, tuning is done by guessing1.1 What is an Operating System?1.2 History of Operating Systems1.3 Computer Hardware Review1.4 The Operating System Zoo 1.5 Operating
28、System Concepts1.6 System Calls1.7 Operating System StructureSummaryA Typical Computer SystemFigure 1-6. Some of the components of a simple personal computer.ProcessorsEach CPU has a specific set of instructionsAll CPUs containGeneral registers inside to hold key variables and temporary resultsSpeci
29、al registers visible to the programmerProgram counter contains the memory address of the next instruction to be fetchedStack pointer points to the top of the current stack in memoryPSW (Program Status Word) contains the condition code bits which are set by comparison instructions, the CPU priority,
30、the mode (user or kernel) and various other control bits.How Processors Work (1)Execute InstructionsCPU CyclesFetch (from mem) decode executeProgram Counter (PC)When is PC changed?Pipeline: fetch n+2 while decode n+1 while execute nSuperscalarHow Processors Work (2)Execute Instructions (ctd.)CPU Cyc
31、les (ctd.)Figure 1-7. (a) A three-stage pipeline. (b) A superscalar CPU.How Processors Work (3)Execute Instructions (ctd.)Two Modes of CPU (why?)User mode (a subset of instructions)Kernel mode (all instruction)Trap (special instruction)Switch from user mode to kernel mode and starts the OSFigure 1-8
32、. (a) A quad-core chip with a shared L2 cache. (Intel)(b) A quad-core chip with separate L2 caches. (AMD)Multithreaded and Multicore ChipsMemory-Storage Hierarchy for command prompt1.1 What is an Operating System?1.2 History of Operating Systems1.3 Computer Hardware Review1.4 The Operating System Zo
33、o 1.5 Operating System Concepts1.6 System Calls1.7 Operating System StructureSummaryFrom Slide What is OSCode that:Sits between programs & hardwareSits between different programsSits betweens different usersJob of OS:Manage hardware resourcesAllocation, protection, reclamation, virtualizationProvide
34、 services to app. How? - System CallAbstraction, simplification, standardizationApplicationOSHardwareA peek into Unix/LinuxApplicationPortable OS LayerLibrariesMachine-dependent layerUser space/levelKernel space/level User/kernel modes are supported by hardware Some systems do not have clear user-ke
35、rnel boundaryUnix: ApplicationApplication (E.g., emacs)Portable OS LayerLibrariesMachine-dependent layerWritten by programmerCompiled by programmerUses function callsUnix: LibrariesApplicationPortable OS LayerLibraries (e.g., stdio.h)Machine-dependent layerProvided pre-compiledDefined in headersInpu
36、t to linker (compiler)Invoked like functionsMay be “resolved” when program is loadedTypical Unix OS StructureApplicationPortable OS LayerLibrariesMachine-dependent layersystem calls (read, open.)All “high-level” codeTypical Unix OS StructureApplicationPortable OS LayerLibrariesMachine-dependent laye
37、rBootstrapSystem initializationInterrupt and exception I/O device driverMemory managementKernel/user mode switchingProcessor managementSystem Calls (1)System CallsThe mechanism used by an application program to request service from the operating system. System calls often use a special machine code
38、instruction which causes the processor to change mode (e.g. to supervisor mode or protected mode). This allows the OS to perform restricted actions such as accessing hardware devices or the memory management unit. System Calls (2)Exampleread (fd, buffer,nbytes)fd: file descriptorbuffer: nbytes: numb
39、er of bytes to readcount=read (fd, buffer,nbytes)Figure 1-17. Steps in Making a System CallSystem Calls (3)POSIXPortable Operating System InterfaceSet of IEEE standardsMandatory + optional partsObjective: Source code portability of applications across multiple OSStandard way for applications to inte
40、rface to OSMostly but not exclusively Unix type OSTotal portability is not achievableThe mapping of POSIX procedure calls onto system calls is not one-to-one.System Calls (4)System Calls for Process Managementfork ()fork is the only way to create a new process in POSIX.The new process created by for
41、k is called the child process.This function is called once but returns twice.Returns: 0 in child, process ID of child in parent, -1 on errorBoth the child and parent continue executing with the instruction that follows the call to fork.System Calls (5)System Calls for Process Management (ctd.)waitpi
42、d()Return: process ID if OK, 0 or 1 on errorThe interpretation of the pid argument depends on its value:pid = = -1 waits for any child process. In this respect, waitpid is equivalent to wait.pid 0 waits for the child whose process ID equals pid.execve()execve function allows child process to execute
43、 code that is different from that of parentexec family of functions provides a facility for overlaying the process image of the calling process with a new image.System Calls (6)System Calls for Process Management (ctd.)Example of fork used in simplified shell program#define TRUE 1while (TRUE) /* rep
44、eat forever */ type_prompt( );/* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) /* fork off child process*/ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */ else /* Child code */ execve (command, parameters, 0); /* execute comm
45、and */ System Calls (7)Some System Calls for File Management System Calls (8)Some System Calls for Directory and File System Management System Calls (9)Some System Calls for Directory and File System Management (ctd.)Example: link(“/usr/jim/memo”, “/usr/ast/note”)(a) Two directories before linking/u
46、sr/jim/memo to asts directory(b) The same directories after linkingSystem Calls (10)Some System Calls for Directory and File System Management (ctd.)Example: mount(“/dev/fd0”, “/mnt”,0)(a) File system before the mount(b) File system after the mountSystem Calls (11)Some System Calls for Miscellaneous
47、System Calls (12)The Windows Win32 APIIn windows, the library calls and the actual system calls are highly decoupled.Win32 API for programmers to use to get OS services.The number of Win32 API calls is extremely large, numbering in the thousands.System Calls (13)Some Win32 API calls1.1 What is an Op
48、erating System?1.2 History of Operating Systems1.3 Computer Hardware Review1.4 The Operating System Zoo 1.5 Operating System Concepts1.6 System Calls1.7 Operating System StructureSummaryOperating System Structure (1)Monolithic System - the big mess. All operating system operations are put into a sin
49、gle file. The operating system is a collection of procedures, each of which can call any of the others.Basic StructureA main program that invokes the requested service procedure.A set of service procedures that carry out the system calls.A set of utility procedures that help the service procedures.P
50、roblems: Kernel components arent protected from each other, not easily extended/modified, structure may be unclearOperating System Structure (2)Figure 1-24. Simple structuring model for a monolithic systemOperating System Structure (3)Figure 1-25. Structure of the THE operating systemLayered SystemT
51、he operating system is organized as a hierarchy of layers of processes.Hiding information at each layerDevelop a layer at a timeExample: THE Operating System (Dijkstra, 1968)A simple batch system for Electrologica X8Operating System Structure (4)Layered System (ctd.)Example: MULTICSOperating System
52、Structure (5)MicrokernelsOS kernel is very small minimal functionality.Isolates all hardware dependent and/or policy independent code in the kernel (trusted system)Other OS functions provided at user level by trusted servers.User process, trusted by kernel All policy dependent code is located in use
53、r-space processes (untrusted code)Better Known Microkernels: Integrity, K42, L4, MINIX 3Advantages: maintainability, flexibility, modularityProblems: performanceFigure 1-26. Structure of the MINIX 3 system.Operating System Structure (6)Microkernels (ctd.)Example: MINIX 3Reincarnation ServerOperating
54、 System Structure (7)Microkernels (ctd.)Separation of Policy from MechanismPolicies - What should be doneMechanisms - How it is doneOperating System Structure (8)Client-Server Model Moving most of the code up into the higher layers made the kernel to be minimal and only responsible for communication
55、 between clients and servers.Operating System Structure (9)Client-Server Model (ctd.)The operating system is collection of servers that provide specific services; e.g., file server, etc.Figure 1-27. The client-server model in a distributed systemOperating System Structure (10)Client-Server Model (ctd.)Advantage of this system is adaptability to use in distributed systems
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年秋人教版新教材九年级上册英语Unit 2单元测试A卷(含答案)
- 高中历史 加练 题型8 选择题之史学理论类
- 高中物理 加强练习第一章 2.“刹车类”与行车安全问题
- 资金拆借合同
- 景区景观隧道施工方案(3篇)
- 柳州庭院卡座施工方案(3篇)
- 汽修门店应急预案方案(3篇)
- 海参打折营销方案策划(3篇)
- 湖南湘潭中环应急预案(3篇)
- 甲醛治理施工方案范本(3篇)
- “双减”背景下初中英语阅读教学策略优化
- 四川能投发展股份有限公司所属公司2026年员工公开招聘考试参考题库及答案详解
- xx区加强生物多样性保护实施方案
- 沪教版(五四学制)2026年数学七年级下册期末测试卷(含答案解析)
- 老挝用工合同范本
- 检察院安全生产工作制度
- 2026云南曲靖国金资本运营集团有限公司招聘3人笔试历年常考点试题专练附带答案详解
- 《小学数学教学设计》小学教育专业全套教学课件
- 高中政治集体备课课件
- 初级户外绳索培训课件
- CJ/T 297-2016桥梁缆索用高密度聚乙烯护套料
评论
0/150
提交评论