Mach Memory Management

Unlike monolithic kernels such as 202204081225, #202203021657 relies on user-level memory managers instead of kernel-level virtual memory pager. Following the OOP principle, it treats memory objects like all other components in the system. These objects are fairly independent of the kernel since there is no assumption made on their contents and importance.

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.

Upon the mapping of the memory object, the kernel will pass control port and name port to the memory manager. Control port will be used by the memory manager to communicate with kernel, whereas name port will only be used as a point of reference and comparison. The memory manager has several methods to communicate with the kernel (it will send a request to the memory object first), either passes page(s) in response to page fault or report errors on memory management.

If the user-level memory managers fail to perform page-out operation (usually when fail to reduce its resident sets of pages), Mach has a default manager, which has a similar interface to the user-level counterparts, that taking care of that issue. It will either use a file in the standard filesystem or a dedicated partition as a swap which is quite similar to 202202142236# (v2.5 only allow to use a file). The default manager uses the pageout daemon, a kernel thread which uses FIFO with second chance paging algorithm, for paging mechanism.

Mach virtual memory are sparse due to the nature that it is not required for the newly allocated regions for a task to be contiguous with the previous allocation.

For shared memory (only threads are able to share memory), Mach uses 202112061117# and critical sections to synchronised. If the memory is shared between two different machines, an external memory manager should be used (Mach provide Network Memory Server, NetMemServer).

On NORMA system, especially in Version 3.0, Mach could create child tasks on nodes other than its own. XMM subsystem further enhance the capability of the NORMA system as it allows the system to use external memory manager without dealing with data inconsistency. This allows the NORMA system to be able to run a single-system-image operating system where it is treated as a one whole large system.

Links to this page
#operating-system #oop #memory