Apeinx follows the Linux kernel philosophy:
- Define core abstractions first, then implement
- Small, reviewable patches — one logical change per commit
- Pure C (C11) — no C++ in the kernel
- No external dependencies — kernel links only against libc and pthread
# Clone and build
git clone https://github.com/your/apeinx
cd apeinx
make
# Run daemon
./build/apeinxd --demo
# In another terminal
./build/apeinxctl status
./build/apeinxctl submit my-task 1000 5apeinx/
├── include/apeinx/ # Headers (one per subsystem)
├── kernel/ # Kernel source
│ ├── init/ # Boot + daemon entry
│ ├── core/ # Kernel state, config, panic
│ ├── syscall/ # AI syscall stubs
│ ├── process/ # AI Task lifecycle
│ ├── sched/ # Token Fair Scheduler
│ ├── mm/ # KV Memory Manager
│ ├── resource/ # GPU, budget, quota, pressure, lease
│ ├── fs/ # VFS, TraceFS, ReplayFS stubs
│ ├── drivers/ # Runtime drivers (mock, vllm, llama, trtllm)
│ ├── net/ # RPC, cluster, heartbeat, state sync
│ ├── security/ # Tenant, policy, capability, namespace
│ └── trace/ # Trace, replay, audit
├── user/ # User-space tools
│ ├── apeinxctl/ # CLI (status, submit, kill, top, replay, billing)
│ └── libapeinx/ # Client library stubs
├── tests/ # Unit tests
├── examples/ # Config and CSV task files
├── docs/ # Architecture and design docs
└── scripts/ # Python venv setup
- C11 standard (
-std=c11) - 4-space indentation, no tabs
typedeffor all structs and enums- Prefix:
ax_for functions,AX_for constants - Error handling: return
int, negative = error code fromerrno.h - Global state: single
g_kernelstruct, no other globals
- Create
include/apeinx/your_subsystem.h— data structures + API - Create
kernel/your_subsystem/file.c— implementation - Add
#include "your_subsystem.h"tokernel.hif needed - Add
ax_your_subsystem_init()tokernel.cax_kernel_init() - Add
.cfiles toMakefile - If it has user-facing commands, add to
apeinxctl/main.c
# Run daemon with 100-task stress test
./build/apeinxd --csv examples/tasks.csv --limit 100
# Check status
./build/apeinxctl top
# Verify trace
./build/apeinxctl replay| Phase | Content | Loc |
|---|---|---|
| 0 | Spec + Architecture docs | ~2k |
| 1 | v0.01 alpha kernel | ~10k |
| 2 | Local multi-GPU AIOS | ~30k |
| 3 | Real Runtime drivers | ~10k |
| 4 | Distributed cluster | ~15k |
| 5 | Enterprise control plane | ~12k |
| 6 | v1.0 stable | docs + polish |