Skip to content

core operating system kernel features in a small but real x86-64 OS (WeensyOS), focusing on virtual memory, process isolation, and process creation (fork).

Notifications You must be signed in to change notification settings

samarthmahendraneu/virtual-memory-kernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeensyOS — A Minimal x86-64 Operating System Kernel

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.

Key Features

🧠 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

Architecture

+----------------------+
|   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.

Usage

make run        # boot kernel
make run-fork   # test fork()
make run-gdb    # kernel debugging via GDB

Technology Stack

  • C++ (kernel-level, no standard runtime)
  • x86-64 architecture
  • QEMU hardware emulator
  • Custom memory allocators
  • ELF program loading

About

core operating system kernel features in a small but real x86-64 OS (WeensyOS), focusing on virtual memory, process isolation, and process creation (fork).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •