Shared Memory Allocator (mm)The shared memory allocator (mm) is a framework for allocating small chunks of memory within a shared memory segment. The goal is the ability to store dynamic data structures (such as linked lists and arbitrary length strings) in a shared memory segment. The source code is part of the LiSA tarball (refer to the download page for details), as two files: userspace/lib/mm.c and userspace/include/mm.h. Yet, the allocator is independent of any LiSA mechanisms and can be easily used outside the main project. The whole idea behind mm is that pointers can be shared among isolated processes as long as they are all relative to the start of the shm area. Thus, they can be converted to real pointers by just adding them with the base address of the shm area within the local process virtual memory. At present, mm includes macros for easily converting real pointers to mm pointers and vice-versa, and also malloc/realloc/free like primitives for dynamic allocation within the shared memory segment. Dynamic structures can be published (among different isolated processes) by making use of the (custom) structure at the beginning of the shm area. Have a look at README.mm inside the LiSA tarball for further details. All IPC entities (including semaphore synchronization but also the shared memory area itselt) are POSIX IPC mechanisms. |