Systems Engineering · OS Kernel · Mar 4, 2022
eXpOS: Experimental Operating System
Built a working operating system kernel from scratch for the Experimental String Machine (XSM) architecture, implementing process scheduling, virtual memory paging, interrupt handlers, file system operations, and system calls.
Problem Statement
Operating system concepts like virtual memory, context switching, exception traps, and concurrency primitives often stay abstract in textbooks. Implementing a complete kernel end-to-end forces every invariant, from page table entries to disk inode locking, to hold under real execution.
Architecture & Design Decisions
Layered kernel architecture running on the XSM hardware simulator: bootstrap loader, interrupt service routines (INT 4–15), timer-driven round-robin scheduler, demand-paged virtual memory manager, and an XFS disk filesystem interface.
Overview
eXpOS (Experimental Operating System) is a full operating system implementation built from scratch at NIT Calicut targeting the Experimental String Machine (XSM) hardware simulator. Rather than simulating OS behavior in a high-level language, every kernel module, interrupt handler, and memory routine is compiled down to XSM machine instructions and loaded onto a simulated disk via the XFS interface.
User Programs (ExpL)
ABI Syscall Traps
Interrupt Handlers
Timer · Exception · File · Process
Kernel Modules
Scheduler · Memory · Resource · Device
XSM Hardware
Paging · Registers · Disk & Console
Core Subsystems Implemented
1. Bootstrapping & Process Lifecycle
- Designed the OS startup routine to initialize memory free lists, page tables, the process table, and launch the
inituser process. - Implemented
Fork,Exec,Exit,Wait, andSignalsystem calls to support multi-process execution and parent-child synchronization.
2. Virtual Memory & Demand Paging
- Configured per-process page tables mapping logical user addresses to physical XSM memory frames.
- Implemented exception handling (page faults) to dynamically load code blocks from disk on demand and share read-only code pages across processes.
3. Round-Robin Scheduler & Synchronization
- Built a preemptive timer interrupt handler that saves/restores full register contexts across user and kernel stacks.
- Added resource manager routines for acquiring/releasing terminal, disk, and inode locks safely across concurrent processes.
4. File System & XFS Interface
- Implemented file creation, deletion, buffered read/write, and open-file table management interacting with the XFS disk layout.
What This Taught Me
Building an operating system from the ground up permanently changed how I debug backend and cloud applications. Concepts like context switching overhead, memory locality, lock contention, and I/O blocking stopped being theoretical vocabulary and became concrete mental models I use every day.
Engineering Challenges
- Coordinating kernel-mode vs user-mode stack transitions without corrupting register contexts during nested interrupts.
- Implementing demand paging and copy-on-write fork semantics while avoiding deadlocks on shared disk and inode locks.
- Debugging low-level XSM machine instructions and memory tables without high-level runtime diagnostics.
What I Learned
- Deep intuition for how syscalls, virtual address translation, process tables, and file descriptors actually interact beneath application code.
- Why clean ABI boundaries and strict locking hierarchies are indispensable in stateful systems.