Download presentation
Presentation is loading. Please wait.
1
The Mach System Sri Ramkrishna
2
Background Started at CMU in early 80s Developed on 4.3BSD Unix
Parts of BSD replaced by Mach and moved into user space. Micro kernel built for multiprocessor, scales from 1 to 1000s of processors First generation microkernel Used in Apple’s OSX and NeXT Gnu Hurd is a derivative of Mach
3
Overall Design Has distributed operations
Integrated memory mgmt and IPC Simplified kernel structure Is extensible
4
System Components Object Oriented System
Data and operations on that data is an abstract object. (eg memory) Consists of small basic components that can be changed, if interface is unchanged.
5
Mach Objects These objects are broken down into
Task – provides virtual memory, and protected access using ports for send and receive. Thread which executes inside the task address space Port - message interface which is protected. Essentially, one receive port and many sends. Message – Basic unit of communication Memory Object – basic unit of memory, tasks accesses it by mapping portions of memory into it’s address space.
6
Process Management A task is like a unix process and consists of the task address space and a thread. Tasks have two states, running and suspended. Has kernel supported threads Uses a high level user level threads package. Inspiration for pthreads
7
Scheduling Only threads are scheduled
Does not see tasks at all – reduces complexity by only looking at threads Threads are scheduled by priority Has per processor queues and local run queues in addition to a global queue No central scheduler, but rather each processor checks its local run, per processor and global queues.
8
Exception Handling Exception handler is a separate thread in a task.
RPC is used to communicate exceptions between the originating thread and the handler. Signals support for hardware exceptions is done by an internal kernel task that handles hardware generated exceptions and then signals the faulty thread. Everything else has the same behavior using an emulation library.
9
IPC Most common complaint about microkernels is IPC performance.
Components of Mach’s IPC systems are messages and ports. All communications are between the ports. Security is done by serializing the access to the receive port. Only one task may communicate on the receiving port. Ports are created when you create a task. Ports are implemented as a bounded protected queue. If queue is full, a task has to abort and try again.
10
Messages Fixed length header + typed object
Limited to a 8k pay load (Mach 2.5) Larger messages are broken up Unlimited in Mach 3.0 Larger messages may give a pointer by reference instead. Sending large messages maybe ineffcient Instead of copying, receiving address space is modified to include a copy-on-write copy of the message. A NetMsgServer is used to help lookup where a message needs to go from sender to receiver. Also helps make calls between computers.
11
Synchronization Uses user-level threads library
Has the same features as pthreads with mutexes and semaphores
12
Memory Management Basic object is memory object
Used to manage secondary storage Like any other object, has ports and one can manipulate it using messages. VM is done at the user level by a memory manager Allows easy experimentation of new memory manager algorithms Mach includes a default memory manager. Allows the microkernel to manage it’s own memory Can add your own if you want.
13
User Level Memory Management
Mach has a default memory manager Manages Mach’s memory Uses the standard filesystem for swap instead of a separate swap partition. Mach 3.0 will allow separate swap partition Can be overridden by your own memory manager.
14
Shared Memory Used to reduce complexity of system facilities
Provides fast IPC access Reduces overhead But not used in Mach! Shared memory is not used in a task because all threads share the same memory So no shared memory mechanisms required. Must provide shared memory though for compatibility (like fork)
15
Programmer Interface Most of BSD is in a single thread in the kernel. (also an object) System calls are trapped to this thread as well. Limited efficiency since access is like any other object with a bounded queue. Mach 3.0 allows multiple OS’s through the use of threads and emulation libraries in user space.
16
Summary Designed with 3 goals in mind Emulate 4.3BSD
Modern OS that supports many memory models, parallel computing, and a distributed model. Easy to extend.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.