* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download ppt
Survey
Document related concepts
Transcript
The Mach System Presented by Catherine Vilhauer CS533 - Concepts of Operating Systems 1 What is Mach? First Generation micro-kernel Builds operating system above minimal kernel Kernel provides only fundamental services These services basic but powerful enough to be used on wide range of architectures Aids distributed computing and multiprocessing CS533 - Concepts of Operating Systems 2 Design Principles: Based on BSD Unix Advantages of BSD Unix o o o o Simple programmer interface Easy portability Extensive library Combine utilities via pipes Disadvantages o o o Redundant features in kernel Lack of support for multi-processing Too many fundamental abstractions to choose from CS533 - Concepts of Operating Systems 3 Mach Goals Support diverse architectures o With varying degrees of shared memory Function with varying intercomputer network speeds Simplified kernel structure Distributed operation Integrated memory management and IPC Heterogenous system support CS533 - Concepts of Operating Systems 4 How Mach Works BSD Unix Tasks and Threads Another OS IPC Windows Virtual Memory Maybe another OS Database System Scheduling Software Emulation Layer Microkernel MACH CS533 - Concepts of Operating Systems 5 Mach: Basic Abstractions Task: execution environment o virtual address space o protected access to system resources via ports o may contain one or more threads Thread: basic unit of execution o must run in context of a task Port: basic object reference mechanism o o kernel-protected communication channel protected by port rights Port Set: group of ports sharing common message queue Message: basic method of communication Memory Object: source of memory o May be managed by external memory manager CS533 - Concepts of Operating Systems 6 Mach’s Basic Abstractions Text Region Port Program counter Task Message Data Region Port Set Secondary Storage CS533 - Concepts of Operating Systems 7 Key Features of the Mach System Blending of memory management and communication o Memory management • • • • • o based on use of memory objects Memory object represented by port IPC messages sent to request operations (pagein / pageout) Because IPC used, memory objects can live on remote systems Kernel caches contents of memory objects in local memory Communication • • • • Message-based kernel so message handling must be efficient Uses virtual memory remapping (large messages) Message transfer modifies receiving task’s address space to include a copy of the message contents Copy on Write CS533 - Concepts of Operating Systems 8 Advantages of Mach Approach Increased flexibility in memory management to user programs Greater generality Improved performance over Unix message passing Easier task migration o o Since ports are location independent, a task and all its ports can be moved from one machine to the other All tasks previously communictated with the moved task can continue to do so because they reference a task by only its ports and communicate via messages CS533 - Concepts of Operating Systems 9 Process Management Tasks main execution environment Can contain no or many kernel-supported threads Thread synchronization minimal but sufficient o Threads synchronized via IPC • • • • o Messages used to queue requests for resources Thread receives message if resource available To return resource thread can send a message to the port Equivalent to send and receive Suspend count kept for thread - multiple suspend calls on a thread but only when an equal number of resume calls made can it wake up Cthreads CS533 - Concepts of Operating Systems 10 CPU Scheduling Only threads scheduled (not tasks) Priority scheduling Run-queues o o No central dispatcher o o 32 global run-queues, searched in priority order Per-processor run-queues for threads bound to individual processor When idle each processor consults run queues Local run queue has absolute priority No fixed-length quantum o Varies inversely with number of threads on system CS533 - Concepts of Operating Systems 11 Interprocess Communication Two components to Mach IPC o Objects addressed by communications ports o PORTS and MESSAGES Allows location independence and security of communication Security established by means of ‘rights’ o o o ‘Right’ = port name and capability (send / receive) on that port Only one task with ‘receive’ rights Many with ‘send’ rights CS533 - Concepts of Operating Systems 12 Interprocess Communication Ports o Port sets - a collection of ports. o Protected, bounded queue within kernel Useful if one thread is to service requests on multiple ports Messages o o o o o Fixed-length header (destination and reply port, msg length) Variable number of typed data objects Data (in-line data) sent in message or as pointer Pointers allow transfer of task address space in one message No copying if on same system! Copy-on-write. CS533 - Concepts of Operating Systems 13 Interprocess Communication Need way to extend IPC across multiple computers NetMsgServer o o o o Mach’s kernel IPC transfers message to NetMsgServer NetMsgServer then uses network protocol to transfer NetMsgServer on receiving computer uses that kernel’s IPC to send message to correct destination task. Uses type info in message to transfer data to heterogenous machines in understandable way Alternative in form of NORMA CS533 - Concepts of Operating Systems 14 Memory Management Memory Object principle abstraction o o o Used to manage secondary storage Represent files, pipes and other data mapped into virtual memory Instead of traditional approach where kernel provides management of secondary storage Mach treats it like all other objects CS533 - Concepts of Operating Systems 15 Memory Management (cont’d.) Mach virtual address space sparse No regular page table o o Less memory storage required Simpler address-space maintenance User-level memory managers can be used instead CS533 - Concepts of Operating Systems 16 User-Level Memory Managers Mach takes care of basics only o Acts as interface between hardware and user-level • • o o e.g. receives page faults from hardware Notifies relevant task (via port) of page fault Implements pageout policy (FIFO) Supplies default Memory Manager in some cases User-Level Memory Managers o o o Handle majority of memory management - can page memory System calls used to communicate with kernel for memory mapping / page-in / page-out / provide page-level locking Responsible for consistency of the contents of a memory object mapped by tasks on different machines CS533 - Concepts of Operating Systems 17 Shared Memory Shared memory advantages o o o Provides fast IPC Reduces file management overhead Supports multiprocessing and database management Mach supports lean version o o Threads in a task share memory Difficult for separate machines to share memory and maintain data consistency • • Consistent shared memory only supported when tasks share processor - in other cases parent can declare inherited memory to be readable-writable - coordinated through locks For external machines, Mach allows external memory managers CS533 - Concepts of Operating Systems 18 Programmer Interface System calls o o o Equivalent to Unix system call interface How does it do this? With emulation libraries • • o o Live in a read-only part of program’s address space OS calls are translated into subroutine calls Have emulated MS-DOS and Macintosh OS’s Lives in address space of program needing its functionality CS533 - Concepts of Operating Systems 19 Summary Unix can run on top of Mach in ‘User Space’ Uses lightweight processes Supports multiprocessing and parrallel computing Messages as communication method Integration of messages with virtual memory Integration of virtual memory with messages Size of kernel reduced Permits OS emulation at user-level CS533 - Concepts of Operating Systems 20