Presentation2-Mach Case Study

Download Report

Transcript Presentation2-Mach Case Study

contd…MACH CASE STUDY
BALAKUMAR
Agenda





Communication implementation in
MACH
Memory Management
Inheritance
Copy-on-Write
External Pagers
Communication
Implementation

User-Level Network Servers




•
One Per computer
Responsible for communication
Protecting access rights to ports
Privacy of message data
Netmsgservers
Network Communication
Receive rights Network port Address
8
Sender
task
n
Network port Send rights
n
a
107
8
107
Receiver
task
n
Network server
Mach
Message to a
Network
Network server
Mach
Network address a
……Sequence
SENDER

Rights held by the sender task are to the local port.

Receive rights are held by local network server.

The sender network server looks up for an entry in a table of
network ports for which it has receive rights.

This yields a network port and a network address .

The message is sent with the network port attached to it .
RECEIVER

Extracts the network port looks up for an entry in a tale of
network ports for which it has receive rights.

This yields a local mach port and send rights.

The message is delivered to the appropriate port
Responces





Port here: the destination holds receive rights
Port dead: the port is destroyed
Port not here, transferred: receive rights were
transferred to a specific address.
Port not here, unknown: there is no record of the
network port
No response: the destination computer is dead
ISSUES





At some point the sender might run out of forwarding
addresses.
Then the sender resorts to broadcasting.
Design issues – How to manage the forwarding
addresses and how to recover from a crash of a
computer holding forwarding addresses.
Migration Transparency – Synchronize message
transfer.
The network server holds delivery of all messages at
the original computer until all queued messages have
been transferred to the destination computer.
Protocols and Drivers






Transport Protocol
Uses only TCP/IP
TCP/IP tuned to achieve robustness
User-Level Network Drivers
Network Servers have heir own drivers
Speed up network and achieve flexibility
MEMORY MANAGEMENT




Use of Address Space
Memory Sharing
Virtual Memory Techniques
Supports External Pagers(memory
managers) also Virtual memory to be
shared and reside in different
computers.
Address Space Structure



Collection of contiguous group of pages named by
their addresses called regions.
Mach system calls refer to addresses.
Regions can be created in 4 ways




Explicitly allocated by a call vm_allocate …filled by zeros
Association with a memory object vm_map
Inherited from a blue print vm_inherit
Allocated automatically by message passing
Memory Management Calls






vm_allocate: Allocates memory region.
vm_deallocate: De-allocates previously allocated
regions.
vm_read and vm_write: read or write contents in a
region
vm_protect: Protects a region (read/write)
vm_copy: Copy regions
vm_map and vm_inherit
Memory Sharing

Memory Inheritance




A region that is inherited from a blueprint task contains
the same address range and its memory
Shared: backed by the same memory
Copied : backed by memory that is a copy of
the blueprint’s memory at the time child region
was created.
Mach uses copy on write for inheritance and
also message passing.
Evaluation of copy-on-write



Assists in passing message data between tasks and
network servers.
Cannot be used to facilitate transmission across a
network(as computers do not share physical
memory)
It is efficient as long as sufficient data are
involved(as advantage of physical copying has to
outweigh the cost of page table manipulations)
Copy-on-write overheads
Region size Simple copy Create region Amount of data copied (on writing)
0 kilobytes 8 kilobytes 256 kilobytes
(0 pages) (1 page)
(32 pages)
_
1.57
2.7
4.82
8 kilobytes 1.4
256 kilobytes 44.8
1.81
Note: all times are in milliseconds.
2.9
5.12
66.4
Copy-on-Write Overheads


Overhead when Copy-on-Write is used
2.12 millisecond for one page write of 8 Kilobytes
66.4 millisecond for 32 page write of 256 kilobytes
Overhead when In-Line is used
2.8 millisecond for one page write of 8 Kilobytes
89.6 millisecond for 32 page write of 256 Kilobytes
External Pagers




Mach Dose not support files or any other
abstraction of external storage directly.
These resources are implemented using
External Pagers.
Instead of accessing stored data using explicit
read and write operations, Mach access
corresponding virtual memory locations
directly (mapped access).
Advantage – Uniformity
External pager
Task’s
address
space
Region
Memory
cache
objects
Kernel
External pager
Port
Messages
Network
Kernel
Components of Message passing Protocol
Event
vm_map called by task
Task page-faults when no data
frame exists
Kernel writes modified page to
persistent store
External pager directs kernel to
write page/set access permissions
Task page-faults when insufficient
page access
Memory object no longer mapped
External pager withdraws memory
object
Sender
K -> EP
EP -> K
EP -> K
K -> EP
EP -> K
EP -> K
K -> EP
Message
memory_object_init
memory_object_set_attributes, or
memory_object_data_error
memory_object_data_request
memory_object_data_provided, or
memory_object_data_unavailable
memory_object_data_write
EP -> K
K -> EP
K -> EP
EP -> K
K -> EP
EP -> K
K -> EP
memory_object_lock_request
memory_object_lock_completed
memory_object_data_unlock
memory_object_lock_request
memory_object_terminate
memory_object_destroy
memory_object_terminate
Roles of External Pager



To store data that have been purged by
a kernel from its cache of pages
To supply page data as required by a
kernel
To impose consistency Constraints.
Conclusion





Mach is a innovative design and remains important.
Mach Kernel runs on both multiprocessor and
uniprocessor
Designed to allow DS to evolve while maintaining
UNIX compatibility
Recent Mach 3.0 Microkernel is the basis for Linux
Operating system.
Simpler memory management and Simpler interprocess communication.
Mach remains as an invaluable reference for
developments in Kernel Architecture.
THANKYOU
Have a great evening!!!!