Mach’s Interprocess Communication (IPC) Facility

Mach enforces that all objects to be local independent and transparent to the user. This means that all #message passing could be done or seems to be done locally. The **messages#** passed will contain typed data objects, which compared to alternative where data in them will be untyped streams of bytes, are easier to parse even if the byte ordering is different from the sender and receiver.

To receive messages, every object in Mach, upon creation, must have a port where those messages could send to and queue at. If the queue is full, the sender could abort the send operation and then wait for its turn when the queue is once more available for queuing, or the kernel could deliver that message on behalf of the sender. The port creation share similarity with standard PID concept in UNIX. If the port specified in message# cannot be translated into internal port data structure address, it will then be passed to 202204231514# from the kernel.

Ports could be collected in a set called port set where they share the same message queue. A port can only be a member of one port set at a time. When a port needs to send or receive messages, these messages will be queued at the port set’s queue rather than direct communication between two ports. However, port set may not be passed in the format of message.

Port right is a protection mechanism to port which contains the port name and its capability (send to or receive from that port). It could be given out from the creator of the object in the form of messages, where the sender will be relinquished of that right, or to be revoked when the port is destroyed.

On any given port, only one task can have receive rights, but many tasks could have send rights. Upon revocation of the receive rights, tasks that hold the send rights could be notified.

Mach IPC could be used for thread synchronisation where its mechanism is similar to semaphore# due to the nature of queue.

Links to this page
  • Mach’s Networking

    #202203021657 concentrates its efforts on utilising its communication facilities, which is message-passing. This resulted in a blending of memory and 202204222158# where Mach could be used for distributed and parallel programming.

  • Mach Network Message Server (NetMsgServer)

    NetMsgServer performs transparent naming and transport for #202204222158 to communicate with remote devices at user level. It is protocol-independent and capable of using various network protocols.

  • Mach Memory Management

    A section of the memory addresses allocated to the program will be used as a port# in order to gain access to the message it contains. If there is a page fault, the virtual memory object will receive it via the port. The corresponding memory manager will be created by the kernel asynchronously, meaning the kernel will not wait for it to finish.

  • Mach
    Thread: the basic unit of execution and must be run in the context of task where it inherits the task’s address space, ports, memory etc. The resources are shared among the threads. Threads could use 202204222158# for communication.
    202204222158# includes some other components such as Port, Port Set and Messages
#networking #operating-system #**