版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、1OPERATING SYSTEMS2TextbookModern Operating Systems, Andrew S.Tanenbaum, Prentice Happ, Third Edition, 2009.11 ReferencesAbraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating system concepts (7th Edition),高等教育出版社,2007年3月(中文翻譯版2010年1月)William Stallings著,陳向群、陳渝等譯,操作系統(tǒng): 精髓與設(shè)計原理(原書第6版),機械工業(yè)出版社,
2、2010年9月 3Course requirementFinal exam: 70%Homework: 10%Experiments: 20% (Linux)Course design (1 credit)4Introduction (chapter 1)Processes and Threads (chapter 2)Deadlocks (chapter 6)Memory management (chapter 3)File Systems (chapter 4) Input /Output (chapter 5)Content of this book5Chapter 1 Introduc
3、tion1.1 What is an operating system1.2 History of operating systems1.3 Computer hardware review1.4 The operating system zoo1.5 Operating system concepts1.6 System calls1.7 Operating system structure61.1 Where?A computer system consists ofHardwareSoftware7What is OS?It is an extended machine (top-dow
4、n)Hides the messy details which must be performedPresents user with a virtual machine, easier to use8What is OS?It is a resource manager (bottom-up)Allow multiple programs to run at the same timeManage and protect memory, I/O devices, and other resourcesIncludes multiplexing (sharing) resources in t
5、wo different ways:In timeIn space91.2 History of Operating SystemsFirst generation 1945 - 1955vacuum tubes真空管, plug boardsSecond generation 1955 - 1965transistors晶體管, batch systemsThird generation 1965 1980ICs and multiprogrammingFourth generation 1980 presentpersonal computers and workstations (Net
6、work operating systems and distributed operating systems)Requirement - development10Vacuum tubes(真空管), handworkmodeUser: operator and programmerMachine languageI/O: plugboard(插接板), punched cards(穿孔卡)characteristicThe user occupy the machine aloneCPU wait the user load and unload the plugboardconflic
7、tCPU (high) - handwork (low) MethodSpecial operator, batch system History of Operating Systems (1)11Transistors(晶體管), batch systemModeUser: operator or programmerLanguage: assembly language, FortranI/O: card, tape- os: Monitor (execute the jobs )- online batch system / off-line batch systemHistory o
8、f Operating Systems (2)12Early off-line 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 output13Structure of a typical FMS job 2nd generationJo
9、b: program, data, job specification14IC, multiprogrammingBatch system: good efficiency, bad interaction. time-sharing system (a variant of multiprogramming):multi users share the computer, each has a online terminal;Allocate CPU by time slice(時間片);quick response time. History of Operating Systems (3
10、)15ModePartition memory into several pieces, with a different job in each partitionParallel in macroscopic Serial in microcosmicHistory of Operating Systems (3)Multiprogramming system three jobs in memory 3rd generation16Fourth generation 1980 PresentLarge scale integration (LSI)Operating systems fo
11、r personal computersCP/M (Control Program for Microcomputers)DOS (Disk Operating System) MS-DOSGUI (Graphical User Interface)Windows Windows 95/98/MeWindows NT Windows 2000 Windows XP Vista Win7 Win8UNIX: X WindowsLinux, GNOME, KDE171.3 Computer Hardware ReviewSome of the components of a simple pers
12、onal computer18Computer Hardware Review (CPU)calculator, controller, registers, cache.Registers: (quick, high price, low capability)data registeraddress registerPC:Program CounterIR:Instruction RegisterPSW:Program Status Word19Process of instructions(a) A three-stage pipeline(b) A superscalar (超標量)
13、CPU20Multithreaded and Multicore ChipsFigure 1-8. (a) A quad-core chip with a shared L2 cache. (b) A quad-core chip with separate L2 caches.21Computer Hardware Review (Memory)A typical memory hierarchyThe numbers shown are rough approximationsCapability, speed, cost22CacheQuestions when dealing with
14、 cache:When to put a new item into the cache.Which cache line to put the new item in.Which item to remove from the cache when a slot is needed.Where to put a newly evicted item in the larger memory.Multi-level cache (2-level or 3-level)23RAMWith two or more programs in main memory at once, two probl
15、ems must be solved:How to protect the programs from one another and the kernel from them all.How to handle relocation.24One base-limit pair and two base-limit pairs25Structure of a disk driveDisk26Computer Hardware Review (I/O)I/O devices generally consist of two parts: a controller and the device i
16、tself.Device driver: the software that talks to a controller, giving it commands and accepting responses.Input and output can be done in three different ways:Program-controlled I/O (Polling)Interrupt-driven I/ODirect Memory Access (DMA)27(a) The steps in starting an I/O device and getting interrupt(
17、b) How the CPU is interrupted(a)(b)28Computer Hardware Review (Buses)The structure of a large Pentium system291.4 The Operating System ZooMainframe operating systemsE.g.: OS/390, zOSServer operating systemsE.g.: Solaris, FreeBSD, Linux, Windows Server 200 xMultiprocessor operating systemsPersonal co
18、mputer operating systemsE.g.: Windows XP, Vista, Macintosh, Linux, FreeBSDHandheld operating systems E.g.: Symbian OS, Palm OS30Embedded operating systemsE.g.: QNX, VxWorksSensor node operating systemsE.g.: Tiny OSReal-time operating systemsHard real-time system: the action absolutely must occur at
19、a certain moment, such as e-Cos.Smart card operating systemsJava Virtual Machine (JVM)311.5 Operating System Concepts (Processes)A process is a program in execution.為了描述和控制進程的運行,系統(tǒng)為每個進程定義了一個數(shù)據(jù)結(jié)構(gòu)進程控制塊PCB (Process Control Block)。所謂系統(tǒng)創(chuàng)建一個進程,就是由系統(tǒng)為某個程序設(shè)置一個PCB,用于對該進程進行控制和管理。進程任務(wù)完成,由系統(tǒng)收回其PCB,該進程便消亡。系統(tǒng)將根據(jù)某
20、PCB而感知相應進程的存在,故說PCB是進程存在的唯一標志。The information about a process (PCB) is stored in an operating system table called the process table.32A process called the command interpreter or shell read commands from a terminal.If a process can create one or more other process (child processes) and these process
21、create child processes, we can build them in a tree structure.In UNIX, there is a parent process for all processes.Operating System Concepts (Processes)33Operating System Concepts (Processes)34Operating System Concepts (Processes)A process treeProcess A created two child processes, B and CProcess B
22、created three child processes, D, E, and F35Operating System Concepts (Processes)Process have many status: running, blocked, ready.Each person authorized to use a system is assigned a UID (User IDentification). A process is assigned a PID (Process IDentification). Users can be members of groups, eac
23、h of which has a GID (Group IDentification).The superuser (root in UNIX) has special privilege to violate many of the protection rules.The communication to cooperate and synchronize processes is called interprocess communication.36Operating System Concepts (Address Spaces & Files)Address Space: a li
24、st of memory allocations from 0 to some maximum, which the process can read and write.In virtual memory the operating system keeps part of the address space in main memory and part on disk.A file system provides users with a nice, clean abstract model of device-independent files.A directory is used
25、to group files together.A path name can specify the location of a file.A root directory is the top of the directory hierarchy. In Unix, / is the root directory.Each process has a current working directory (pwd).37Operating System Concepts (Files)A file system for a university department38Operating S
26、ystem Concepts (Files)If a file access is permitted, the system return small integer called a file descriptor to use in subsequent operations.Two kinds of special files exist in UNIX under the /dev directory: block special files (disks) and character special files (printers, modems).In UNIX the moun
27、ted file system is used to deal with removable media (mount).39Operating System Concepts (Files)Before mounting, The files on the CD-ROM are not accessibleAfter mounting,The files on the CD-ROM are part of the file hierarchy40Operating System Concepts (Files)Two processes connected by a pipeA pipe i
28、s a sort of pseudofile that can be used to connect two processes.41Operating System Concepts (Protection & Shell)Files in UNIX are protected by a 9-bit binary protection code.The protection code consists of three 3-bit fields, one for owner, one for group, and one for others.Each field has a bit for
29、 read, a bit for write, and a bit for execute. They are known as rwx bits.The UNIX command interpreter is called the shell.Many shells exist, including sh, csh, ksh, and bash.The user can use to redirect the standard input and output. The ampersand (&) can be put after a command to start it as a bac
30、kground job.42Operating System Concepts (Protection & Shell)431. 6 System CallsSystem calls provide the interface between a running program and the operating system.Process managementFile managementDirectory or Device managementMiscellaneousInformation maintenanceCommunications44Steps in Making a Sy
31、stem Call There are 11 steps in making the system call read (fd, buffer, nbytes)45Some System Calls For Process Management46System Calls for ProcessFork creates a duplicate of the original process.UNIX examples fork system call creates new process.execve system call used after a fork to replace the
32、process memory space with a new program.waitpid system call used to move the parent process off the ready queue until the termination of the child.Exit system call is used when a process is finished executing.47System Calls (Process)A stripped down shell:48Forking Processes/* fork processes */main()
33、 int i, pid; for (i=1; i=3; i+) if (pid = fork() = 0) printf(In child %d. n, i); 49Forking ProcessesPI = 1I = 2I = 3I = 3I = 3I = 3I = 250Some System Calls For File Management51Some System Calls For Directory Management52System Calls (Linking)link(“/usr/jim/memo”, “/usr/ast/note”);(a) Two directorie
34、s before linking /usr/jim/memo to asts directory(b) The same directories after linking53System Calls (Mounting)mount(“/dev/fd0”, “/mnt”, 0)(a) File system before the mount(b) File system after the mount54Some System Calls For Miscellaneous Tasks55System Calls (Win32 API)The Win32 API calls that roug
35、hly correspond to the UNIX calls of Fig. 1-18.561.7 Operating System StructureMonolithic System - the big mess. All operating system operations are put into a single file. The operating system is a collection of procedures, each of which can call any of the others.Layered SystemThe operating system
36、is organized as a hierarchy of layers of processesClient-server model or microkernelmicro-kernel and service processes.The operating system is collection of servers that provide specific services; e.g., file server, etc.Virtual Machine57Operating System Structure (Monolithic)Monolithic systems basic structure:A main program that invoke
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中國童話課件教學課件
- 眉毛設(shè)計課件教學課件
- 2024大型港口碼頭排水合同
- 2024年度技術(shù)轉(zhuǎn)讓合同:技術(shù)資料交付與技術(shù)支持期限
- 2024定制家具合同范本
- 2024義齒加工商與牙科診所之間的定制金屬義齒合同
- 2024崗位聘用合同不續(xù)簽崗位聘用合同
- 2024年度餐廳食材供應商采購合同
- 骨科課件介紹教學課件
- 2024年婚禮車輛租賃特別合同
- MOOC 全球化與中國文化-西南交通大學 中國大學慕課答案
- 攤位布局規(guī)劃方案
- 注塑工藝損耗率
- 鋼結(jié)構(gòu)漏雨維修方案
- (含附件)ktv承包協(xié)議書模板-2024
- (高清版)DZT 0289-2015 區(qū)域生態(tài)地球化學評價規(guī)范
- 2024年強基計劃解讀 課件-2024屆高三下學期主題班會
- 我國區(qū)域經(jīng)濟發(fā)展戰(zhàn)略(二)
- 合肥新站集貿(mào)市場規(guī)劃方案
- 城市道路橋梁工程施工質(zhì)量驗收規(guī)范 DG-TJ08-2152-2014
- 銷售部職能說明樣本
評論
0/150
提交評論