|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Central shared-memory manager for a Psyclone node: master segment, per-subsystem shared maps and the page-based legacy allocator. More...
#include "MemoryController.h"#include "Utils.h"#include "ThreadManager.h"#include "DataMessage.h"#include "TemporalMemory.h"#include "ComponentMemory.h"#include "DataMapsMemory.h"#include "ProcessMemory.h"Go to the source code of this file.
Classes | |
| struct | cmlabs::PsycloneIndexStruct |
| Header of the machine-global Psyclone instance index shared-memory segment. More... | |
| struct | cmlabs::PsycloneIndexEntry |
| One slot in the machine-global Psyclone instance index. More... | |
| class | cmlabs::PsycloneIndex |
| Accessor for the machine-global instance index segment. More... | |
| struct | cmlabs::PerfStats |
| Raw per-component performance counters sampled inside shared memory. More... | |
| struct | cmlabs::AveragePerfStats |
| Sliding-window averages derived from successive PerfStats snapshots. More... | |
| struct | cmlabs::MemoryMasterStruct |
| Root header of the node's master shared-memory segment. More... | |
| class | cmlabs::MasterMemory |
| Handle to the node's master shared-memory segment (MemoryMasterStruct). More... | |
| class | cmlabs::MemoryManager |
| Top-level facade of the shared-memory subsystem for one process. More... | |
| struct | cmlabs::CMRegister |
| Legacy registry block listing the Psyclone system ids present on this machine. More... | |
| struct | cmlabs::MemoryID |
| Decomposed form of a 64-bit global memory-block id (legacy page allocator). More... | |
| struct | cmlabs::MemoryBlock |
| Size prefix of a raw block inside a MemoryPage (legacy allocator). More... | |
| struct | cmlabs::PagePoolHeader |
| Header of the page-pool structure holding reusable, currently idle pages (legacy allocator). More... | |
| struct | cmlabs::PagePoolEntry |
| One recyclable page recorded in the page pool (legacy allocator). More... | |
| struct | cmlabs::EOLHeader |
| Header of the end-of-life (EOL) time-wheel that schedules page expiry (legacy allocator). More... | |
| struct | cmlabs::EOLEntry |
| One page/expiry pair inside an EOL time-wheel slot (legacy allocator). More... | |
| struct | cmlabs::MemoryPage |
| In-segment header of one memory page holding packed data blocks (legacy allocator). More... | |
| struct | cmlabs::MemoryPageEntry |
| Page-table slot describing one page's identity, size and lock state (legacy allocator). More... | |
| struct | cmlabs::MemoryPageCache |
| Header of a process-local (non-shared) cache of mapped page addresses (legacy allocator). More... | |
| struct | cmlabs::MemoryPageCacheEntry |
| One process-local cached page mapping; stale when serials mismatch the page table (legacy allocator). More... | |
| struct | cmlabs::MemoryPageMaster |
| Root header of the legacy page-allocator segment ("PageMaster"). More... | |
| class | cmlabs::MemoryManagerX |
| Legacy page-based shared-memory allocator (predecessor of MemoryManager). More... | |
Namespaces | |
| namespace | cmlabs |
Macros | |
| #define | DRAFTMSGSIZE 4096 |
| Fixed byte size of the per-message draft slots used in the recent-message rings of ComponentStats / ProcessStats. | |
| #define | PSYCLONE_INDEX_MAXCOUNT 128 |
| Maximum number of concurrently tracked Psyclone instances per machine. | |
| #define | PSYCLONE_INDEX_SIZE (sizeof(PsycloneIndexStruct) + (PSYCLONE_INDEX_MAXCOUNT * sizeof(PsycloneIndexEntry))) |
| Total byte size of the instance-index shared-memory segment. | |
| #define | MAXREGISTERCOUNT 64 |
| Maximum number of system ids storable in a CMRegister block. | |
| #define | NODE_PROCESS_ID 1 |
| Reserved process id of the node process itself. | |
| #define | MAXINSTANCES 256 |
| Maximum Psyclone process instances per machine. | |
Node lifecycle status values (PsycloneIndexEntry::status) | |
| #define | PSYCLONE_STATUS_NONE 0 |
| No instance recorded in this slot. | |
| #define | PSYCLONE_STATUS_ENDED 1 |
| Instance has shut down (or crashed and was reaped). | |
| #define | PSYCLONE_STATUS_INIT 2 |
| Instance is starting up, not yet serving. | |
| #define | PSYCLONE_STATUS_READY 3 |
| Instance is fully operational. | |
Legacy page-allocator address helpers | |
Pointer arithmetic over the raw in-segment page layout: a MemoryPage header is followed by its block-offset index table, then the packed block data. | |
| #define | MP_GetBlockIndexStartLoc(p) |
| #define | MP_GetBlockDataStartLoc(p) |
Legacy 64-bit memory-id packing macros | |
A global block id packs pageID (32 bits), blockID (16 bits) and nodeID (16 bits); these macros compose and extract the fields without shifting at runtime where possible. | |
| #define | MP_SYSMEMID MP_CalcID(0, 0, pageMaster->nodeID) |
| #define | MP_CalcID(pid, bid, nid) |
| #define | MP_SetBlockID(id, var) |
| #define | MP_SetNodeID(id, var) |
| #define | MP_SetPageID(id, var) |
| #define | MP_GetBlockID(id) |
| #define | MP_GetNodeID(id) |
| #define | MP_GetPageID(id) |
| #define | MP_GetBitFieldLoc(m) |
| #define | MP_GetPageTableLoc(m) |
| #define | MP_GetPageEntryLoc(m, pid) |
| #define | MP_GetPageLoc(m, pid) |
Legacy page-type classification | |
| #define | MP_SYSTEMPAGE 0 |
| Reserved page holding allocator/system structures. | |
| #define | MP_STATICPAGE 1 |
| Page with non-expiring data. | |
| #define | MP_DYNAMICPAGE 2 |
| Page with end-of-life (expiring) data. | |
| #define | MP_GetPageType(id, eol) |
| Classify a page by id and eol: reserved ids are system pages; eol > 0 means dynamic. | |
Functions | |
| THREAD_RET THREAD_FUNCTION_CALL | cmlabs::MemoryManagement (THREAD_ARG arg) |
| Background maintenance thread entry point for MemoryManager / MemoryManagerX. | |
Central shared-memory manager for a Psyclone node: master segment, per-subsystem shared maps and the page-based legacy allocator.
This header is the hub of the CMSDK shared-memory core. A Psyclone system runs as a collection of separate OS processes ("spaces"), each hosting one or more components. All inter-process state — component registries, process/queue tables, data maps and the temporal message store — lives in named shared-memory segments so that any process can crash without corrupting the others (crash isolation), and can re-attach on restart.
The MemoryManager singleton owns/attaches five segments per node instance (keyed by port):
On Windows the segments are named file mappings (CreateFileMapping/MapViewOfFile); on POSIX systems (Linux, macOS) they are shm_open/mmap regions — see the shared-memory helpers in Utils for the actual primitive. The structs in this file are the raw on-segment layouts.
Definition in file MemoryManager.h.
| #define DRAFTMSGSIZE 4096 |
Fixed byte size of the per-message draft slots used in the recent-message rings of ComponentStats / ProcessStats.
Messages larger than this are truncated when recorded.
Definition at line 113 of file MemoryManager.h.
Referenced by cmlabs::ComponentMemory::addComponentStats(), cmlabs::ProcessMemory::addToProcessStats(), cmlabs::ComponentStats::toXML(), cmlabs::ProcessStats::toXML(), and cmlabs::ComponentMemory::UnitTest().
| #define MAXINSTANCES 256 |
Maximum Psyclone process instances per machine.
Definition at line 563 of file MemoryManager.h.
| #define MAXREGISTERCOUNT 64 |
Maximum number of system ids storable in a CMRegister block.
Definition at line 544 of file MemoryManager.h.
| #define MP_CalcID | ( | pid, | |
| bid, | |||
| nid ) |
Definition at line 680 of file MemoryManager.h.
| #define MP_DYNAMICPAGE 2 |
Page with end-of-life (expiring) data.
Definition at line 697 of file MemoryManager.h.
| #define MP_GetBitFieldLoc | ( | m | ) |
Definition at line 687 of file MemoryManager.h.
| #define MP_GetBlockDataStartLoc | ( | p | ) |
Definition at line 624 of file MemoryManager.h.
| #define MP_GetBlockID | ( | id | ) |
Definition at line 684 of file MemoryManager.h.
| #define MP_GetBlockIndexStartLoc | ( | p | ) |
Definition at line 623 of file MemoryManager.h.
| #define MP_GetNodeID | ( | id | ) |
Definition at line 685 of file MemoryManager.h.
| #define MP_GetPageEntryLoc | ( | m, | |
| pid ) |
Definition at line 689 of file MemoryManager.h.
| #define MP_GetPageID | ( | id | ) |
Definition at line 686 of file MemoryManager.h.
| #define MP_GetPageLoc | ( | m, | |
| pid ) |
Definition at line 690 of file MemoryManager.h.
| #define MP_GetPageTableLoc | ( | m | ) |
Definition at line 688 of file MemoryManager.h.
| #define MP_GetPageType | ( | id, | |
| eol ) |
Classify a page by id and eol: reserved ids are system pages; eol > 0 means dynamic.
Definition at line 699 of file MemoryManager.h.
| #define MP_SetBlockID | ( | id, | |
| var ) |
Definition at line 681 of file MemoryManager.h.
| #define MP_SetNodeID | ( | id, | |
| var ) |
Definition at line 682 of file MemoryManager.h.
| #define MP_SetPageID | ( | id, | |
| var ) |
Definition at line 683 of file MemoryManager.h.
| #define MP_STATICPAGE 1 |
Page with non-expiring data.
Definition at line 696 of file MemoryManager.h.
| #define MP_SYSMEMID MP_CalcID(0, 0, pageMaster->nodeID) |
Definition at line 679 of file MemoryManager.h.
| #define MP_SYSTEMPAGE 0 |
Reserved page holding allocator/system structures.
Definition at line 695 of file MemoryManager.h.
| #define NODE_PROCESS_ID 1 |
Reserved process id of the node process itself.
Definition at line 561 of file MemoryManager.h.
| #define PSYCLONE_INDEX_MAXCOUNT 128 |
Maximum number of concurrently tracked Psyclone instances per machine.
Definition at line 139 of file MemoryManager.h.
Referenced by cmlabs::PsycloneIndex::GetStatus(), and cmlabs::PsycloneIndex::init().
| #define PSYCLONE_INDEX_SIZE (sizeof(PsycloneIndexStruct) + (PSYCLONE_INDEX_MAXCOUNT * sizeof(PsycloneIndexEntry))) |
Total byte size of the instance-index shared-memory segment.
Definition at line 141 of file MemoryManager.h.
Referenced by cmlabs::PsycloneIndex::GetStatus(), cmlabs::PsycloneIndex::init(), cmlabs::MasterMemory::~MasterMemory(), and cmlabs::PsycloneIndex::~PsycloneIndex().
| #define PSYCLONE_STATUS_ENDED 1 |
Instance has shut down (or crashed and was reaped).
Definition at line 106 of file MemoryManager.h.
Referenced by cmlabs::MemoryManager::connect(), cmlabs::MemoryManager::~MemoryManager(), and cmlabs::PsycloneIndex::~PsycloneIndex().
| #define PSYCLONE_STATUS_INIT 2 |
Instance is starting up, not yet serving.
Definition at line 107 of file MemoryManager.h.
Referenced by cmlabs::MemoryManager::connect(), and cmlabs::MemoryManager::create().
| #define PSYCLONE_STATUS_NONE 0 |
No instance recorded in this slot.
Definition at line 105 of file MemoryManager.h.
Referenced by cmlabs::MemoryManager::connect(), cmlabs::MemoryManager::getNodeStatus(), and cmlabs::PsycloneIndex::GetStatus().
| #define PSYCLONE_STATUS_READY 3 |
Instance is fully operational.
Definition at line 108 of file MemoryManager.h.
Referenced by cmlabs::MemoryManager::create(), and cmlabs::PsySpace::isConnected().