summaryrefslogtreecommitdiff
path: root/microkernel/mach/port.mdwn
blob: 5dcc9ba3387d711737c269129958d1c56d10fdb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[[license text="""
Copyright © 2007 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.2 or any later version
published by the Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts.  A copy of the license is included
in the section entitled [[GNU_Free_Documentation_License|/fdl.txt]].

By contributing to this page, you agree to assign copyright for your
contribution to the Free Software Foundation.  The Free Software Foundation
promises to always use either a verbatim copying license or a free
documentation license when publishing your contribution.  We grant you back all
your rights under copyright, including the rights to copy, modify, and
redistribute your contributions.
"""]]

Mach ports are [[capabilities|capability]].

A Mach port is a kernel queue.  Each port has associated with
it a receive right and one or more send and send-once rights.
A queue can hold a number of messages.  Once the queue is full,
the send blocks until their is space to enqueue the message
(this is interruptible via a timeout mechanism).

A receive right designates a queue and authorizes the holder to
dequeue messages from the queue, and to create send and send-once
rights.

Send and send-once rights designate a queue and authorize the
hold to enqueue messages (in the case of a send-once right,
a single message).  Enqueuing a message is equivalent to
[[invoke|invoking]] a capability.

Send and receive rights are named using local names.  Each
task has associated with it a port [[address_space]].  A ports
are addressed via this table.  Each task thus has its own
private [[naming_context]] for ports.

Ports can be [[delegate]]d in an [[IPC]] message.  When the
receiver dequeues the message, the right is made available
to it.

A [[thread]] can only block receiving on a single port.  To work
around this, the concept of a port set was introduced.  A receive
right can be added to (at most) one port set.  When a thread
receives from a port set, it dequeues from any of the ports that
has a message available.