manster / DBKernel
The Concept
The Database Engine IS the OS.
Instead of building a database on top of a traditional operating system, DBKernel provides all primitives needed for database workloads directly in the kernel itself.
This includes direct NVMe access, MVCC, WAL, lock-free data structures, query scheduling, and replication — everything running strictly in Ring 0.
0
Userspace
0
Syscall Overhead
100%
Ring 0 Execution
~68%
Rust Codebase
System Architecture
A modular, fully integrated stack built from the ground up to bypass traditional bottlenecks.
Rationale
Core Design Decisions
Ring 0 Only
Eliminates system call overhead and context switches. Every database worker operates purely as a kernel thread.
No Double-Caching
The database buffer pool replaces the traditional OS page cache entirely, ensuring memory is utilized perfectly without duplication.
Identity-mmap (1 GiB)
Identity-mapped first 1 GiB utilizing 2 MiB huge pages directly from Boot.asm, preventing TLB thrashing during heavy I/O workloads.
Stateless Workers & WAL Truth
Workers are completely stateless. All durability and state truth is ensured strictly through the Write-Ahead Log (WAL).
Build & Execute Environment
# Prepare toolchain
rustup toolchain install nightly
rustup component add rust-src llvm-tools-preview
# Build bare-metal ELF
cargo build --release --target x86_64-dbkernel.json
# Boot via QEMU (No Display, Serial Out)
qemu-system-x86_64 \
-kernel target/x86_64-dbkernel/release/dbkernel \
-serial stdio -display none
Deep Dive: 20 DB Engine Modules
DBKernel packs custom-designed engine subsystems optimized specifically for raw hardware manipulation in Ring 0.
arena_alloc
Arena/slab allocator for DB objects
lock_free
Skiplist, MPMC queue, RCU
async_io
Vectorized / batch async I/O
direct_storage
Page/segment manager — no FS layer
buffer_pool
In-kernel DB buffer cache
layout_manager
Hot/cold data, WAL placement
btree
B-tree index engine
mvcc
Multi-Version Concurrency Control
query_scheduler
Priority-aware query scheduler
query_exec
Parallel query execution runtime
wal_engine
Group commit, sequential write
io_scheduler
OLTP vs analytics throughput
io_batching
Coalesces multiple writes
numa_memory
ACPI NUMA topology routing
isolation
Per-instance CPU/memory limits
runtime
Lightweight instance runtime
network_engine
Zero-copy, ring-0 NIC bypass
replication
Cross-instance data sync
multi_engine
Pluggable storage backends
telemetry
Latency & hit rate statistics
Development Roadmap
Foundation
Keyboard, VGA, interactive shell, arena allocator, lock-free structures, and basic telemetry monitoring.
Storage & TX
NVMe driver, disk WAL, buffer pool integrated with full MVCC, transaction isolation, and parallel query execution.
Distribution
NUMA awareness, replication protocols, multi-engine backends, and DPDK-style zero-copy network bypass.




