《【大学课件】 电机资讯工程实习 个人电脑系统英文版.ppt》由会员分享,可在线阅读,更多相关《【大学课件】 电机资讯工程实习 个人电脑系统英文版.ppt(39页珍藏版)》请在三一办公上搜索。
1、1,EE110300 電機資訊工程實習Lecture 3 個人電腦系統 II-Operating Systems,http:/,2,What is an operating system?Definition,An operating system is the“permanent”software that controls/abstracts hardwareUser applications can thus be simpler and device-independent,physical machine interface,User Applications,Operating S
2、ystem,Architecture,virtual machine interface,3,What is an operating system?Definition(cont),Manages resources and processes to support different user applicationsProvides Applications Programming Interface(API)for user applications,User Application,Operating System,Architecture,User Application,4,Mo
3、dern operating systems,x86 platformLinuxWindowsMac platform Mac OSSun Solaris&Unix(Sun workstations)IBM AIX(mainframes)Embedded systems(special-purpose OS)Palm,PocketPC,etcXbox,etc,5,Linus Torvalds,1991,Finland,Linux Project1992,Linux Kernel 0.02Bash v1.08GCC v1.401997,Moves to Transmeta1998,Linux K
4、ernel v2.22001,Linux Kernel v2.4Pronunciation:“Linn-ucks”,6,Windows 2000&XP,1989:10 developers left DEC VMS team and joined Microsoft Windows NT 1.01996:Windows NT 4.01999:Windows 20002001:Windows XP2002:Microsoft.Net Server,7,Linux vs.Windows NT,Linux is kernel only,free and open sourceWindows is f
5、ull-loaded OS and pricyLinux requires minimum HW,Windows notWeb server(Win2K+SWC)beats(Linux+TUX)File server&printer serverWindows supports a wider range of HWLinux has more stable drivers,8,Operating System Interfaces,http:/,9,Software&hardware layer,User Program,Executable Binary,Compiler,Linker,S
6、ystem library,Architecture,user,compiler,OS interface,OS,Hardware,device drivers,Operating System,kernel,user mode,10,Device Driver,Device driver的唯一目的就是要將所有的硬體隱藏.他應該是整套軟體中唯一能和硬體溝通的窗口.他能直接讀取或寫入特定裝置控制及狀態暫存器,如果裝置發生中斷,那ISR也要整合到裝置驅動程式.,11,System service call(monitor),C Programs:main()/call printf,provide
7、d/by the C library,to/print on the screenprintf(“Hello World!”);,Borland C library:Int printf()/call SysOutputString,/provided by NT/system library,to/print on the screenSysOutputString();,NT library:Void SysOutputString()/call NtOutputString,that in turn will call/video card driver to output string
8、s to/the screenNtOutputString();,12,System service call(disk),C Programs:main()/call CreateFile/by the C library,to/create a file on diskCreateFile(“a.txt”),Borland C library:Int CreateFile()/call NtCreateFile,/provided by NT to/create a fileNtCreateFile();,NT library:Void NtCreateFile()/call NtInte
9、rnalCreateFile,that in turn will/call the file system driver and the disk/driver to create a file on a disk NtInternalCreateFile();,13,System service calls(network),C Programs:main()so=createsocket();send(so,“text”);close(so);,Borland C library:int createsocket()NtCreateSocket();int send()NtSocketSe
10、nd();,NT library:Void NtCreateSocket()NtAfdCreateSocket();,14,15,Virtual computer concept,C+compiler,FORTRAN compiler,C compiler,Java compiler,Assembler,OperatingSystemCommandinterpreter,LISP interpreter,Operating system,Macroinstruction interpreter,Bare machine,Virtual CComputer,Virtual C+Computer,
11、16,Importance of operating system,System API are the only interface between user applications and hardwareAPI are designed for general-purpose,not performance driven(work applications)OS code cannot allow any bugAny break(e.g.invalid access)causes rebootThe owner of OS technology controls the softwa
12、re industry,17,What is Embedded System?,是電腦軟體與硬體的綜合體,亦可涵蓋機械或其他附屬裝置;整個綜合體設計的目的,在於滿足某種特殊功能.例如:PDA,遊樂器,衛星導航系統,流程管理器 等.,http:/,18,Embedded system architecture,3-layered devicePalm,PocketPC,User Applications,Embedded OS,Hardware,2-layered deviceXBox,Hardware,Application,19,General-purpose&embedded OS,20,
13、Operating system concepts,http:/,21,Process&Thread,How do different applications run on the same machine at the same time without interfering each other?Protection between processesProtection between a process and the OSProcess:an execution of a program,consisting of a virtual address space,one or m
14、ore threads,and some OS states.,22,Virtual memory(address space),virtual address space(4GB),page 0,page 1,page 2,page 220,physical memory(16MB),pp 0,pp 1,pp 2,pp N,paging file,pp 212,x,23,Virtual memory(address space),virtual address space(4GB),page 0,page 1,page 2,page 220,physical memory(16MB),pp
15、0,pp 1,pp 2,pp N,paging file,pp 212,24,Memory manager,physical memory,pp 0,pp 1,pp 2,pp N,paging file,pp 212,process VA,process VA,PT,PT,25,Memory manager,physical memory,pp 0,pp 1,pp 2,pp N,paging file,pp 212,process VA,process VA,PT,PT,26,Memory manager(w/constraint),physical memory,pp 0,pp 1,pp 2
16、,pp N,paging file,pp 212,process VA,process VA,PT,PT,x,memory manager,27,Protectiondual mode operation,Can application modify its own page table?If it could,could get access to all physical memory.Dual ModeKernel/protected model:no restriction,can touch any physical memory pageUser mode:where you pr
17、ogram runs,can only touch part of the virtual address spaceApplications can enter the kernel mode through systems calls(traps),28,Mode change:system call trap,1.System call traps to the kernel(kernel mode)2.Kernel determines service routine required3.Kernel services the call.4.Control is returned to
18、 user program(user mode),29,Thread,A process starts with one thread(main thread),and can initialize more threads by CreateThread()callsA thread represents an execution stream of instructions and its CPU register contextA thread is the unit used in the schedulerKill a process kill its all threads,30,
19、Scheduler,A component in OS that decides which thread in the thread pool gets the CPUPriority-based schedulerContext switch,new thread,terminatingthreads,signalevents,31,Synchronization,All threads in the same process share all global dataSynchronization among these threads is necessary to maintain
20、data integrityResource lock is commonly used to guarantee thread mutual exclusiveabuse of such locks decreases scalabilityignorance of such locks decreases stabilityDeadlock issues,32,File Systems,A hard disk is just a raw media storageA hard disk device driver allows OS to communicate with the hard
21、wareBut,it is the responsibility of the OS to organize disk sectors/tracks for storing filessuch component is called the file systemE.g.A hard disk that stores NTFS information cannot be read with the FAT32 driverexample:paper with Moses code,33,Operating Systems and System Software,Example:web serv
22、er software,http:/,34,User-mode web server architecture,User Mode,Kernel Mode,I/O module,35,User-mode web server commons,User-mode application architecturee.g.Microsoft Internet Information Server(IIS),Netscape Enterprise Server,Apache HTTP Server,etc.Dependent on generally system APIStand-alone web
23、 content cache limited by virtual address spaceTime-to-live cache replacement algorithmMemory-less dynamic code execution,36,SWC web server architecture,User Mode,Kernel Mode,network card+,System Cache,miss,37,SPECWEB99 Performance,*estimated scaling data,38,Kernel vs.user-based web server,Increase peak capacity by five timesWeb cache size be limited by physical memory sizeWeb cache be shared by both static&dynamic web requestsRemove I/O overhead and Socket creationFast TCPIP data transmission,39,Summary,A.D.1492 Columbus discovers America-The new and free land is on your grip!,