Jump to page content

Message passing

Caveat

If, from reading these notes, you conclude that I am off my rocker, you won’t be the first, and you may even be right.

No doubt there is a dozen and one reasons why none of this would ever work, but perhaps somewhere deep down there is a tiny fragment that could be used for something.

Contents

Overview

Message passing in Cy/VOS was possibly going to use page swapping under timeslice donation. That is, to pass a message from process A (caller) to process B (recipient):

  1. Request a message buffer; this is a set of one or more memory pages dedicated to this purpose, with the message aligned to the start of the first page.
  2. Pass the message to the despatching system (likely part of the kernel).
  3. The kernel then executes a context switch into the target process (the message recipient process) within the calling process’s quantum: the receiving process immediately gains the CPU. Between suspending the calling process and activating the receiving process, the message-bearing pages are moved from the caller’s page table to the recipient’s page table.
  4. The listening thread in the recipient is notified of the incoming message.

The response message would be returned in much the same manner. The entire request could be completed without any data copying between processes and without any waiting on the CPU scheduler.

Timeslice donation was my idea, although Jenni noted that it had already been invented and would likely have used it anyway. Message passing by page transfer was Jenni’s idea.

Although the idea of a microkernel may seem implausible and impractical, it’s worth noting that Psion’s range of EPOC32-based palmtop and portable computers (Psion Series 5 and 5mx, Revo, Series 7 and netBook) were microkernel systems. Some compromises may be in order for I/O intensive tasks such as video games and realtime audio.

Message structure

For interprocess communication (e.g. window management, file launching), messages will be structured intelligently, in a manner akin to Apple Events. The Apple Event system allows for very intelligent interprocess communication; the only down side is that comparatively primitive languages such as C require a lot of code to form the relevant structures. Data structure assembly in scripting languages (e.g. Perl, JavaScript) is trivial by comparison. This is unlikely to be of any concern as no-one in their right mind now would use a language as obscenely dangerous as C or C++ to build application software.

Low-level message passing such as window content drawing and file access—if a microkernel architecture were to be adopted, that is—would likely rely on simple buffer contents for expedience.

See: events for details.