4–5 Minute Detailed Architecture: RustOS (x86_64 Bare-Metal Microkernel)

Target Duration: ~3.5 to 5 minutes (~650–850 spoken words)
Goal: Deliver an end-to-end architectural explanation covering bootloader handoff, CPU control tables, memory management, preemptive context switching, and the filesystem interface.


🎙️ Spoken Script & Architectural Walkthrough

To explain the complete architecture of RustOS, I divide the system into four main stages: CPU initialization and interrupt setup, physical and heap memory management, preemptive scheduling with synchronization, and the I/O and filesystem interface.


Stage 1: CPU Initialization & Hardware Setup

The kernel boots on bare metal on x86_64 in a freestanding no_std environment, meaning there is no standard library or operating system underneath.

Everything starts in kernel_main, where I initialize the core CPU structures in the following order:

  1. Global Descriptor Table (GDT): I set up the GDT with a kernel code segment configured for Ring 0 and load the Task State Segment (TSS). The TSS contains an Interrupt Stack Table (IST) with a dedicated emergency stack for handling double faults safely.
  2. Interrupt Descriptor Table (IDT): I set up handlers for CPU exceptions such as breakpoint, double fault, and page fault, along with hardware interrupts such as the timer and keyboard.
  3. 8259 PIC Remapping: I remap the hardware IRQs to interrupt vectors 32–47, keeping them separate from the CPU exception vectors 0–31. After setting up the interrupt handlers and PIC, I enable hardware interrupts using the sti instruction.

(Hook: Deep dive into Topic 01: Boot, GDT & TSS and Topic 02: IDT & PIC)


Stage 2: Physical Memory & Dynamic Heap Allocation

Once hardware interrupts are ready, I initialize memory management using the memory mappings provided by the bootloader:

(Hook: Deep dive into Topic 03: 4-Level Paging and Topic 04: Heap & Allocators)


Stage 3: Round-Robin Preemptive Multitasking & Synchronization

With the heap active, I initialize preemptive multitasking:

(Hook: Deep dive into Topic 05: Multitasking & Mutex)


Stage 4: VGA Driver, Interactive Shell & In-Memory Filesystem

On top of this multitasking core, I implemented the driver and user-facing layer:

(Hook: Deep dive into Topic 06: VFS & Shell)