Skip to main content

Module matrix

Module matrix 

Source
Expand description

#A Atomic Matrix Core

This module implements a high-velocity, lock-free memory arena designed for ultra-low latency IPC (Inter-Process Communication).

§Theory of Operation: The Propagation Principle of Atomic Coalescence

Unlike traditional allocators that use centralized mutexes or complex background garbage collection, the AtomicMatrix treats memory fragmentation as a fluid dynamics problem.

  1. Kinetic Healing: Freeing a block triggers a “Ripple” (‘coalesce’) that propagates through the sector.
  2. Monotonicity: Ripples only move backward (towards the sector origin) to prevent circular atomic dependencies and deadlocks.
  3. Permissive Concurrency: If a thread encounters contention, it skips the block rather than blocking, relying on the high frequency of future operations to complete the healing.

§Memory Topography

The matrix is laid out linearly in a shared memory segment:

[ Init Guard (16b) ] [ AtomicMatrix Struct ] [ Padding ] [ Sector 0 ] [ Sector 1 ] ...

Each Sector acts as a self-contained fault domain with its own boundary, preventing local fragmentation from “bleeding” into the entire matrix.

§Safety & Atomicity

All state transitions follow a strict ‘STATE_FREE -> STATE_ALLOCATED -> STATE_ACKED -> STATE_COALESCING’ lifecycle. Hardware-level memory fences (std::sync::atomic::fence) are utilized to ensure visibility across 16+ CPU cores without locking.

Modules§

core