A small but real operating system kernel for x86-64 machines, implementing virtual memory, process isolation, and fork(), built and debugged at the bare-metal level using QEMU.
Built as part of an advanced OS curriculum, but engineered to production-quality standards.
🧠 Virtual Memory
- 4-level x86-64 page tables
- Page-aligned memory mapping
- Kernel identity mapping
- User vs kernel page permissions
🔒 Process Isolation
- Separate page tables per process
- User processes prevented from accessing kernel memory
- Controlled access to shared console memory
📦 Memory Allocation
- Physical page allocation (
kalloc) - Virtual-to-physical remapping
- Dynamic heap growth
- Stack placement at high virtual addresses
🔁 Fork System Call
- Full
fork()implementation - Copy-on-write–style semantics (explicit page copying)
- Per-page duplication of writable user memory
- Correct parent/child return behavior
+----------------------+
| User Processes |
| (isolated VMs) |
+----------+-----------+
|
v
+----------------------+
| WeensyOS Kernel |
| - Page Tables |
| - Syscalls |
| - Scheduler |
+----------+-----------+
|
v
+----------------------+
| Emulated x86-64 HW |
| (QEMU) |
+----------------------+
Each process has its own virtual address space, backed by independently allocated physical pages.
make run # boot kernel
make run-fork # test fork()
make run-gdb # kernel debugging via GDB- C++ (kernel-level, no standard runtime)
- x86-64 architecture
- QEMU hardware emulator
- Custom memory allocators
- ELF program loading