from Operating Systems Concepts, Sixth Edition by Abraham

Transcription

from Operating Systems Concepts, Sixth Edition by Abraham
The Mach System
from Operating Systems Concepts, Sixth Edition by
Abraham Silberschatz, Peter Baer Galvin, and
Greg Gagne
Presented by Adam Lowry
Design Principles
• Support for multiple architectures
• Varying network speeds
• Simple kernel structure
• Distributed operation
• Integrated memory management & IPC
• Heterogeneous system support
Components
• Task
• Thread
• Port
• Port Set
• Message
• Memory Object
blending of memory and interprocess-communication features. Whereas some
other distributed systems (such as Solaris, with its NFS features) have specialpurpose extensions to the file system to extend it over a network, Mach provides a general-purpose, extensible merger of memory and messages at the
heart of its kernel. This feature not only allows Mach to be used for distributed
text region
message
threads
port
program
counter
task
data region
port set
memory
object
Figure B.2
secondary storage
Mach’s basic abstractions.
Process Management
• Task + Threads = Process
• All threads are kernel-supported
• Synchronization implemented with IPC
Threads and Scheduling
• C Threads library provides all standard tasks
• Mutual exclusion implemented with
spinlocks
• Blocking waits with condition variables
• Simple model - only threads are scheduled
• Multiple queues
Exception Handling
• Made up of kernel primitives:
• Handler is a thread, RPC for logic
Internal Exceptions
• Victim notifies handler via IPC
• Victim waits for resolution
• Handler receives notification with
information
• Handler clears or terminates
BSD-Style Signals
• Difficult to implement
• Process to process: converted to IPC
• Hardware exceptions handled by kernel
IPC
• Traditional way: global names, untyped
streams
• Mach way: location independent ports, typed
data
Ports
• Managed by kernel
• All objects have standard ports
• Can be grouped into Port Sets
message (see Figure B.5). The data in the message (in-line data) were limited to
less than 8K in Mach 2.5 systems, but Mach 3.0 has no limit. Any data exceeding
that limit must be sent in multiple messages, or more likely via reference by a
pointer in a message (out-of-line data, as we shall describe shortly). Each data
section may be a simple type (numbers or characters), port rights, or pointers
to out-of-line data. Each section has an associated type, so that the receiver
Messages
port
message queue
message
message
destination port
reply port
size / operation
pure typed data
port rights
out-of-line-data
port
...
message control
memory cache object
Figure B.5
memory cache object
Mach messages.
872
Message Passing
Appendix B The Mach System
A
B
A
P1
A map
kernel map
B
P1
B map
send operation
Figure B.6
A map
kernel map
receive operation
Mach message transfer.
B map
NetMsgServer
• All objects should be location independent
• NetMsgServer handles naming &
transportation in user level
Memory Management
• Everything is a Memory Object
• Control via IPC
• Memory managers are user-level, with
default backup
Programming Interface
• BSD system calls
• Emulation and servers at user-level
• Threading library
• Stubs