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.

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

Links to this page
  • Rust Channel

    Since Rust uses the model of message passing (same as 202203021733) as a mean of thread synchronisation, a channel must be established for the threads to communicate with each other. The standard library std::sync::mpsc (mpsc stand for multiple producer single consumer#) provides the function mpsc::channel that could create a channel, which will define transmitter(s) (the one that sends messages) and receiver (the one that receives messages). The return type will be a tuple, the first element represents transmitter(s), the second element represents receiver. Combining with #202207171541, we can send a message from a thread (via transmitter’s method send) to the main thread (via receiver’s method recv or try_recv).

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

  • Mach

    There are error handlers, one for each thread, in Mach. The thread and its error handler will communicate using message passing#, and the handler will decide whether to resume or terminate the thread.

  • Go Programming Language

    Go uses message-passing as the basis for 202207171457 like #rust and 202203021733.

#operating-system #networking