The Mach System Operating Systems Concepts Sixth Edition

  • Slides: 21
Download presentation
The Mach System "Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin,

The Mach System "Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne Presented by Abdelhalim Ragab Portland State University CS 533 Concepts of Operating Systems

Portland State University - CS 533 Concepts of Operating Systems Microkernel vs. Monolithic Systems

Portland State University - CS 533 Concepts of Operating Systems Microkernel vs. Monolithic Systems Source: http: //en. wikipedia. org/wiki/File: OS-structure. svg

Portland State University - CS 533 Concepts of Operating Systems Mach History n CMU

Portland State University - CS 533 Concepts of Operating Systems Mach History n CMU Accent operating system No ability to execute UNIX applications ¨ Single Hardware architecture ¨ n n BSD Unix system + Accent concepts Mach Open. Step XNU GNU Hurd OSF/1 Darwin Mac OS X

Portland State University - CS 533 Concepts of Operating Systems Design Principles n n

Portland State University - CS 533 Concepts of Operating Systems Design Principles n n Maintain BSD Compatibility Simple programmer interface Easy portability Extensive library of utilities/applications Combine utilities via pipes n n n PLUS Diverse architectures. Varying network speed Simple kernel Distributed operation Integrated memory management and IPC Heterogeneous systems

Portland State University - CS 533 Concepts of Operating Systems System Components message text

Portland State University - CS 533 Concepts of Operating Systems System Components message text region threads port task n n n Task Thread Port set Message Memory object port set data region secondary storage memory object

Portland State University - CS 533 Concepts of Operating Systems Memory Management and IPC

Portland State University - CS 533 Concepts of Operating Systems Memory Management and IPC n Memory Management using IPC: Memory object represented by port(s) ¨ IPC messages are sent to those ports to request operation on the object ¨ Memory objects can be remote kernel caches the contents ¨ n IPC using memory-management techniques: Pass message by moving pointers to shared memory objects ¨ Virtual-memory remapping to transfer large contents ¨ (virtual copy or copy-on-write)

Portland State University - CS 533 Concepts of Operating Systems Process Management Basic Structure

Portland State University - CS 533 Concepts of Operating Systems Process Management Basic Structure n n Tasks/Threads Synchronization primitives: ¨ Mach IPC: n n ¨ Processes exchanging messages at rendezvous points Wait/signal associated with semaphores can be implemented using IPC Thread-level synchronization using thread start/stop calls

Portland State University - CS 533 Concepts of Operating Systems Process Management C Thread

Portland State University - CS 533 Concepts of Operating Systems Process Management C Thread package n n n User-level thread library built on top of Mach primitives Influenced POSIX P Threads standard Thread-control: Create/Destroy a thread ¨ Wait for a specific thread to terminate then continue the calling thread ¨ Yield ¨ n n Mutual exclusion using spinlocks Condition Variables (wait, signal)

Portland State University - CS 533 Concepts of Operating Systems Process Management CPU Scheduler

Portland State University - CS 533 Concepts of Operating Systems Process Management CPU Scheduler n n Only threads are scheduled Dynamic thread priority number (0 – 127) ¨ n n based on the exponential average of its CPU usage. 32 global run queues + per processor local queues (ex. driver thread) No Central dispatcher Processors consult run queues to select next thread ¨ List of idle processors ¨ n Thread time quantum varies inversely with total number of threads, but constant over the entire system

Portland State University - CS 533 Concepts of Operating Systems Process Management Exception Handling

Portland State University - CS 533 Concepts of Operating Systems Process Management Exception Handling n n Implemented via RPC messages Exception handling granularities: Per thread (for error handling) ¨ Per task (for debuggers) ¨ n Emulate BSD style signals Supports execution of BSD programs ¨ Not suitable for multi-threaded environment ¨

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports +

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports + messages n n n Allow location independence + communication security Sender/Receiver must have rights (port name + send or receive capability) Ports: ¨ ¨ Protected bounded queue in the kernel System Calls: n n ¨ Allocate new port in task, give the task all access rights Deallocate task’s access rights to a port Get port status Create backup port Port sets

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports +

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports + messages n Messages: ¨ ¨ ¨ Header + typed data objects Header: destination port name, reply port name, message length In-line data: simple types, port rights Out-of-line data: pointers n Via virtual-memory management n Copy-on-write Sparse virtual memory

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports +

Portland State University - CS 533 Concepts of Operating Systems Interprocess Communication Ports + messages n Net. Msg. Server: user-level capability-based networking daemon ¨ used when receiver port is not on the kernel’s computer ¨ Forward messages between hosts ¨ Provides primitive network-wide name service ¨ n n Mach 3. 0 NORMA IPC Syncronization using IPC: Used in threads in the same task ¨ Port used as synchronization variable ¨ Receive message wait ¨ Send message signal ¨

Portland State University - CS 533 Concepts of Operating Systems Memory Management n Memory

Portland State University - CS 533 Concepts of Operating Systems Memory Management n Memory Object Used to manage secondary storage (files, pipes, …), or data mapped into virtual memory ¨ Backed by user-level memory managers ¨ n n Standard system calls for virtual memory functionality User-level Memory Managers: Memory can be paged by user-written memory managers ¨ No assumption are made by Mach about memory objects contents ¨ Kernel calls to support external memory manager ¨ n Mach default memory manager

Portland State University - CS 533 Concepts of Operating Systems Memory Management Shared memory

Portland State University - CS 533 Concepts of Operating Systems Memory Management Shared memory n Shared memory provides reduced complexity and enhanced performance Fast IPC ¨ Reduced overhead in file management ¨ n Mach provides facilities to maintain memory consistency on different machines

Portland State University - CS 533 Concepts of Operating Systems Programmer Interface n System-call

Portland State University - CS 533 Concepts of Operating Systems Programmer Interface n System-call level Emulation libraries and servers ¨ Upcalls made to libraries in task address space, or server ¨ n C Threads package C language interface to Mach threads primitives ¨ Not suitable for NORMA systems ¨ n Interface/Stub generator (MIG) for RPC calls

Portland State University - CS 533 Concepts of Operating Systems Mach Microkernel summary n

Portland State University - CS 533 Concepts of Operating Systems Mach Microkernel summary n n n Simple kernel abstractions Focus on communication facilities System Calls: IPC ¨ Task/Thread/Port ¨ Virtual memory ¨ Mach 3 NORMA IPC ¨

Portland State University - CS 533 Concepts of Operating Systems Mach Microkernel summary n

Portland State University - CS 533 Concepts of Operating Systems Mach Microkernel summary n User level ¨ servers n n n Memory Managers Net. Msg. Server Net. Mem. Server OS Servers/Emulation libraries ¨ C Threads user-level thread management package ¨

Portland State University - CS 533 Concepts of Operating Systems Questions

Portland State University - CS 533 Concepts of Operating Systems Questions

Portland State University - CS 533 Concepts of Operating Systems Reality n Microkernel vs.

Portland State University - CS 533 Concepts of Operating Systems Reality n Microkernel vs. Monolithic Systems: Linus vs. Tanenbaum famous debate (1992): http: //www. dina. kvl. dk/~abraham/Linus_vs_Tanenbaum. html http: //oreilly. com/catalog/opensources/book/appa. html http: //groups. google. com/group/comp. os. minix/browse_thread/c 25870 d 7 a 41696 d 2 n Again in 2006 n L 3 Microkernel L 4 microkernel family (L 4, L 4 Ka: : Hazelnut, Fiasco, … ) Mac OS X: Although Mac OS X must credit BSD for most of the underlying levels of the operating system, Mac OS X also owes a major debt to Mach. The kernel is heavily influenced in its design philosophy by Carnegie Mellon's Mach project[17]. The kernel is not a pure micro-kernel implementation, since the address space is shared with the BSD portion of the kernel and the I/O Kit. n n http: //www. cs. vu. nl/~ast/reliable-os/ http: //en. wikipedia. org/wiki/Tanenbaum-Torvalds_debate http: //developer. apple. com/technotes/tn 2002/tn 2071. html

Portland State University - CS 533 Concepts of Operating Systems Reality(2) Are Microkernels for

Portland State University - CS 533 Concepts of Operating Systems Reality(2) Are Microkernels for Real n QNX, Integrity, Pike. OS, Symbian, L 4 Linux, Singularity, K 42, Mac OS X, HURD, Coyotos n QNX is widely used in real commercial systems. Cisco's top-of-the-line router uses it, for example, and I can assure you, Cisco cares a **LOT** about performance. One of the leading operating systems in the military and aerospace markets, where reliability is absolutely critical is Green Hills' Integrity, another microkernel. Pike. OS is another microkernel-based real-time system widely used in defense, aerospace, automotive, and industrial applications. Symbian is yet another popular microkernel, primarily used in cell phones. It is not a pure microkernel, however, but something of a hybrid, with drivers in the kernel, but the file system, n n networking, and telephony in user space. L 4 Linux runs all of Linux in user space on top of the L 4 microkernel with a performance loss of only a couple of percent. IBM K 42 HURD Microsoft Singularity Mac OSX and Darwin on L 4 n Source: http: //www. cs. vu. nl/~ast/reliable-os/ n n