OpenOS is a research-oriented, open-source operating system built from scratch for the x86 architecture. It features a modular monolithic architecture, complete exception handling, memory management, and timer support - a production-ready foundation for OS research and experimentation.
The goal is to build a small, understandable OS from zero, inspired by hobby OS projects like MyraOS, xv6, and OSDev examples — but implemented with our own code, fully documented, and open for community contribution.
To create a collaborative OS development environment where researchers, academics, and low-level system developers can explore:
- How CPUs boot an OS
- What a kernel actually does
- How memory, interrupts, and drivers work
- How processes and syscalls operate
- How filesystems and user programs work
All with clean, simple, modern C + Assembly code in a well-organized modular structure.
OpenOS follows a modular monolithic kernel architecture:
├── arch/x86/ # Architecture-specific code (IDT, ISR, PIC, exceptions)
├── kernel/ # Core kernel (initialization, panic handling)
├── kernel/cpu/ # CPU simulation (pipeline, single-cycle, performance)
├── memory/ # Memory management (PMM, VMM, heap, cache, bus)
├── drivers/ # Hardware drivers (console, keyboard, timer)
├── fs/ # File systems (VFS - future)
├── process/ # Process management (future)
├── benchmarks/ # Performance benchmarks and test programs
└── include/ # Common headers (types, multiboot)
Benefits:
- ✅ Clear separation of concerns
- ✅ No circular dependencies
- ✅ Easy to navigate and understand
- ✅ Scalable for future growth
- ✅ Industry-standard organization
See docs/architecture/ARCHITECTURE.md for detailed architecture documentation.
- ✅ Modular monolithic architecture - Clean separation of concerns
- ✅ Multiboot-compatible 32-bit kernel - GRUB bootloader support
- ✅ VGA text output - 80x25 color text mode via console driver
- ✅ Complete exception handling - All 32 x86 CPU exceptions with detailed crash reports
- ✅ Interrupt handling - IDT, ISRs, IRQs with PIC management
- ✅ Physical memory manager (PMM) - Bitmap-based page frame allocator
- ✅ Virtual memory manager (VMM) - Two-level paging, page tables, TLB management
- ✅ Timer driver (PIT) - Programmable Interval Timer at 100 Hz
- ✅ Keyboard driver - PS/2 keyboard with line buffering
- ✅ VirtualBox automation - Automated VM creation and ISO deployment
- ✅ CPU Architecture Simulator - 5-stage pipeline, single-cycle CPU, cache, and bus simulation
- ✅ 5-Stage Pipelined CPU - IF/ID/EX/MEM/WB with hazard detection
- ✅ Single-Cycle CPU - Reference implementation for comparison
- ✅ Direct-Mapped Cache - 256 lines, 32-byte blocks, hit/miss tracking
- ✅ Memory Bus Simulator - 64-bit width, 800 MHz, latency modeling
- ✅ Performance Counters - CPI, MIPS, cache statistics
- ✅ Benchmark Suite - Compare pipeline vs single-cycle performance
- ✅
ls- List directory contents with flags:-a(show dotfiles),-l(long format),-R(recursive),-h(help) - ✅
cat- Display file contents with flags:-n(line numbers),-h(help), multiple file support - ✅
stat- Show file/directory metadata: name, type, size, inode number
- 🔲 Process structures and state management
- 🔲 Context switching between processes
- 🔲 Round-robin scheduler
- 🔲 fork() system call
- 🔲 Basic process management
- Kernel heap allocator
- System calls and user mode
- Shell and userland programs
- Simple filesystem
- Advanced scheduling
- And more! See roadmap.md
make runYou should see:
OpenOS - Advanced Research Kernel
====================================
Running in 32-bit protected mode.
[1/5] Initializing IDT...
[2/5] Installing exception handlers...
[3/5] Initializing PIC...
[4/5] Initializing timer...
[5/5] Initializing keyboard...
*** System Ready ***
- Exception handling: Active
- Timer interrupts: 100 Hz
- Keyboard: Ready
Type commands and press Enter!
OpenOS> _
make isomake run-vboxThis automatically creates a VM, builds an ISO, and launches OpenOS in VirtualBox!
make benchmarkThis runs a comprehensive benchmark comparing the 5-stage pipelined CPU against the single-cycle CPU model:
OpenOS CPU Architecture Simulator
==================================
=== Pipelined CPU Benchmark ===
Instructions executed: 8192
Total cycles: 10245
Pipeline stalls: 2048
CPI: 1.251
MIPS: 799.61
=== Single-Cycle CPU Benchmark ===
Instructions executed: 8192
Total cycles: 8192
CPI: 1.000
MIPS: 1000.00
=== Cache Performance Benchmark ===
Cache hits: 3316, Cache misses: 6684
Hit rate: 33.16%
=== Memory Bus Performance ===
Bus frequency: 800 MHz, Memory latency: 24 cycles (30.0 ns)
Throughput: 6103.52 MB/s
See kernel/cpu/README.md for detailed documentation on the CPU simulator.
To build and run OpenOS, you'll need:
- gcc with 32-bit support (or i686-elf-gcc cross-compiler)
- nasm (if you plan to extend the assembly code)
- make
- qemu-system-i386 (for testing with QEMU)
- grub-pc-bin, xorriso, mtools (for creating bootable ISO)
- VirtualBox (optional, for running in VirtualBox)
Ubuntu/Debian:
sudo apt-get install gcc-multilib nasm make qemu-system-x86 grub-pc-bin xorriso mtoolsArch Linux:
sudo pacman -S gcc nasm make qemu-system-x86 grub xorriso mtoolsmacOS (with Homebrew):
brew install i686-elf-gcc nasm make qemu grub xorriso mtoolsFrom the project root directory:
makeThis will compile the kernel and produce build/openos.bin.
To build and run the kernel in QEMU with direct kernel boot:
make runThis launches QEMU with the kernel. You should see:
OpenOS - Research Kernel Prototype
-------------------------------------
Running in 32-bit protected mode.
Initializing interrupts...
Keyboard initialized. Type something!
OpenOS> _
Type on your keyboard and press Enter to interact with the shell!
OpenOS includes a built-in shell with the following commands:
| Command | Description |
|---|---|
help |
Display list of available commands |
clear |
Clear the console screen |
echo [text] |
Print text to the console |
uname |
Display OS name and version |
uptime |
Show system uptime |
pwd |
Print current working directory |
ls [-a] [-l] [-R] [-h] [path] |
List directory contents |
cd <path> |
Change current directory |
cat [-n] [-h] file [file...] |
Display file contents |
stat [-h] path |
Show file or directory metadata |
reboot |
Reboot the system |
ls [-a] [-l] [-R] [-h] [path]
| Flag | Description |
|---|---|
-a |
Include entries starting with . (dotfiles) |
-l |
Long format: shows type (d/-), size in bytes, and name |
-R |
Recursively list subdirectories |
-h |
Show help |
Examples:
OpenOS> ls /
bin/ etc/ home/ tmp/
OpenOS> ls -l /etc
- 59 motd.txt
OpenOS> ls -R /
/:
bin/ etc/ home/ tmp/
/bin:
/etc:
motd.txt
/home:
/tmp:
cat [-n] [-h] file [file...]
| Flag | Description |
|---|---|
-n |
Number all output lines |
-h |
Show help |
Examples:
OpenOS> cat /etc/motd.txt
Welcome to OpenOS!
This is a test file in the filesystem.
OpenOS> cat -n /etc/motd.txt
1 Welcome to OpenOS!
2 This is a test file in the filesystem.
stat [-h] path
Example:
OpenOS> stat /etc/motd.txt
File: motd.txt
Type: regular file
Size: 59 bytes
Inode: 6
OpenOS> stat /etc
File: etc
Type: directory
Size: 0 bytes
Inode: 2
OpenOS Phase 0 includes complete implementations of:
- Exception Handling - All 32 x86 exceptions with detailed crash reports showing registers, error codes, and faulting addresses
- Physical Memory Manager - Bitmap-based allocator supporting up to 4GB RAM
- Virtual Memory Manager - Complete two-level paging with page tables, TLB management, and region mapping
- Timer Driver - PIT configured at 100 Hz for future scheduling
- Enhanced Kernel - Clean boot messages, progress indicators, and modular design
For complete implementation details, see docs/roadmap/UPGRADE_PHASE0.md.
Want to see the exception handler in action? Add this to kernel.c:
void test_exception(void) {
volatile int x = 1 / 0; // Trigger divide-by-zero
}You'll get a detailed crash report with full register dump!
To create a bootable ISO and run in VirtualBox:
make run-vboxThis will:
- Build the kernel
- Create a bootable ISO image with GRUB (
openos.iso) - Create and configure a VirtualBox VM
- Start the VM with the ISO attached
Manual VirtualBox Setup:
If you prefer to set up VirtualBox manually:
-
Create the ISO image:
make iso
-
Create a new VirtualBox VM:
- Name: OpenOS
- Type: Other
- Version: Other/Unknown
- Memory: 512 MB (minimum)
- No hard disk needed
-
Configure the VM:
- System → Boot Order: CD-ROM first
- System → Enable I/O APIC
- Storage → Add IDE Controller
- Storage → Attach
openos.isoas CD-ROM
-
Start the VM and enjoy!
Troubleshooting: If you encounter any issues with VirtualBox, see the VirtualBox Troubleshooting Guide.
To test the ISO image in QEMU:
make run-isoOpenOS ships with a make debug target that starts QEMU paused with a GDB
server enabled so you can attach a debugger before any kernel code runs.
Terminal 1 – start QEMU in debug mode:
make debugTerminal 2 – attach GDB:
make gdbThen in GDB:
(gdb) continue # resume kernel execution
(gdb) Ctrl+C # interrupt to inspect state
(gdb) info registers # view CPU registers
For a full reference including QEMU logging (make qemu-log) and useful GDB
commands, see docs/debugging.md.
To remove build artifacts:
make cleanThe project website is hosted on GitHub Pages and lives in the docs/ directory of this repository.
https://orgito1015.github.io/My-Operating-System-OpenOS/
- Go to Settings → Pages in this repository.
- Under Build and deployment, set:
- Source:
Deploy from a branch - Branch:
main - Folder:
/docs
- Source:
- Click Save.
GitHub will publish the site within a minute or two. The URL above will go live once Pages is enabled.
| Path | Purpose |
|---|---|
docs/index.html |
GitHub Pages landing page |
docs/404.html |
Custom 404 page |
docs/assets/style.css |
Website stylesheet |
docs/architecture/ |
Architecture documentation (Markdown) |
docs/roadmap/ |
Roadmap documentation (Markdown) |
kernel/, arch/, memory/, drivers/ |
OS source code |
Makefile |
Build system |
Note: The
docs/folder serves dual purpose — it hosts the GitHub Pages website (index.html,404.html,assets/) and the project's Markdown documentation (subdirectories likearchitecture/,roadmap/, etc.). OS source code lives outsidedocs/in directories such askernel/,arch/,memory/, anddrivers/.
OpenOS welcomes contributions at all levels! Whether you're fixing a bug, adding a feature, improving documentation, or just learning, your contributions are valuable.
Please see CONTRIBUTING.md for detailed guidelines on:
- How to submit contributions
- Coding standards and style guidelines
- Testing procedures
- Areas where help is needed
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and test them
- Commit with clear messages (
git commit -m "Add amazing feature") - Push to your fork (
git push origin feature/amazing-feature) - Open a Pull Request
The /docs directory contains comprehensive documentation organized by topic:
- Documentation Index - Complete documentation guide and structure
- Architecture: System design and implementation details
- Architecture Overview - Modular monolithic architecture
- System Overview - Boot process and memory layout
- Roadmap: Development plans and milestones
- Roadmap - Future development plans
- Phase 0 Completion - Foundation implementation guide
- Evolution Strategy - 36-week development roadmap
- Boot: Bootloader and startup documentation
- Multiboot Fix - GRUB multiboot header technical details
- Virtualization: Running OpenOS in VMs
- VirtualBox Quickstart - Quick start guide
- VirtualBox Troubleshooting - Troubleshooting guide
- Refactoring: Code reorganization history
- Refactoring Guide - Migration information
- Learning: Educational materials and progress tracking
- Learning Index - Current focus and completed topics
- Development Journal - Development progress log
- Chapters - Structured learning by topic
- Lines of Code: ~2,400 (kernel + documentation)
- Source Files: 33 (organized in 7 directories)
- Exception Handlers: 32 (all x86 exceptions)
- Memory Management: PMM + VMM (fully implemented)
- Drivers: Console (VGA), Keyboard (PS/2), Timer (PIT)
- Supported Platforms: QEMU, VirtualBox, Bochs
- Documentation: 20,000+ lines (including architecture docs)
MIT License — free to use, modify, and contribute.