diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-11 12:08:10 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-11 12:08:10 -0400 |
| commit | 20a19f433956f063d8048f032aaf5dcce1d61e7c (patch) | |
| tree | c9720211c62e75a245c252c82f6353e5162fcb86 /docs/application/gc.md | |
| parent | 51d055dc7e1a6edbaedb7ea80b1e678eff924fe0 (diff) | |
add algo for mutating shared object
Diffstat (limited to 'docs/application/gc.md')
| -rw-r--r-- | docs/application/gc.md | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/docs/application/gc.md b/docs/application/gc.md deleted file mode 100644 index 764285b..0000000 --- a/docs/application/gc.md +++ /dev/null @@ -1,35 +0,0 @@ -# Garbage Collection - ---- - -## Object Definition - -```c -typedef enum : uint16_t { - LOCK_MUTEX = 1 << 0, -} kpl_gc_flags; - -typedef struct _kpl_gc { - POOL_HEADER(_kpl_gc); - _Atomic bool mark; - int16_t flags; - kpl_any any; - pthread_mutex_t mutex; -} kpl_gc; - -static _Atomic int32_t gc_threads; - -static pthread_mutex_t gc_head_mutex; - -static kpl_gc *gc_head_sweep, *gc_head; -``` - -## Tracing - -1. Once triggered add a init task to the async queue -2. This task moves the `gc_head` to the `gc_head_sweep` and sets the `gc_wait` to off for each thread -3. Each thread will run down its queue queue marking found gc objects -3. Once all have run and `gc_threads == available_threads` add a mark and sweep task to the async queue -4. The async queue is moved to a temp queue and as each item on the tmep queue is marked it is moved back to the async queue -5. A sweep on the `gc_head_sweep` is done -6. What remains on the `gc_head_sweep` is added to `gc_head` |
