1–2 Minute Brief Pitch: RustOS (x86_64 Bare-Metal Microkernel)

Target Duration: 60–90 seconds (~180–220 spoken words)
Goal: Deliver a clear, plain-English overview of why the project was built, its full scope, and key mental models learned, avoiding low-level implementation minutiae while dropping strategic follow-up hooks for the interviewer.


🎙️ Spoken Script (Plain English & Conversational)

"I started this project by following a Rust OS tutorial to understand the basic kernel structure and how a bare-metal x86_64 system boots. Once I understood the foundation, I extended the kernel with preemptive multitasking, context switching, synchronization, a hierarchical filesystem, and an interactive shell.

The main goal was to understand how an operating system handles hardware, memory, and concurrent tasks without relying on an underlying OS.

I divided the project into four main parts.

First was CPU initialization and interrupt handling. I configured the GDT and IDT, set up the TSS with a dedicated IST stack for double-fault handling, and configured hardware interrupts for the timer and keyboard.

Second was memory management. Using the memory map provided by the bootloader, I implemented physical frame allocation and created a virtual-to-physical memory mapper to manipulate the page tables. Then I implemented a heap allocator using fixed-size blocks, which allowed the kernel to use dynamic data structures such as Vec and String.

Third was preemptive multitasking and synchronization. I implemented a round-robin scheduler driven by hardware timer interrupts. On each timer interrupt, the current task's register context is saved on its kernel stack, the scheduler selects the next ready task, and the kernel switches to that task's saved context. I also implemented mutexes and counting semaphores for synchronization between tasks.

Finally, I worked on the I/O and filesystem layer. I implemented a memory-mapped VGA text driver, keyboard input handling, an in-memory hierarchical filesystem with basic CRUD operations, and an interactive shell running as a kernel task.

Overall, extending the initial kernel gave me hands-on experience with x86_64 interrupt handling, paging and memory management, context switching, preemptive scheduling, and kernel synchronization."


🪝 What the Interviewer Gets Hooked Into (Strategic Follow-Ups)

What You Mentioned Why It Was Done (The Motivation) Problems Faced & How Solved (The Reality) Target Deep-Dive Document
"Tutorial foundation vs. custom kernel extensions" Understand bare-metal fundamentals before engineering complex OS subsystems. The tutorial only covered basic booting, paging, and cooperative async; I extended it with true preemptive scheduling, naked assembly context switching, PCB queues, blocking mutexes/semaphores, and an in-memory VFS/shell. Topic 05: Multitasking & Mutex
"GDT, TSS & double-fault emergency stack" Guarantee CPU fault safety when kernel stacks overflow in Ring 0. Configured an Interrupt Stack Table (IST[0]) inside the Task State Segment, preventing fatal triple faults. Topic 01: Boot, GDT & TSS
"IDT & 8259 PIC remapping" Avoid collisions between x86 hardware IRQs and CPU exception vectors. Remapped PIC interrupts 0–15 to vectors 32–47 and unmasked timer (IRQ 0) and keyboard (IRQ 1). Topic 02: IDT & PIC
"Physical frame allocator & 4-level paging" Transition from bootloader identity paging to controlled virtual memory mapping. Read bootloader memory map to track usable physical frames; navigated PML4 page tables using CR3 offset mapping. Topic 03: 4-Level Paging
"Fixed-Size Block Heap Allocator" Support dynamic heap allocations (Box, Vec) in no_std without external fragmentation. Implemented power-of-two free lists (8B to 2048B) backed by a 100 KiB heap, providing $O(1)$ allocation/deallocation. Topic 04: Heap & Allocators
"Naked assembly timer ISR & preemptive context switching" Achieve true preemptive multitasking without cooperative yielding. Used naked_asm! to push 15 general-purpose registers, swap rsp inside the scheduler, and pop registers before iretq. Topic 05: Multitasking & Mutex
"In-memory VFS & interactive shell" Provide an end-to-end interactive operating system experience. Built a tree-structured hierarchical VFS with CRUD support and a preemptive shell task reading PS/2 keyboard buffers. Topic 06: VFS & Shell

❓ Anticipated Quick-Fire Follow-Up Questions (Direct from the 90s Pitch)

Q1: Which parts did you learn from the tutorial, and what did you build independently?

Answer: I used Philipp Oppermann's Writing an OS in Rust tutorial as a starting point to learn bare-metal x86_64 booting, GDT/TSS configuration, IDT exception handling, PIC remapping, and basic paging. However, the tutorial stopped at basic cooperative async/await multitasking and had no filesystem or shell. I independently designed and implemented the entire preemptive multitasking subsystem: naked assembly context switching via timer interrupts, PCB lifecycle management, blocking sleep-mutexes and counting semaphores, an in-memory hierarchical VFS with CRUD support, and an interactive shell running as a kernel task.

Q2: How does your preemptive multitasking work compared to cooperative multitasking?

Answer: In cooperative multitasking, tasks must voluntarily yield CPU control. If a task hangs in an infinite loop, the entire OS freezes. In my preemptive scheduler, hardware timer interrupts (IRQ 0 / Vector 32) fire periodically. On each tick, a naked assembly handler pushes the 15 general-purpose registers onto the task's private stack, calls the Rust scheduler to swap the stack pointer (rsp) to the next ready task in the round-robin queue, pops the new task's registers, sends EOI, and executes iretq. This guarantees bounded latency and prevents any single task from monopolizing the CPU.

Q3: Why did you set up a dedicated IST stack in the TSS for double-fault handling?

Answer: When an exception occurs on x86_64, the CPU attempts to push the exception stack frame onto the current stack. If the fault was caused by a kernel stack overflow, pushing to that same stack fails, triggering a second exception (a double fault). Without a dedicated Interrupt Stack Table (IST), the double fault handler also tries to use the same corrupted stack, immediately escalating into a fatal hardware triple fault and resetting the machine. Configuring IST[0] in the Task State Segment ensures the CPU automatically switches to a known-clean emergency stack upon a double fault.

Q4: How does your fixed-size block heap allocator compare to a standard bump or linked-list allocator?

Answer: A bump allocator is $O(1)$ for allocation but cannot free individual allocations, causing memory exhaustion. A simple linked-list allocator can free memory but suffers from severe external fragmentation and $O(N)$ allocation latency. My fixed-size block allocator maintains separate free lists for power-of-two sizes (8, 16, 32, ... 2048 bytes). Small requests allocate and free in $O(1)$ time with zero external fragmentation within blocks, while allocations exceeding 2048 bytes fall back to a linked-list allocator.

Q5: You mentioned Mutex/Semaphore synchronization in your resume. Where did you use the semaphore in your project?

Answer: I implemented a counting semaphore as part of the kernel synchronization layer, but I did not actually use it in the final task implementation. The shared-data synchronization I used in my tasks was done using the mutex.