the mach system abraham silberschatz, peter baer galvin, greg gagne presentation by: agnimitra roy

19
The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Upload: loraine-hardy

Post on 05-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg

Gagne

Presentation By: Agnimitra Roy

Page 2: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Agenda Microkernel – What is it? What is Mach? Design Goals Mach Primitives (2 slides) Key Mach Characteristics Support for Higher Level OS Functionality

Process Management Inter-process Communication (3 slides) Memory Management (2 slides)

Access by Applications System Calls

Summary

Page 3: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Microkernel – What is it? Highly modular collection of OS-neutral abstractions

Modularity enables scalability, extensibility, and portability not typically found in monolithic or conventional operating systems

Moves many OS services into "user space" that on other operating systems are kept in the kernel

TH Trap Handler

UNIX System CallInterface

Microkernel SystemCall Interface

Privileged Mode

Non Privileged Mode Hardware

Microkernel

Microkernel Based OS

TH

User Programs

IPC

Hardware

User Programs

Monolithic OS

TH

OperatingSystem

Page 4: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Microkernel – Advantages & Disadvantages Advantages

Robustness – Services can be started independently Security – Services run as lower level user processes

have restricted access to system resources Configurability – Can change service without restarting

system Easier Coding – Easier to write user mode code Lower memory footprint – user mode service code can

be moved out of memory Near real time performance – interrupts turned off in

kernel mode – less code in kernel implies less “interrupts are interrupted”

Disadvantages Most microkernels are not tiny, despite the name Need formalized message-passing mechanisms to be

used New kinds of deadlocks and other error conditions are

possible between system components

Page 5: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

What is Mach? Earliest example of microkernel

Simple abstraction over the hardware Set of primitives to implement minimal OS

services Design Vision

OS will ultimately consist of minimal kernel that runs in privileged mode

Supported by larger collection of OS servers (modules) that runs in non-privileged mode

Microkernel is protected from all server modules, which are protected from each other

Page 6: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Design Goals Simple kernel with few extensible abstractions Support diverse architecture – uni-processor &

multiprocessor Network speed independence Support distributed operation Integrated memory management & inter-

process communication Simple API Portability Full compatibility with UNIX BSD

Page 7: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Mach Primitives Task

Execution environment supporting basic resource allocation Set of resources that enable "threads" to run

Thread Unit of execution – runs in the context of task Single unit of code running on a processor

Port Object reference mechanism Secure pipe for IPC between tasks Operations on objects are requested by sending messages

to ports Port Set

Group of ports sharing message queue Message

Method of communication between threads Passed between tasks on ports

Memory Object Source of memory

Page 8: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Mach Primitives (contd.)

Page 9: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Key Mach Characteristics Blends memory and inter-process communication features Each server module contained in its own address space

called Task Server modules support parallelism

Within themselves – using threads Across modules – using micro-kernel system calls

Supports message passing primitives Lower level than RPC Can be used in combination to build RPC – not as efficient as

optimized RPC Primitives include send, recv, message queues etc

Passes messages by moving memory pointers to shared memory objects where possible – avoids object copy

Uses virtual memory re-mapping to transfer large messages – also known as virtual copy or copy-on-write.

Memory management is based on the use of memory objects

Memory objects may reside on remote systems and accessed transparently

Page 10: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Process Management (1/1)

Task primitive is equivalent to traditional process without instruction pointer or register set

Task by itself does nothing unless threads execute on it Threads can be in two states

Running Suspended

Provides thread synchronization primitives C threads package provides low level, flexible C

routines for process management CPU Scheduling enabled via 32 global run queues with

locking facility Varies size of time quantum inversely with number of

threads Supports two granularities for exception handling

Per thread Per task

Page 11: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Inter-process Communication (1/3)

Components: Ports & Messages Depends on ports & messages for

communication Delivers location independence Delivers secure communication

Security ensured with rights (port name + capability) for senders and receivers

Page 12: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Interprocess Communication (2/3) Ports, Messages, NetMsg Server Ports

Protected, bounded queue in the kernel where objects reside

Enables one thread to send data to another Several ports created by kernel when a task or

thread is created Can be collected into port sets

Messages Header (destination port + reply port + message

length) + Typed data objects (variable count) Inline Data: Mach 3 – No limit; Mach 2.5 < 8KB Message passing to Receiver

On same computer: virtual memory management using pointers

On different computers: NetMsgServer

Page 13: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Interprocess Communication (3/3) Ports, Messages, NetMsg Server

NetMsgServer Location transparent naming & transport to

extend IPC across multiple computers Maintains distributed database for port rights Uses type information stored in messages to

translate data from sender’s to receiver’s format

Synchronization Port can be used as synchronization variable Can be used for threads in same task – not

among different tasks

Page 14: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Memory Management (1/2) Memory Object

Principle abstraction in Mach Used to manage secondary storage;

represents files, pipes or other data mapped into VM for read & write

Backed by user level memory managers Virtual address space for task is

generally sparse Maintains cache of memory resident

pages of all mapped objects Can use user level memory managers

However, supports a default memory manager

Page 15: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Memory Management (2/2) Shared Memory

Mach uses shared memory to reduce complexity of system services

Supports consistent shared memory for tasks running on processors that share memory

Tasks # Shared memory OS constructs such as fork Parent tasks can declare which regions of

memory can be inherited by children No copy-on-write inheritance

External memory managers Handles shared read-write from different

machines willing to share memory

Page 16: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Programmer Interface System Call flow

Traps to the kernel Upcalls into emulation library Switch to thread waiting on a port Returns to emulation library Returns from trap

Calls are slower compared to traditional systems Handling single system call might involve

several IPC exchanges Each IPC exchange requires trap to kernel &

various scheduler overheads

Page 17: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Summary Satisfies critical goals

Can execute UNIX executables Supports many memory models + parallel &

distributed computing Extensible kernel

Supports multiprocessing & parallel execution Multiple threads of execution within one task

Complete & efficient security mechanisms Messages are the only communication methods

Integrates messages with virtual memory system

Reduced size of kernel – but allows user level emulation

Page 18: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

Backup

Page 19: The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy

History of Mach Traces root to Accent developed at CMU

Pioneered several OS concepts Unable to execute UNIX applications Difficult to port – tied to HW architecture

Initially developed inside 4.2 BSD kernel Evolved further with 4.3 BSD release

Mach 2 capabilities made kernel size larger Mach 3 moved BSB code outside of kernel

Resulted in smaller microkernel Only basic Mach features in kernel – UNIX code evicted Allowed execution of multiple OS on top of microkernel

In 1989 OSF used Mach as basis for new OS OSF/1

Mach research continues at CMU and OSF