p part i overview t i o i
play

P Part I Overview t I O i C Chapter 2: Operating System - PowerPoint PPT Presentation

P Part I Overview t I O i C Chapter 2: Operating System Structures 2 O i S S 1 Fall 2010 Operating System Services Operating System Services User Interface ( e.g ., command processor shell and GUI Graphical User


  1. P Part I Overview t I O i C Chapter 2: Operating System Structures 2 O i S S 1 Fall 2010

  2. Operating System Services Operating System Services � User Interface ( e.g ., command processor –shell and GUI – Graphical User Interface) and GUI Graphical User Interface) � Program execution � I/O operations I/O operations � File-system manipulation � Communications Communications � Error detection � Resource allocation Resource allocation � Accounting � Protection Protection 2

  3. System Calls System Calls � System calls provide an interface to the services made available by an operating system. d il bl b i � Type of system calls: � Process control ( e.g ., create and destroy processes) � File management ( e.g ., open and close files) � Device management ( e.g ., read and write operations) � Information maintenance ( e.g ., get time or date) � Communication ( e.g ., send and receive messages) 3

  4. S S Sys ystem t t em Call C ll M ll Mec echan h anism: i sm: 1/2 1/2 1/2 1/2 register X X syscall 10 syscall 10 syscall service routine parameters Load addr. X Load addr. X syscall 10 4

  5. S stem System stem Call tem Call Call Mechanism all Mechanism Mechanism: echanism 2/2 : 2/2 2/2 2/2 kernel kernel � A system call generates � A system call generates an interrupt, actually a interrupt syscall trap trap . services i handler h dl � The executing program i is suspended. d d mode switch d it h � Control is then transferred to the OS. � Program continues g syscall 10 y when the system call service completes. p 5

  6. System Programs System Programs � File management ( e.g ., create, delete files) � Status management ( e.g ., date/time, available memory and disk space) � File modification ( e.g ., editors) � Programming language support ( e.g ., assemblers, compilers, interpreters) � Program loading and execution ( e.g ., loaders, linkage editors) � Communications ( e.g ., connections between processes, sending/receiving e-mails) 6

  7. Operating Operating System Operating Operating-System System Design System Design Design and Design and and and Implementation: Implementation: 1/5 1/5 � Design Goals � Mechanisms and Polices � Implementation � Implementation 7

  8. Operating Operating System Operating Operating-System System Design System Design Design and Design and and and Implementation: Implementation: 2/5 2/5 � Design Goals � Goals and specifications are affected by hardware and the type of the system ( e.g ., b t h ti batch, time-sharing, real-time, etc) h i l ti t ) � Requirements: user goals and system goals. � User goals: easy of use, reliable, safe, fast � System goals: easy to design, implement and maintain and flexible reliable efficient etc maintain, and flexible, reliable, efficient, etc. � There is no unique way to achieve all goals, and some compromises must be taken and some compromises must be taken. 8

  9. Operating Operating System Operating Operating-System System Design System Design Design and Design and and and Implementation: Im p lementation: 3/5 3/5 � Mechanisms and Policies: 1/2 Mechanisms and Policies: 1/2 � Mechanisms determine how to do something. � Policies determine what will be done. � Policies and mechanisms are usually separated: the separation of mechanism and policy principle . 9

  10. Operating Operating Operating System Operating-System System Design System Design Design and Design and and and Implementation: Implementation: 4/5 4/5 � Mechanisms and Policies: 2/2 � The separation of mechanism and policy: � It is for efficiency purpose. Policies are likely to change over time. � If a more general mechanism is available, the impact � If l h i i il bl h i of changing policy on mechanism is reduced. � Microkernel-based systems implement a basic set of � Microkernel-based systems implement a basic set of building blocks, which are almost policy free. Thus, advanced policies and mechanisms can be added to user-created kernel modules. d k l d l 10

  11. Operating Operating Operating-System Operating System System Design System Design Design and Design and and and Implementation: Implementation: 5/5 5/5 � Implementation � The assembly vs. high-level language issue � Advantages of high-level languages: easy to use and maintain, and more available programming tools i t i d il bl i t l � Disadvantages of high-level languages: slower and more space more space � Many systems were written in both with a small percentage ( e.g ., 10%) of assembly language for percentage ( e.g ., 10%) of assembly language for the most speed demanding low level portion. � Better data structures and algorithms are more � Better data structures and algorithms are more important than tweaking assembly instructions. 11

  12. Operating-System Structures Operating-System Structures � Simple Structure � Layered Approach � Layered Approach � Microkernels � Modules 12

  13. Simple Structure Simple Structure � Simple structure systems MS-DOS structure do not have well-defined structures application programs � Unix only had a limited structure: kernel and resident sys program system programs � Everything between the MS-DOS device drivers system call interface and ROM BIOS device driver ROM BIOS device driver physical hardware is the physical hardware is the kernel. 13

  14. Layered Approach: 1/4 Layered Approach: 1/4 � The operating system is broken up into a number of layers (or levels) each on top of number of layers (or levels), each on top of lower layers. � Each layer is an implementation of an abstract y p object that is the encapsulation of data and operations that can manipulate these data. � The bottom layer (layer 0) is the hardware, and Th b tt l (l 0) i th h d d the highest one is the user interface. � The main advantage of layered approach is � The main advantage of layered approach is modularity . 14

  15. L Layere L ayered Approac d d A pproach: h 2/4 : 2/4 2/4 2/4 � The lowest layer is process � The lowest layer is process management . Users � Each layer only uses the Each layer only uses the operations provided by lower file system ode layers and does not have to y sor mo know their implementation. communication � Each layer hides the y I/O & Device I/O & Device upervis existence of certain data virtual mem structures, operations and su hardware from higher-level process layers. Think about OO. h hardware d 15

  16. La La ered La Layered ered Approach ered Approach Approach Probs Approach Probs Probs: Probs 3/4 : 3/4 3/4 3/4 � It is difficult to organize the system in � It is difficult to organize the system in layers, because a layer can use only layers below it Example: virtual layers below it. Example: virtual memory (lower layer) uses disk I/O (upper layer) (upper layer). � Layered implementations tend to be less efficient than other types. Example: there may be too many calls going down the layers: user to I/O layer to memory layer to process scheduling layer. 16

  17. La La Layered La ered ered Approach ered Approach Approach Probs Approach Probs Probs: Probs 4/4 : 4/4 4/4 4/4 layer n : user interface � The layered approach � The layered approach n may also represented as a set of concentric rings a set of concentric rings. � The first OS based on 1 th l the layered approach d h 0 was THE, developed by E Dijk t E. Dijkstra. 17 layer 0: hardware

  18. Microkernels: Microkernels: 1/5 1/5 � Only absolutely essential core OS functions should be in the kernel. � Less essential services and applications are built on the kernel and run in user are built on the kernel and run in user mode . � Many functions that were in a traditional � Many functions that were in a traditional OS become external subsystems that interact interact with the kernel and with each ith the kernel and ith each other. 18

  19. Microkernels: Microkernels: 2/5 Microkernels: 2/5 Microkernels: 2/5 2/5 � The main function The main function of the microkernel is virtu pro dev clie to provide to provide ual mem vice dri ent pro file serv f cess ser communication facility between the facility between the ocess mory ivers ver rver client programs and various services. various services. � Communication is provided by provided by microkernel message passing. hardware hardware 19

  20. Mi Mi Micro Mi crokerne k ernels: l s: 3/5 3/5 3/5 3/5 � Uniform interfaces: message passing � Uniform interfaces: message passing � Extensibility: adding new services is easy � Flexibility: existing services can be taken out i i i i i i easily to produce a smaller and more efficient implementation implementation � Portability: all or at least most of the processor specific code is in the small kernel specific code is in the small kernel. � Reliability: A small and modular designed kernel can be tested easily kernel can be tested easily � Distributed system support: client and service processes can run on networked systems processes can run on networked systems. 20

Recommend


More recommend