MMgr v1.0.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
SeriesCellularum Struct Reference

One cellblock's state: its bytes, the two boundaries that grow toward each other, the closed word a writer holds, the sink a refused store lands on, and the turnstiles every pass goes through. More...

#include <locus_carcerum.h>

Data Fields

uint8_t *const base
const size_t size
embed_atomic_usize bounds
embed_atomic_usize persistent_overrun
embed_atomic_usize temporary_overrun
embed_atomic_usize in_use
embed_atomic_usize persistent_in_use
embed_atomic_uptr movable
embed_atomic_word closed
embed_atomic_usize sink
EmbedTurnstiles turnstiles

Detailed Description

One cellblock's state: its bytes, the two boundaries that grow toward each other, the closed word a writer holds, the sink a refused store lands on, and the turnstiles every pass goes through.

Note
Written by the declaration that emits the cellblock and by the entries that cellblock owns. The base is the cellblock's own storage, and nothing derives an address from a site and an index.
bounds is the two boundaries in one word: its low half the offset just past the last persistent cell, its high half the offset of the lowest temporary cell, each in bytes. A take bumps its tier's half by one fetch-add on the word, whose old value carries the other boundary as it stood at that same instant: the room the take reads. A bump the gap cannot meet leaves the boundary where it moved it and adds its bytes to the tier's overrun, persistent_overrun or temporary_overrun; every later bump of either tier is refused, since the boundaries only move toward each other between writers and every bump reads them as one word, and the next writer takes the overrun back off the boundary before it reads the tier. Between a refusal and that writer the boundary stands past the tier's cells by the overrun. The algorithm is written out in docs/concepts/locus-carcerum-algorithm.md and checked in theory/locus_carcerum.
closed is the writer's word: bit 0 while a compaction, a growth or a move works alone, bit 1 while a context sleeps on the word. A pass that reads bit 0 set touches nothing and tries once more after a backoff step. sink is the word every store of a pass that touches nothing lands on.
turnstiles is the bank of lanes a pass badges in at, EmbedTurnstiles' way, which a writer drains after setting the closed bit. Zero at rest, as the last member, which a declaration leaves to the zeroing of static storage.
in_use is this cellblock's running total, counted where each owner's is; persistent_in_use is the part of it lying in the persistent tier, which a sort reads. movable is the option mmgr_movable_init assigns, and reads zero without it.

Definition at line 381 of file locus_carcerum.h.

Field Documentation

◆ base

uint8_t* const SeriesCellularum::base

First byte of the cellblock [BORROWS].

Definition at line 383 of file locus_carcerum.h.

◆ size

const size_t SeriesCellularum::size

Bytes in the cellblock.

Definition at line 384 of file locus_carcerum.h.

Referenced by mmgr_series_cellularum_idle().

◆ bounds

embed_atomic_usize SeriesCellularum::bounds

The persistent end in the low half, the temporary top in the high.

Definition at line 385 of file locus_carcerum.h.

Referenced by mmgr_series_cellularum_persistent_end(), and mmgr_series_cellularum_temporary_top().

◆ persistent_overrun

embed_atomic_usize SeriesCellularum::persistent_overrun

Bytes refused takes moved the persistent end by since the last writer.

Definition at line 387 of file locus_carcerum.h.

◆ temporary_overrun

embed_atomic_usize SeriesCellularum::temporary_overrun

Bytes refused takes moved the temporary top by since the last writer.

Definition at line 388 of file locus_carcerum.h.

◆ in_use

embed_atomic_usize SeriesCellularum::in_use

Payload bytes of the cells taken and not given back.

Definition at line 389 of file locus_carcerum.h.

◆ persistent_in_use

embed_atomic_usize SeriesCellularum::persistent_in_use

The part of in_use lying in the persistent tier.

Definition at line 390 of file locus_carcerum.h.

◆ movable

embed_atomic_uptr SeriesCellularum::movable

The movable option's state, as an integer, zero without it.

Definition at line 391 of file locus_carcerum.h.

◆ closed

embed_atomic_word SeriesCellularum::closed

The writer's bit, and the sleeper flag above it.

Definition at line 392 of file locus_carcerum.h.

◆ sink

embed_atomic_usize SeriesCellularum::sink

Where a store that must not land lands.

Definition at line 393 of file locus_carcerum.h.

◆ turnstiles

EmbedTurnstiles SeriesCellularum::turnstiles

The lanes a pass badges in at.

Definition at line 398 of file locus_carcerum.h.


The documentation for this struct was generated from the following file: