Download presentation
Presentation is loading. Please wait.
Published byGarey Carson Modified over 9 years ago
1
THE MACH SYSTEM "Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne, published by J Wiley, 2002. Presented by: Shweta Ojha CS533 Concepts of Operating Systems, Spring 2011
2
OUTLINE Introduction MACH Architecture Motivation System Components Process Management Interprocess Communication Memory Management Programmer Interface Summary
3
Introduction MACH: operating system kernel Microkernel Developed at Carnegie Mellon University Logical successor to Accent kernel Developed as a replacement for the kernel in the BSD version of UNIX Basis of modern operating system kernels Mac OS X GNU Hurd (Source: Wikipedia)
4
What is a Microkernel ? (Source: http://en.wikipedia.org/wiki/File:OS-structure.svg )http://en.wikipedia.org/wiki/File:OS-structure.svg Near minimum amount of software that can provide the following mechanisms needed to implement an OS: low-level address space management thread management inter-process communication (IPC) (Source: Wikipedia)
5
MACH - Architecture BSD code outside the kernel Basic Mach features in the kernel Unix specific code in user mode BSD can be replaced with other OS Concurrently run multiple OS on top of microkernel
6
Motivation Runs on uniprocessors and multiprocessors Capable of functioning on heterogeneous hardware Supports varying degrees of shared memory access: Uniform Memory Access (UMA) Non-Uniform Memory Access (NUMA) No Remote Memory Access (NORMA) Function with varying intercomputer network speeds Supports simultaneous execution of multiple operating systems
7
Motivation Distributed operating providing network transparency to clients Integrated memory management and interprocess communication to provide communication based memory management and for communication of large numbers of data Heterogeneous system support Simple programmer interface with a good set of primitives Easy portability to a wide class of uniprocessors Extensive library of utilities and applications
8
System Components
9
Task: Consists of a virtual address space Contains one or more threads Protected access to system resources via ports Thread: Basic unit of execution Runs in the context of a task Threads within a task share task's resource (ports, memory) Port: Mechanism to reference an object Protected by kernel managed capabilities – port rights Communication by sending messages to ports Port set: Group of ports sharing a common message queue Message: Basic method of communication between threads Memory Object: Source of memory accessed by mapping into task's address space
10
Process Management Basic Structure: Tasks & Threads Create task: Similar to Unix (FORK) Parallelism: 1 Task has multiple threads Threads on parallel processors Faulty thread delayed, others continue Operations: Suspend Task => Suspend all threads Resume Thread ≠> Resume Task Synchronization Primitives: Mach IPC → exchanging messages Thread synchronization calls (start, stop) Semaphores (wait, signal)
11
MACH- Threads User level threads with kernel support C Threads influenced POSIX P Threads standard C Threads package Thread control routine: create destroy wait yield Mutual exclusion through spinlocks: mutex_alloc mutex_free mutex_lock mutex_unlock Synchronization through condition variables: condition_alloc condition_free condition_wait condition_signal
12
CPU Scheduling Only threads are scheduled (not tasks) Thread priority = exponential average of CPU usage Global run queues & per processor (local) run queues Local run queue absolute priority over global run queue Maintains a list of idle processors Constant time quantum over entire system Thread time quantum Ξ 1/ Number of threads Yielding CPU while waiting for resource 1 st Call: Thread ------------------> Scheduler 2 nd Call: Thread moved off the run queue till event Alert: Thread Block
13
Exception Handling Exception Handler = Thread in the task(exception occurred) RPC messages: synchronize & communicate between victim & handler Two granularities of exception handling Error handlers: per-thread handling Debuggers: per-task handling Error handlers have higher precedence over Debuggers Process: Victim Thread Handler RPC message: (exception info, thread, task) Wait routine Clears exception → Resume/Terminate Victim
14
Exception Handling Supports BSD style signals BSD expects hardware exceptions as signals Flow: Hardware Exceptions Exception RPC MACH exception handling In-kernel Task receives Signal Exception causing Thread (Blocked) clears Exception causing Thread (Run) Signal handling code
15
Interprocess Communication Location independent message passing All objects addressed via communications ports Message senders & receivers must have rights Right = port name + capability(send/receive) on that port Only 1 task with receive rights to a port Multiple tasks with send rights Rights passed in messages by object creator/kernel Message Receiver gains rights, Sender loses it Destruction of port/receive right holder → revocation of all rights
16
Component of IPC: Ports Implemented as protected, bounded queue within the kernel of the system on which object resides If a queue is full System calls to provide port functionality: Allocate a new port (port_allocate + task_self) Deallocate a task's access rights to a port Get current status of a task's port Create backup port Port sets: When 1 thread has to service multiple objects Not passed in messages 1 port member of only 1 port set Sender may abortWait for a slot Kernel ask Deliver message
17
Component of IPC: Messages MESSAGE: Header (fixed length) Destination port name Reply port name Length of the message Data Objects (variable length) In-line data (data in message, less than 8K) Pure typed data Port rights Out-of-line data Pointers to data exceeding 8K Transfers entire address space of a task in one message Address map of receiving task is modified to include copy-on-write copy of message pages Note: Message also stores the type information of data!!
18
NetMsgServer User-level, forwards messages between hosts MACH Tenets: All objects are location independent & location is transparent to the user ● Provides Name Service Primitive Allows tasks networkwide to register ports for lookup Transfers 1 st port that allows cross-computer IPC Subsequent IPC interactions are fully transparent ● Maintains a distributed database of ports and port rights ● Uses type information of data Solves the problem of cross-computer data format
19
NetMsgServer Network IPC forwarding
20
Memory Management Memory Objects Manage secondary storage Files/pipes/data mapped into virtual memory Backed by user-level memory managers Has a port associated with it Manipulated by messages being sent to the port Independent of kernel (no knowledge of content) Default Memory Managers Where user-level memory managers are insufficient When user-level fails to pageout Shared Memory Between tasks running on processors that share memory Changes made to the same copy Thread synchronization: critical sections/ mutex Separate Machines → Use External Memory Managers Same external memory manager for unrelated tasks accessing same memory section
21
Memory Management User-level Memory Managers Memory objects mapped into virtual address space of task Maintains cache of memory-resident pages of mapped objects Memory can be paged by user-written memory managers Paging algorithm based on the object it is backing System Calls: vm_map memory_manager_init (routine) memory_object_set_attributes get & set attributes page-level locking memory_object_init memory_object_data_request memory_object_data_provided precious pages memory_object_data_write locking & modification of protection information
22
Programmer Interface System call Interface Emulation libraries (run at user level) OS calls translated to subroutine calls to library Server (run at user level) For system calls that cannot be implemented in library Multithreaded C Threads package Run-time library provides C language interface Provides access to Mach thread primitives Fork, Join Mutex Condition variables MIG Interface / Stub generator Coding send/receive messages Compiler Input = Interface definition (declarations of variables, types & procedures) Output = RPC interface code
23
Summary Micro kernel Operating system emulation at user level Message: only communications method Provides low level system calls Supports many memory models, parallel & distributed computing
24
References Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne, published by J Wiley, 2002. http://en.wikipedia.org/wiki/File:OS-structure.svg
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.