290 likes | 501 Views
THE MACH SYSTEM. "Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne Presentation by Betsy Kavali. Mach is a Microkernel OS Picture from Wikipedia. History of Mach. Derived its communication system and philosophy from Accent.
E N D
THE MACH SYSTEM "Operating Systems Concepts, Sixth Edition" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne Presentation by Betsy Kavali
History of Mach Derived its communication system and philosophy from Accent. BSD Unix support Originally constructed inside 4.2BSD kernel. Replaced one piece at a time. Started with an effort to support multiprocessors.
Goals of Mach Support diverse architectures - UMA, NUMA, NORMA Simplified kernel structure Compatibility with UNIX, Ease of use. Integrate memory management and IPC Distributed Operation and Varying network speed Heterogeneous System support. Object-oriented design
System Components Task Thread Port Port set Message Memory object message text region threads port task port set data region secondary storage memory object
System Components Task: Execution environment Contains one or more threads Provides a protection domain, a protected access to system resources via ports Thread: unit of computation (execution) must run in the context of a task all threads in a task share ports, memory, etc. process = task + thread
System Components Port: Kernel protected communication channel. Mechanism to reference an object. Port set: Group of ports sharing a common message queue Message: Basic method of communication between threads in different tasks. Memory objects: storage unit, Map all or part of object into address space They are accessed by tasks using ports
Process Management Tasks Parent task creates children tasks New Tasks contain one thread initially. Suspending a task, suspends threads in the task. Threads Suspending/resuming a thread does not suspend/resume the task. Threads share the address space of the task , hence the need for synchronization
Process Management - Threads User Level Threads Mach provides a basic kernel interface for managing threads C threads package is built on top of Mach's primitives. Influenced POSIX P threads standard.
Process Management - Threads Thread control routines : Create : give function to execute and its parameters Destroy : Destroys the thread and returns a value to the creating thread. Wait : for a specific thread to terminate then continue the calling thread Yield : Thread yields use of a processor.
Process Management - Threads Mutual Exclusion using spin locks. Mutual exclusion Routines are: Mutex_lock, mutex_unlock, mutex_alloc, mutex_free. Synchronization through condition variables(wait, signal), the associated routines are: Condition_alloc, condition_free
CPU Scheduler Only threads are scheduled, tasks are ignored. Each thread will have a priority number(0 -127) Dynamic thread priority - The lowest priority thread is the one with the most recent large CPU usage. Global run queues + per processor local run queues Processors consult run queues to select next thread: the local queue first, then the global queue Thread time quantum varies inversely with total number of threads
Exception Handling The exception handler is just another thread in the task. RPC messages: synchronize & communicate between victim and handler. Two different granularities of exception handling. Error Handlers: Perform recovery actions in response to an exception and resume execution of the thread. Debuggers: Examine the state of an entire application to investigate why an exception occurred and/or why the program is misbehaving.
Exception handling proceeds as follows. Victim: raise – RPC message sent to the handler. Victim: wait -- synchronize with completion of exception handling. 3. Handler: catch -- receive notification, identifies the exception and the victim 4. Handler: take actions • clear -- clear exception causing victim to return from wait. • terminate -- cause termination of victim thread.
InterProcess Communication - IPC Location Independent IPC The two components of IPC are Ports Messages Ports : Protected bounded queue within the kernel Capability: send or receive ``right‘’
InterProcess Communication - IPC System calls for port functionality. Allocate: new port in a task(task decides the rights of the port) Deallocate: revoke tasks access rights to a port. Get current port status. Create a back up port -port sets : Useful when one thread has to service requests coming on multiple ports.
InterProcess Communication - IPC Messages : Header + one or more typed data objects Header : contains destination port name, reply port name, message length In-line message data : typed data, port rights Out-of-line data: pointers to data
InterProcess Communication - IPC NetMsgServer Used when receiver port is not on the kernel’s computer User-level daemon that forwards messages between hosts Provides Name Service Primitive -Allows tasks networkwideto register ports for lookup It is protocol independent.
Memory Management. Memory Object: Mach's basic abstraction of physical memory, an object. Secondary storage or data that are mapped into virtual-memory (Files, pipes) Served by user-Level memory managers.
Memory management User-Level memory manager - Memory can be paged by user-written memory managers Mach has no knowledge of memory object contents. Default memory manager - Used in circumstances when there is no local manager.
Blend of Memory and IPC This is an unique feature of Mach, and key to the system's efficiency. Memory management using IPC. A memory object is represented as a port. To request operations on this object, IPC messages are sent to this port. Because IPC is used, memory object may reside on remote systems, Kernel caches the contents.
Blend of Memory and IPC IPC using memory management techniques: Here messages are passed by moving pointers to shared-memory objects. Virtual-memory remapping to transfer large contents using virtual copy / copy-on-write techniques
Virtual copy/ copy on write http://www.sci.csuhayward.edu/~billard/cs4560/node23.html
Programmer Interface System-call level:Implemented via emulation libraries and servers C Threads package: C language interface to Mach threads primitives Not suitable for NORMA systems Interface/Stub generator (MIG): Input = Interface definition (declarations of variables, types & procedures) Output = RPC interface code
Conclusion Micro kernel Few simple abstractions Higher level OS functionality built in user level servers Focus on communication facilities Mach pioneered many concepts.