Professional Documents
Culture Documents
Mach
Mach
Mach
History of Mach
Goals of Mach
1.
2.
3.
4.
5.
User space
Software 4.3 BSD
emulator
emulator
layer
System V
emulator
HP/UX
emulator
Microkernel
Other
emulator
Kernel space
Processes.
Threads.
Memory objects.
Ports.
Messages.
process
Thread
Process
port
kernel
Ports
Process Management
Primitives
Create
Create a new process, inheriting certain properties
Terminate
Suspend
Resume
Priority
Assign
Info
Threads
Threads
Mach threads are managed by the kernel. Thread creation and destruction are
done by the kernel.
Fork
Exit
Join
Detach
Yield
Self
Implementation of C Threads in
Mach
All C threads use one kernel thread.
Scheduling algorithm
Scheduling
Global run queue for processor set 1
Priority
(high) 0
Low 31
:Free
Count: 6
Hint: 2
31
:Busy
Count: 7
Hint: 4
Virtual Memory
Map
Copy
Inherit
Read
Write
Memory Sharing
Process 1
Process 2
Process 3
Mapped
file
Operation of Copy-on-Write
Physical memory
Prototypes address space
7
RW
RO
RO
Operation of Copy-on-Write
Physical memory
Prototypes address space
7
RW
Copy of page 7
7
RO
RO
Advantages of Copy-on-write
1.
2.
3.
Disadvantages of Copy-on-write
1.
2.
3.
Communication in Mach
A Mach port
Message queue
Receiving thread
Sending
thread
send
receive
port
Kernel
Capabilities
A
process
1
Capability
with RECEIVE 2
right
3
4
B
thread
Port
X
1
2
Port
Y
3
4
Capability with
SEND right
kernel
Capability list
Destroy
Deallocate
Extract_right
Insert_right
Move_member
Set_qlimit
Dest. rights
Message size
Header
Message
body
Data field 1
Descriptor 2
Data field 2
Not examined
by the
kernel
12
Number of
in the data field
8
Data field size
In bits
8
Data field type
Bit
Byte
Unstructured word
Integer(8,16,32 bits
Character
32 Booleans
Floating point
String
Capability
Message transport from the client to the server requires five steps:
1. The client sends a message to the servers proxy port.
2. The network message server gets this message.
3. The network message server looks up the local port in a table that maps
proxy ports onto network ports. Once the network port is known, the
network message server looks up its location in other tables. It then
constructs a network message containing the local message and sends it
over the LAN to the network message server on the servers machine.
When the remote network message server gets the message, it looks up the
network port number contained in it and maps it onto a local port number.
4. The remote network message server writes the message to the local port
just looked up.
5. The server reads the message from the local port and carries out the
request.
Local Network
Local Network
Table mapping
4 216
between local ports
and network ports
7 216
Machine A
C
1
Machine B
C
NMS
2
3
LAN
NMS
5