diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-09-06 16:28:59 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-09-06 16:28:59 -0400 |
| commit | db5ae642219e222e07d47614d7e602371b21aec2 (patch) | |
| tree | 40c8f017735444efe79470410ece7482a795e703 /docs/allocator.md | |
| parent | 9ea666b63c5105131bb7f772ae3fbe9b56a865ff (diff) | |
start impl
Diffstat (limited to 'docs/allocator.md')
| -rw-r--r-- | docs/allocator.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/docs/allocator.md b/docs/allocator.md new file mode 100644 index 0000000..5885d76 --- /dev/null +++ b/docs/allocator.md @@ -0,0 +1,65 @@ +# Allocator + +--- + +KPL uses `mmap` to allocate slabs of non-executable and executable memory + +Once memory is used it is not returned to the OS until KPL exits + +## Non-Executable + +### Mapping + +Two linked list of pages is kept, tracing the size of map and how much is used: + +#### Small Page Allocator + +For allocations less then a page size `< 2 ^ 12` + +#### Large Page Allocator + +For allocations a page size or larger `>= 2 ^ 12` + +### Object Sizes + +Every Object KPL allocates is sized to the next power of 2 + +Because each power of two requires its own ring buffer, minimum allocation size is `2 ^ 6` and max is `2 ^ 27` + +### Ring Buffer Sizes + +The total number of objects each ring buffer can store can by modified by MACRO'S at compile time + +The program will exit if more objects are allocated then it's corresponding ring buffer can hold + +### Ring Buffer Implementation + +Each ring buffer is implemented as an atomic multi-producer multi-consumer queue + +### Operation + +#### Constructor + +#### Requesting Objects + +#### Returning Objects + +#### Destructor + +## Executable + +### Mapping + +A linked list of pages is kept, tracing the size of each map and how much is used + +### Operation + +#### Constructor + +#### Requesting Memory + +#### Writing To Memory + +#### Making Memory Executable + +#### Destructor |
