CSE 120 Principles of Operating Systems Fall 2002 Lecture 15 Structure Geoffrey M Voelker Structure z z We have talked about the major modules that comprise an operating system Today we will discuss different ways to compose them November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 2 1 The Challenge of Structure z z It is clear what modules an OS should provide Not so clear how to hook them together well Command Interpreter Process Management File System Memory Management Protection Secondary Storage November 26 2002 I O Subsystem Accounting CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 3 OS Structure z z An OS consists of all of the above modules others we haven t discussed system programs privileged and non privileged etc The challenge X X X z How do we organize it all What are the modules where do they exist How do they cooperate How do we build a complex software system that is X X X X Large and complex Concurrent Long lived and evolving Performance critical November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 4 2 Monolithic Kernels z Traditionally OSes such as Unix are built as a monolithic kernel BSD SYSV Solaris Linux etc User Programs Everything OS Kernel Hardware November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 5 Monolithic Problems z Monolithic kernels have one great feature X z The overhead of inter module interaction is low Monolithic kernels have a number of problems X X X X Hard to understand Hard to modify Hard to maintain Unreliable a bug in one module can take down entire system Memory corruption bugs in Nachos z From the beginning OS designers have sought ways to organize the OS to simplify design and construction November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 6 3 Layering z An early approach is layering X X X z Each system service is a layer Each layer defines and implements an abstraction for the layer above it Layers in effect virtualize the layer below Approach first used by Dijkstra s THE system 1968 X Analogous to protocol layers in networking stacks November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 7 THE System z Levels see a virtual machine provided by lower level X X X X X z System composed of a set of sequential processes X z Level 1 CPU scheduling Level 2 memory management sees virtual processors Level 3 console sees VM segments Level 4 device buffers sees a virtual console Level 5 user programs sees virtual I O drivers Processes communicate via synchronization in memory Key Each layer could be tested and verified independently November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 8 4 Layering Problems z Layered systems are hierarchical but real systems have much more complex interactions X X X z z Layering not flexible enough Can have poor performance X z File system requires VM services data structures buffers VM requires file system services backing store What do you do Depends on how layers interact Systems often modeled as layered structures but not built as such November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 9 Microkernel Structure z z Microkernel structures were hot in late 80s early 90s Minimize kernel services implement remaining OS modules as user level processes X X X z But mediocre performance X z z Better reliability file system dies restart it Easier to extend and customize start a new process Support multiple coexisting OS implementations Overhead of inter module interaction is high c f monolithic First microkernel system was Hydra CMU 1970 Others Mach CMU Chorus NT November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 10 5 Microkernel Structure User Programs User Mode H L Scheduling Kernel Mode File System Network Processes External Pager Communication CPU scheduling Low level VM Protection OS Modules Microkernel Hardware November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 11 Windows NT 3 1 1993 User Programs User Mode Security OS 2 Posix Win32 Kernel Mode Object Manager Security Processes Virtual Memory Local Proc Call I O Protected Subsystems NT Executive Kernel Services Hardware Abstraction Layer HAL Hardware November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 12 6 Single Address Space OS z z A single address space OS has the operating system and all applications in the same address space Three examples X X X z Benefits X z MS DOS and early MacOS 80s early 90s Pilot Xerox PARC in late 70s Opal Univ of Washington in early 90s Low overhead interaction between user programs and kernel The key question is protection X How do we protect kernel from apps apps from each other November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 13 Protection in SASs z No protection MS DOS and MacOS X z Apps can take down the machine Language support Pilot X Pilot relied upon language support for memory protection Mesa think precursor to Java X X A single user operating system for an early PC prototype Assumption was that all code OS and applications was owned by the same user Subverting the OS only subverts yourself X Simplified policies and app OS interaction November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 14 7 Protection in SASs 2 z Hardware support Opal X Separate naming from protection in address spaces Standard ASs provide both but do not have to X X Single address space partitioned into protection domains Processes require capabilities to execute within a domain Think large unforgeable key checked on every memory op z Why do this X Easy to share and persist complex data structures Every process can use the same pointers Even save them on disk and restore them without modification X Want names addresses to be persistent Across space machines in a cluster and time never reused Requires large address spaces 64 bit or larger November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M Voelker 15 Extensible OSs z Extensible operating systems make it easy to extend operating system functionality X X X z z New features better performance Customize the operating system for the application Think packet filters writ large Two recent projects Spin and Exokernel mid 90s Spin UW X X X Applications install extensions into the OS code and data Use safe language for extensions Modula 3 Pascal Mesa Easy to do I O redirection inside kernel Network to disk disk to screen November 26 2002 CSE 120 Lecture 15 Structure 2002 Geoffrey M
View Full Document
Unlocking...