Mach’s Message’s Structure

Mach’s Message’s structure might look like as following:

  • Fix-length header
  • Variable-length data section

Note: In Version 2.5, there is an 8 KB size limit on the data section. However, such limitation had been lifted by Version 3.0.

The fix-length header will contain the following information:

  • the destination’s port name
  • the reply port name where reply messages should be sent
  • the length of the message

In the data section, there could be a variety of typed data objects being stored, such as simple type (numbers or characters), port rights, pointers to out-of-line data.

Links to this page
  • Mach’s Networking

    To improve the efficiency, Mach caches the remote memory objects into local memory. For local memory objects, it passes the messages by merely moving the pointer to point to the shared memory objects. For all messages, if they are local to the machine, especially if they are large too, they are 202203251058. Otherwise, they will be handled by 202204231514#.

  • 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.

  • Mach Network Message Server (NetMsgServer)

    The sender’s NetMsgServer creates proxy port, if it has received a send right from a remote computer, to represent the original port from that computer. Therefore, Mach could treat it like any local port where the sender can send messages to this proxy port without hassle. The receiver’s NetMsgServer then translate the message# from the sender’s format to the receiver’s format by referring to the type information stored in it.

#networking #data-structure