Inbora Studio Systems Research • Technical Report TR-2026-Q4
Quin OS 2: Architecture, Implementation, and Empirical Evaluation of a Freestanding 64-Bit Operating System
A Five-Year Longitudinal Investigation in Kernel Design, Memory Virtualization, Preemptive Multiprocessing, Hardware 3D Acceleration, Dual-Stack Networking, and Freestanding Userspace Isolation
Dr. Chamyoung (also known as Alok) — Lead Operating System Researcher & Systems Architect
Inbora Studio Systems & Artificial Intelligence Group
Research Commenced: June 2021 • Current Revision: November 2026 • Codebase Lineage: Successor to XuNet OS (32-Bit) • Release: Quin OS 2.2.0-beta
Abstract
Constructing an operating system from bare metal requires solving multi-dimensional synchronisation, virtualization, and hardware communication challenges without relying on an underlying POSIX libc or host runtime. In this report, we present the design, low-level implementation, and empirical evaluation of Quin OS 2, an independent 64-bit operating system for the x86_64 (AMD64) architecture developed continuously over a five-year timeline (2021–2026) at Inbora Studio under the direction of Dr. Chamyoung (Alok).
Originating as an educational 32-bit protected-mode kernel (XuNet OS), Quin OS 2 now embodies a production-grade monolithic core transitioning toward an isolated server architecture. Subsystems described in this paper include: an order 0–10 buddy allocator with 32-bit atomic Copy-on-Write reference counting; a 4-level PML4 Virtual Memory Manager with Higher-Half Direct Mapping (HHDM at 0xFFFF800000000000); an ACPI MADT-enumerated preemptive Symmetric Multiprocessing (SMP) scheduler incorporating cycle-accurate TSC frame pacing; a VirtIO-GPU 3D (virgl) hardware graphics engine backed by Mesa 24.0.9 and a band-parallel 3D engine reaching 71–91 FPS; an in-tree dual-stack IPv4/IPv6 networking engine featuring RFC 2018 SACK TCP and HTTP keep-alive connection pooling; an integrated desktop shell comprising a global top Menu Bar, Spotlight search, Mission Control overview, and smoothstep dock; and an expansive userspace ecosystem backed by musl libc 1.2.4 dynamic linking (`PT_INTERP`, `dlopen`), LLVM libc++ C++23, CPython 3.12, native Rust toolchain support, on-device Large Language Model (LLM) inference running at 498 tokens/second, and a native package ecosystem (MuPDF 1.28.5 PDF viewer, AES-256-GCM password vault, OpenStreetMap maps, Archive manager, calendar.ics, and Quin Studio IDE with .qsp packages). We document critical race condition resolutions, present exhaustive architectural comparison tables against the Linux Kernel and TempleOS, and evaluate boot throughput, graphics pipelines, and runtime efficiency.
Operating system research within Inbora Studio began in mid-2021 with the creation of XuNet OS, an exploratory 32-bit x86 system. Over the subsequent five years, this foundation was completely re-architected to realize a resilient, isolated 64-bit operating system capable of native hardware graphic composition, 3D GPU acceleration, high-throughput dual-stack network communication, on-device machine learning inference, and self-hosted application compilation.
1.1 The 32-Bit Genesis: XuNet OS (2021)
The predecessor project, XuNet OS, focused on early bare-metal primitives: executing the 16-bit real-mode to 32-bit protected-mode transition, programming the 8259 Programmable Interrupt Controller (PIC) to remap IRQs 0–15 to interrupt vectors 0x20–0x2F, reading FAT12 floppy structures, and issuing BIOS INT 10h calls to initialize 640×480 VESA VBE linear framebuffers. While pedagogically successful, XuNet OS revealed inherent limitations: lack of hardware-enforced memory isolation, 32-bit physical addressing boundaries (capped at 4 GB without PAE), and an inability to scale across modern multi-core x86_64 architectures.
1.2 Chronological Research & Implementation Matrix
The progression of the codebase across the five-year continuum is documented below:
2021 — Year 1: XuNet OS Baseline
32-Bit Protected Mode, Interrupt Handlers, and FAT12
Constructed custom two-stage bootloader; established GDT segments (Ring-0 Code/Data); trapped CPU exceptions (0–31); developed basic PS/2 keyboard scancode decoders and a text-mode shell. Explored early graphic primitives using VESA VBE linear framebuffers.
2022 — Year 2: The 64-Bit Long Mode Transition
Architecture Reset, Multiboot2, and 4-Level Paging
Initiated clean-slate 64-bit redesign (Quin OS 1). Replaced custom bootloader with GRUB2 Multiboot 1 & 2 compliance in kernel/arch/x86_64/boot.asm. Implemented initial identity page tables using 2 MB huge pages, engaged Long Mode via IA32_EFER.LME, established the Higher-Half Direct Map (HHDM) starting at 0xFFFF800000000000, and constructed a 256-gate Interrupt Descriptor Table (IDT).
2023 — Year 3: Memory Virtualization & Multiprocessing
Buddy Allocator, Copy-on-Write, and SMP Wakeup
Authored physical frame allocator in pmm.c operating an order 0–10 buddy hierarchy. Engineered the 4-level Virtual Memory Manager (vmm.c) supporting demand paging, 2 MB huge page splitting, and Copy-on-Write (CoW) address space cloning for sys_fork(). Implemented ACPI RSDP/MADT table parsing, firing INIT-SIPI-SIPI sequences through the Local APIC to awaken Application Processors via a 16-bit real-mode trampoline at physical 0x8000.
2024 — Year 4: Graphics Engine & Persistent Storage
QDS Double-Buffering, QWM Compositor, and Ext2
Breakthrough in desktop graphics: developed the double-buffered Quin Display Server (QDS) and the integer-only Quin Anti-Aliased Engine (QAA). Developed the floating Quin Window Manager (QWM) supporting 32 concurrent windows with 7-pixel hit-test resizing and live snapping. Brought up the VirtIO-GPU modern PCI driver supporting 2560×1440 resolution. Developed the Ext2 read/write driver on VirtIO-Blk with raw superblock preservation and hardware disk safety guards.
RFC 793 TCP Engine, AC97 DMA, and musl libc Integration
Authored a complete RFC 793 TCP/IP stack from bare metal in pure C (sliding window, Jacobson/Karels dynamic RTO estimation). Integrated DHCP, DNS, HTTP client with gzip decoding (miniz), and SNTP clock sync (ntp.c). Developed Intel 82801AA AC97 audio driver with DMA circular buffers and microphone recording input (/dev/audioin). Cross-compiled musl libc 1.2.4, implemented ELF64 loader with SysV AMD64 ABI stack frames, and enabled Ring-3 execution.
2026 (Q1–Q3) — Quin OS 2: Isolation, Ported Engines, and Self-Hosting
POSIX Syscall Expansion, Ported Engines, and Desktop Physics
Expanded POSIX syscall matrix to 65+ entries. Ported litehtml box-model layout with QuickJS-ng ES2020 JavaScript engine for live web browsing; ported MPEG-1/MP2 hardware-timed streaming video player, Chipmunk2D physics sandbox, and Stockfish chess engine. Developed the QuinDev IDE featuring an in-tree Tiny C Compiler (TCC), enabling native C compilation directly inside Quin OS. Initiated architectural migration of QWM into an isolated privileged userspace server.
2026 (Q4 - Present) — Architectural Maturity: 3D GPU, Dual-Stack Net, Dynamic Linking & AI
VirtIO-GPU 3D (Virgl), Mesa 24, SACK TCP, IPv6, Shared Libraries, LLM Inference, and Modern Shell
Brought up host 3D GPU hardware acceleration via VirtIO-GPU Virgl (SYS_GPU3D) and ported Mesa 24.0.9 OpenGL, powering the Quincraft 1.5 3D engine at 71 FPS @ 960x540 and 50 FPS @ 2560x1440 (alongside band-parallel CPU rasterization achieving 73-91 FPS). Developed complete dual-stack IPv4/IPv6 networking (SLAAC, NDP, ICMPv6), RFC 2018 SACK TCP with scoreboard recovery, and HTTP keep-alive connection pooling. Implemented PT_INTERP dynamic linking via musl ldso (dlopen, shared libc.so), full LLVM libc++ C++23 standard library, CPython 3.12, native Rust toolchain support, and on-device Large Language Model inference (llama2.c 15M TinyStories at 498 tokens/sec). Engineered a top Menu Bar, Spotlight search, Mission Control overview, QuinShift radial ring, Screen Recorder (Motion-JPEG AVI + 48kHz audio), and a native package ecosystem (MuPDF 1.28.5 PDF viewer, AES-256 password vault, OpenStreetMap maps, Archive manager, calendar.ics).
1.3 Architectural Tenets
The development methodology enforces three strict engineering rules:
Freestanding Ring-0 Execution: The kernel binary links zero third-party C runtime libraries. String manipulation, memory barriers, hashing routines (SHA-256), and cryptographic LFSRs are implemented directly within the source tree.
Honest Missing Features: Rather than providing dummy function returns that silently fail later in user-space, unimplemented subsystems return explicit error codes (e.g. -ENOSYS) or are omitted until fully functional.
Headless Visual Verification: Window-manager layout, clipping logic, and raster operations are verified headlessly through automated QEMU monitor memory screen dumping (screendump), ensuring render state matches internal compositor buffers.
Execution initiates in 32-bit protected mode when GRUB2 transfers control to the entry point defined in kernel/arch/x86_64/boot.asm. The binary embeds both Multiboot 1 and Multiboot 2 header tags within the first 32 KB:
Listing 1: Multiboot headers in boot.asm specifying graphical framebuffer handover.
Prior to entering Long Mode, boot.asm executes CPUID checks verifying that the processor supports 64-bit execution (bit 29 of EDX from function 0x80000001). Paging is bootstrapped by identity mapping the lowest 1 GB of physical memory using 2 MB huge pages:
boot_pml4[0] references boot_pdpt with flags 0x03 (Present | Writable).
boot_pdpt[0] references boot_pd.
boot_pd initializes 512 entries mapping physical addresses 0x00000000 through 0x3FFFFFFF using flags 0x83 (Present | Writable | Huge Page 2MB).
boot_pml4[256] is initialized pointing to boot_pdpt, mapping the Higher-Half Direct Map (HHDM) starting at virtual address 0xFFFF800000000000.
Virtual Address Space Layout:
0x0000000000000000 - 0x00007FFFFFFFFFFF [Lower Half: 128 TB Ring-3 Userspace]
├── 0x0000000000400000 : ELF64 Image Base (Randomized via ASLR)
├── 0x0000500000000000 : Dynamic mmap Base (Grows Upwards)
├── 0x0000700000000000 : Dynamic Linker Base (musl ldso + 2MB ASLR Slide)
└── 0x00007FFFFFFFF000 : Userspace Process Stack Top (16 MB)
0xFFFF800000000000 - 0xFFFFFFFFFFFFFFFF [Higher Half: 128 TB Ring-0 Kernel Space]
├── 0xFFFF800000000000 : Higher-Half Direct Map (HHDM) — All Physical RAM
├── 0xFFFF800000100000 : Kernel ELF Image (Physical 1 MB)
├── Post-Kernel End : PMM Bitmap & Frame Metadata Tables
└── Post-Bitmap : Kernel Heap (kmalloc Slab Pools)
Figure 1: Virtual address decomposition and Higher-Half Direct Map (HHDM) architecture.
To switch execution modes:
; Load CR3 with physical address of PML4
mov eax, boot_pml4
mov cr3, eax
; Enable Physical Address Extension (PAE) in CR4
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; Enable Long Mode (LME) in IA32_EFER MSR (0xC0000080)
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; Engage Paging (PG) and Protection (PE) in CR0
mov eax, cr0
or eax, (1 << 31) | (1 << 0)
mov cr0, eax
; Far jump into 64-bit code segment
jmp 0x08:long_mode_entry
Listing 2: Long Mode transition sequence in kernel/arch/x86_64/boot.asm.
2.2 The Deterministic Kernel Initialization Sequence (`main.c`)
Upon landing in 64-bit mode, kernel_main() executes a deterministic 14-stage initialization sequence:
serial_init(): Configures UART 16550 COM1 at I/O port 0x3F8 (115200 baud, 8N1).
stack_canary_init(): Seeds __stack_chk_guard with entropy from rdtsc and PIT jitter.
pmm_init(): Iterates Multiboot memory entries, registering physical frames into the buddy allocator.
init_qwm(): Calibrates TSC frame pacing and enters the non-returning desktop compositor event loop.
2.3 Real Crash Core Dump Engine (`panic.c`)
When a kernel panic or unhandled fault occurs, Quin OS 2 executes an automated crash-dump facility. Rather than halting the CPU immediately, the panic handler serializes the entire 64-bit register state (RAX, RBX, RCX, RDX, RSI, RDI, RBP, RSP, R8–R15, RIP, RFLAGS, CR0, CR2, CR3, CR4) along with stack memory words to persistent storage (/crash.dump via virtio-blk direct write) and COM1 serial. This provides post-mortem diagnostics equivalent to enterprise Unix core dumps.
When an order $k$ block is requested, the allocator checks free_lists[k]. If exhausted, it recursively locates an available block at order $j > k$, splits the block into two equal halves (buddies), and enqueues the unallocated buddy into free_lists[j-1]. The buddy index calculation utilizes bitwise XOR:
On deallocation, the allocator determines whether the buddy frame is unallocated and merges them upward into order $k+1$, mitigating physical fragmentation. To ensure memory safety, pmm.c incorporates double-allocation verification and free-list pointer sanitization to catch corrupted node pointers before they contaminate the free pool.
Copy-on-Write (CoW) Fork Implementation: When sys_fork() clones a process, vmm_clone_address_space() iterates over the lower-half address space ($< 0xFFFF800000000000$). Writable leaf page table entries have their Writable bit (bit 1) cleared and a custom software CoW bit set. The atomic reference count in pmm_refcount[frame] is incremented. When either the parent or child writes to the page, a CPU Page Fault (Vector 14, #PF) is triggered with error code bit 1 set (Write violation). The handler verifies the CoW flag:
If pmm_refcount[frame] == 1, the page is unique: the Writable bit is immediately restored and the TLB invalidated (invlpg).
If pmm_refcount[frame] > 1, a new 4 KB frame is allocated via pmm_alloc_frame(), the original 4 KB data copied, the page table updated to point to the new frame with write permissions, and the original frame's reference count decremented.
3.3 Kernel Slab Allocator (`heap.c`)
The dynamic kernel heap provides kmalloc() and kfree() through size-classed slab caches for allocations between 16 bytes and 2048 bytes (powers of two). Allocations exceeding 2048 bytes bypass the slab allocator and are serviced directly by order-aligned buddy allocations in pmm.c, mapped into the HHDM region. Guard canary values are embedded at each slab header to trap buffer overruns.
4. Preemptive Multi-Core SMP Scheduling
4.1 Application Processor Startup & Per-CPU State
Application Processors (APs) are enumerated during boot by traversing ACPI RSDP $\rightarrow$ RSDT/XSDT $\rightarrow$ MADT (Multiple APIC Description Table, signature "APIC"). For each detected processor, the Bootstrap Processor (BSP):
Copies a 16-bit real-mode assembly trampoline to physical address 0x8000.
Issues an INIT Inter-Processor Interrupt (IPI) via the Local APIC ICR register (0xFEE00300).
Delivers two Startup IPIs (SIPI) with vector 0x08 (specifying physical page 0x8000).
The AP awakens, enters 32-bit protected mode, activates Long Mode with the kernel's shared PML4, and initializes its per-CPU TSS and GDT segments.
Each core maintains an independent per_cpu_t structure containing three circular priority run-queues (High, Normal, Low) and an idle thread. Interrupts are distributed via the I/O APIC.
4.2 Slicing Mechanics & TSC Frame Calibration
The scheduling heartbeat is driven by the 8254 Programmable Interval Timer (PIT) programmed to 100 Hz (10 ms time-slices) in Mode 2 (Rate Generator) using divisor 11932. Mode 2 ensures deterministic periodic ticks, avoiding irregular square-wave phase jitter observed under Mode 3. On each tick, the LAPIC timer on each core decrements the running thread's time slice, triggering a context switch when expired.
To ensure buttery-smooth desktop animations, the compositor incorporates cycle-accurate TSC calibration measured over 100 ms at startup. While the scheduler runs at a 10 ms heartbeat, desktop redraws lock to a jitter-free 60 Hz beat derived from the Time Stamp Counter (TSC), eliminating visible frame stutter during window drags.
During multi-core stress testing, a critical race condition emerged in cross-core thread migration. When CPU 0 entered switch_context() to yield Thread A, it acquired the scheduler lock, updated Thread A's state to READY, and proceeded to execute the assembly register spill. Concurrently, CPU 1 observed Thread A in READY status, stole the thread, and read thread->rsp to begin execution on CPU 1 before CPU 0 finished writing its updated stack pointer and executing `ret`. This dual-execution on the same kernel stack caused catastrophic stack corruption.
Resolution: The context switch protocol was redesigned into an atomic spinlock-handover trampoline (kernel/arch/x86_64/switch.asm):
global switch_context_locked
switch_context_locked:
push rbx
push rbp
push r12
push r13
push r14
push r15
mov [rdi], rsp ; Store old thread RSP atomically
mov rsp, [rsi] ; Load new thread RSP
; Release scheduler spinlock AFTER RSP is safely loaded
mov qword [rdx], 0 ; Atomic store releases lock
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rbx
ret
5. System Calls, Kernel Security & SysV AMD64 ABI
5.1 Fast System Call Entry & CVE-2012-0217 Mitigation
System calls enter Ring 0 via the x86 SYSCALL instruction. Model Specific Registers (MSRs) are initialized per-core during boot:
IA32_STAR (0xC0000081): Encodes kernel and user code/data segment selectors.
IA32_LSTAR (0xC0000082): Configured with the 64-bit entry address of syscall_entry in kernel/arch/x86_64/syscall.asm.
IA32_FMASK (0xC0000084): Low 32 bits programmed to mask RFLAGS.
On Intel x86_64 processors, if the SYSRET instruction is executed when the return address in RCX is a non-canonical address or if the Alignment Check (AC) bit in RFLAGS is asserted, the processor generates a General Protection Fault (#GP) in Ring 0 rather than Ring 3. An attacker can exploit this to achieve arbitrary kernel privilege escalation.
Quin OS eliminates this vulnerability at the hardware register level by configuring IA32_FMASK to mask bit 18 (AC), bit 9 (IF), and bit 10 (DF):
; Clear IF (0x200), DF (0x400), and AC (0x40000) on SYSCALL entry
mov ecx, 0xC0000084
mov eax, (1 << 9) | (1 << 10) | (1 << 18)
xor edx, edx
wrmsr
5.2 POSIX & Quin OS Windowing Syscall Matrix
Quin OS 2 implements a robust 65+ syscall interface adhering to the System V AMD64 ABI calling convention: parameters passed in RDI, RSI, RDX, R10, R8, R9; syscall number in RAX; return value in RAX.
Table 1: SysV AMD64 system call dispatch table implemented in kernel/src/syscall.c.
5.3 Address Space Layout Randomization & Canary Hardening
Address Space Layout Randomization (aslr.c) randomizes the base load address of Position Independent Executables (PIE), shared libraries, the heap (brk), and mmap allocations. The random offset is generated using a 64-bit Galois Linear Feedback Shift Register (LFSR) seeded by hardware entropy:
All kernel C files are compiled with -fstack-protector-all. During bootstrap, stack_canary_init() seeds __stack_chk_guard with rdtsc jitter and timer entropy. Every function epilogue validates this guard word; an overrun immediately redirects to __stack_chk_fail(), halting the offending thread before corrupted return addresses can be popped into RIP.
6. Graphics Architecture, Compositor & QWM Desktop Shell
6.1 Double-Buffered Composition Engine (`qds.c`)
The Quin Display Server maintains two full-resolution ARGB32 surfaces: a front buffer mapped directly to physical display MMIO (VirtIO-GPU or Bochs BGA) and a heap-allocated back buffer. To maximize throughput on high-resolution displays (2560×1440 at 32 bpp, requiring 14.7 MB per frame), QDS implements dirty damage rectangle tracking:
When windows are dragged or content reflows, only the dirty bounding region is transferred across the PCI bus via VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D and VIRTIO_GPU_CMD_RESOURCE_FLUSH, reducing bus transfer volume by up to 88% during typical desktop use.
6.2 Anti-Aliasing & Acrylic Blur (`qaa.c`)
The Quin Anti-Aliased Engine (QAA) provides sub-pixel font rendering and geometric drawing without floating-point or SSE instructions:
Coverage-Based Antialiasing: Computes corner alpha coverage for rounded rectangles using fast integer square-root approximations.
Acrylic Frosted Glass: Implements a multi-pass horizontal and vertical box blur over cached window backdrops, enabling translucent blur effects for titlebars and the system dock.
6.3 Top Menu Bar (`menubar.c`) & Context Menus (`context_menu.c`)
The desktop user interface is governed by an integrated top Menu Bar (30 px height) that supersedes traditional start menus:
System & Application Menus: Features the unified Quin Menu (About, System Settings, System Monitor, Files, Lock Screen, Restart, Shut Down) on the left, paired with dynamic standard application menus (File, Edit, View, Window, Help) dished directly to the foreground window via automated synthetic keystroke injection (e.g. Edit triggers Ctrl+Z/Y/X/C/V/A without requiring app-side plumbing).
Status Chrome: Houses live playback spectrum level meters, network state, a master volume slider, Spotlight launcher, and a real-time calendar clock that pops open an interactive month view on click.
Redesigned Context Menus: Sized dynamically to fit text, featuring baked icon glyphs (ctx_icons.h), checkmarks, delete highlights, submenu expansion, and full arrow/Return/Escape keyboard navigation.
6.4 Spotlight Global Search & Math Engine (`spotlight.c`)
Invoked instantaneously with Ctrl+Space or Super+Space, the Spotlight search system bridges desktop navigation and productivity:
Real-Time Filesystem Indexer: Progressively crawls /home/user in background slices across frames, caching index metadata for 30 seconds with zero frame stutter.
Tiered Relevance Ranking: Employs strict multi-tier ranking: Exact match > Prefix match > Word boundary start > Initials heuristic (e.g. fm immediately ranks File Manager first) > Substring.
Embedded Arithmetic Calculator: Evaluates inline mathematical expressions (e.g. 12 * (3 + 4)) via an in-kernel AST parser, allowing users to press Return to automatically copy evaluated results to the clipboard.
6.5 Mission Control Window Overview & Task Switching (`taskview.c`)
Quin OS provides two native task switching paradigms:
Live Alt+Tab Switcher: Holding Alt and pressing Tab reveals an acrylic frosted panel displaying live, box-filtered thumbnails of open window canvases in MRU (Most Recently Used) order.
Mission Control Window Overview: Triggered via Super+Tab or resting the cursor in the top-left hot corner for 200 ms. The desktop smoothly dims and all active windows smoothly animate into an interactive, non-overlapping grid complete with application titles, icons, and one-click close buttons.
6.6 Advanced Drag-and-Drop & QuinShift Radial Ring
The window manager integrates a comprehensive cross-window drag-and-drop subsystem:
Pointer Drag Cards (`dragfx.c`): Dragging any file in File Manager creates a floating translucent drag card that follows the mouse cursor and delivers precise client-relative landing coordinates (@x,y).
QuinShift Radial Tool Ring (`r3_quinshift`): Holding the middle mouse button or holding Shift while dragging a file summons an innovative circular tool ring overlay. Users release the pointer over radial segments to execute instant file conversions, image rotations, or tool invocations.
Desktop Folder Synchronization (`desktop_files.c`): Scans ~/Desktop periodically, rendering real file icons with badges for symlink shortcuts, backed by asynchronous multi-threaded file operations (deskfiles).
6.7 Screen Capture & Motion-JPEG System Recorder (`capture.c`, `clip.c`)
Built directly into the window management architecture:
Screen Capture Tool (`r3_capture`): Triggered via PrintScreen or Super+Shift+S. Freezes screen composition and provides area, window, or full-screen selection with rich annotation tools (pen, highlighter, arrows, text, pixelation, and PNG export).
Hardware Screen Recorder: Triggered via Alt+PrintScreen or Super+Shift+R. Records selectable screen regions into Motion-JPEG AVI containers with 48 kHz stereo PCM audio captured directly from the AC97 DMA audio input device (/dev/audioin).
Clipboard History & Emoji Vault (`r3_clipboard`): Summoned via Super+V. Caches up to 64 items (text, pictures with thumbnails, files), allows item pinning, and includes an interactive library of 1,898 unicode emojis, symbols, and kaomojis.
7. Hardware 3D Acceleration, Mesa & GPU Architecture
7.1 VirtIO-GPU 3D (Virgl) Protocol & Kernel Syscall (`virgl.c`, `gpu3d.c`)
Quin OS 2 bridges the gap between software framebuffers and hardware-accelerated 3D graphics by implementing the VirtIO-GPU 3D Virgl protocol. Through the modern PCI capability structure, the kernel negotiates 3D command submission rings:
The SYS_GPU3D system call grants userspace applications direct, isolated access to the host GPU:
Context Isolation: Each open context maintains a dedicated descriptor and state table bound to the calling process, auto-reclaimed on process exit.
Zero-Copy Memory Mapping: Physical frames allocated from the kernel buddy allocator are mapped into Virgl resource backing stores, allowing shared zero-copy transfers between guest userspace and host GPU buffers.
High-Throughput Command Streaming: Batched Virgl command packets (up to 128 KB per submission) are dispatched directly into the VirtIO virtqueue, eliminating per-primitive kernel transition overhead.
7.2 Mesa 24.0.9 OpenGL Integration
Quin OS integrates a cross-compiled build of Mesa 24.0.9 featuring the OSMesa frontend and Gallium Virgl driver. When launched, Mesa exposes a full OpenGL 4.3 Compatibility Profile backed by the host's physical GPU (e.g. AMD Radeon / NVIDIA GeForce), with automatic fallback to softpipe software rasterization (OpenGL 3.3) when running under non-accelerated hypervisors.
7.3 Quincraft 1.5 3D Engine Architecture
The capabilities of the graphics subsystem are demonstrated in Quincraft 1.5, a native 3D voxel sandbox engine engineered for Quin OS 2:
Renderer Pipeline
Resolution & Settings
Frame Duration
Measured Throughput
Hardware Virgl GPU (Host Acceleration)
960×540, Render Distance 8
14.0 ms
71.4 FPS
Hardware Virgl GPU (Host Acceleration)
2560×1440, Render Distance 8
20.0 ms
50.0 FPS
Multi-Core Band-Parallel CPU (8 Cores)
2560×1440, Render Distance 8
11.0 ms
90.9 FPS
Multi-Core Band-Parallel CPU (4 Cores)
2560×1440, Render Distance 8
13.6 ms
73.5 FPS
Single-Threaded Baseline CPU (Quincraft 1.4)
2560×1440, Render Distance 8
63.0 ms
15.8 FPS
Table 2: Empirical rendering benchmarks of Quincraft 1.5 under Virgl GPU and Band-Parallel CPU pipelines.
Architectural Breakthroughs in Quincraft 1.5:
GPU Zero-Fence Pipelining (`qc_glworld.c`): Chunks upload as pre-computed GPU vertex buffers. Vertex shaders calculate model-view-projection transforms, vertex illumination, and fog coordinates; fragment shaders execute texture atlas sampling. Command fences are eliminated, avoiding 10 ms hypervisor timer stalls.
Band-Parallel CPU Rasterizer (`qc_raster.c`, `qc_par.c`): The CPU renderer divides the framebuffer into horizontal row bands distributed across all available SMP CPU cores with zero lock contention.
Hierarchical Tile Depth Occlusion: Tracks the farthest depth of every 16×8 pixel tile per band. Triangles occluded behind previously drawn geometry are rejected before row walking begins, skipping over 93% of hidden triangles.
Vectorized SSE2 Shading: Evaluates lighting and fog four pixels simultaneously using 128-bit SIMD registers, skipping fully occluded pixel spans eight pixels at a time.
8. Dual-Stack Networking & RFC 793 / 2018 Transport Engine
Quin OS 2 incorporates a complete, freestanding dual-stack networking subsystem written in pure C:
Stateless Address Autoconfiguration (SLAAC): Derives an IPv6 link-local address (fe80::/64) from the hardware MAC address and automatically constructs global unicast addresses upon receiving Router Advertisements (RA).
Neighbor Discovery Protocol (NDP): Full implementation of RFC 4861 Neighbor Solicitation and Advertisement with dynamic neighbor caching, retransmission timers, and packet queueing.
Duplicate Address Detection (DAD): Verifies address uniqueness before assigning addresses to interfaces.
Dual-Stack Sockets: The BSD socket layer supports AF_INET6, sockaddr_in6, IPv4-mapped addresses (::ffff:192.0.2.1), IPV6_V6ONLY flags, and loopback addressing (::1).
The Transmission Control Protocol engine has been upgraded to modern internet transport specifications:
RFC 2018 Selective Acknowledgment (SACK): Maintains a dynamic scoreboard tracking out-of-order segment blocks, enabling RFC 6675 loss recovery that retransmits only lost segments rather than re-sending whole sliding windows. Under 3.4% synthetic packet loss, throughput increased from 7 MB/s to 19 MB/s.
NewReno Fallback: Provides NewReno fast recovery when communicating with legacy endpoints lacking SACK support.
Delayed Acknowledgments & Byte-Counted Slow Start: Delays ACKs by up to 40 ms (or every 2nd packet), while transmitting initial 8 segments immediately to accelerate handshake completion.
Cryptographic Security: Employs randomized Initial Sequence Numbers (ISNs) and randomized ephemeral source ports to eliminate TCP sequence prediction attacks.
Full Socket Option Matrix: Implements TCP_NODELAY, SO_KEEPALIVE, SO_REUSEPORT, SO_REUSEADDR, SO_SNDBUF, SO_RCVBUF, SO_LINGER, TCP_MAXSEG, TCP_QUICKACK, and TCP_USER_TIMEOUT.
8.3 High-Performance HTTP Client & Connection Pool (`http.c`)
The kernel HTTP/1.1 client incorporates an intelligent connection pool maintaining up to 8 persistent keep-alive connections with a 20-second idle timeout. Because TLS 1.3 state and TCP handshakes are preserved across successive requests, secondary HTTPS requests to the same origin drop from 56 ms to 20 ms. Transfers stream directly into user buffers in 16 KB chunks without intermediate kernel buffer copies.
9. Storage Architecture & Filesystem Drivers
9.1 Virtual File System Architecture (`vfs.c`)
The Virtual File System routes operations through a 16-node prefix mount table:
/: Read-only USTAR Ramdisk loaded from GRUB2 initrd.
/ext2: Persistent read/write Second Extended Filesystem backed by VirtIO-Blk or AHCI SATA drives.
The Ext2 driver supports block sizes of 1024, 2048, and 4096 bytes, direct, indirect, and doubly-indirect block addressing, symbolic links, file truncation, and recursive directory creation.
Hardware Safety: Real-Disk Protection Gate
To prevent catastrophic data loss when booting on physical hardware with existing operating systems, ext2_init() verifies the volume label against EXT2_QUIN_VOLUME_LABEL ("QUINOS_DISK"). If an attached physical SATA or NVMe drive does not match this label, the driver strictly refuses to mount or write to the device.
9.3 Hardware Driver Matrix
Subsystem
Source File
Hardware Specifications & Protocols
Display
virtio_gpu.c, virgl.c, Bochs BGA
VirtIO modern 2D/3D command rings (Virgl 3D protocol); Bochs I/O ports 0x01CE/0x01CF
Storage
virtio_blk.c, ahci.c, nvme.c
VirtIO Block; SATA AHCI DMA; PCIe NVMe submission/completion queues
Network
virtio_net.c, e1000.c
VirtIO Net with MAC filtering; Intel Gigabit 82540EM with hardware multicast for IPv6 NDP
USB
usb_xhci.c, usb_uhci.c
USB 3.0 xHCI controller; USB 1.1 UHCI; USB HID Keyboard/Mouse; Mass Storage
Audio
ac97.c, speaker.c
Intel 82801AA AC97 stereo PCM DMA (playback + microphone input via /dev/audioin); PC Speaker port 0x61
Quin OS 2 supports dynamically linked ELF64 executables through an authentic implementation of the System V AMD64 dynamic execution model:
PT_INTERP Handover: When elf_execve() detects a PT_INTERP segment (pointing to /lib/ld-musl-x86_64.so.1), the kernel maps both the main program and the dynamic linker (libc.so) into user space, positioning the interpreter at 0x700000000000 with an ASLR slide up to 1 GB.
Auxiliary Vector Setup: Populates AT_BASE (interpreter load address), AT_ENTRY (application entry point), AT_PHDR (pointing to program headers as mapped), AT_PAGESZ (4096), and AT_RANDOM.
Complete dlopen Subsystem: Applications dynamically load shared libraries via standard POSIX APIs: dlopen(), dlsym(), dlclose(), dladdr(), and dl_iterate_phdr(), supporting static constructors, destructors, and per-thread Thread-Local Storage (TLS).
10.2 Complete LLVM C++23 Runtime (`libc++`)
Quin OS cross-compiles LLVM's official libc++, libc++abi, and libunwind 18.1.3 against in-tree musl libc. This provides a complete C++23 standard library environment:
Zero-Cost Exception Handling: Full DWARF exception unwinding via libunwind across function frames, shared library boundaries, and dynamic plugins.
Standard Library Coverage: Full support for std::thread, std::mutex, std::condition_variable, std::async, <filesystem>, <regex>, <chrono>, <format>, std::expected, ranges, and iostreams.
10.3 CPython 3.12 & Rust Toolchain Support
Modern developer language runtimes execute natively on Quin OS 2:
CPython 3.12.11: Cross-compiled static musl binary with 95 built-in standard library modules (including asyncio, socket, mmap, select, decimal, json, math, zlib, multiprocessing, and shutil), allowing developers to execute Python automation scripts directly from the Quin shell.
Rust Toolchain: Compiles Rust applications targeting x86_64-unknown-linux-musl with stable rustc 1.99.1. Passes an exhaustive 31-point test suite validating std::fs, multi-threading, channels (mpsc), panics with stack unwinding (catch_unwind), and loopback networking.
In an extraordinary milestone for hobby operating system research, Quin OS 2 runs a Large Language Model (LLM) entirely inside Ring-3 userspace:
/* userspace/llm/llm_demo.c */
Prompt: "Once upon a time" | Model: stories15M.bin (58 MB) | Mode: Greedy Decoding
Quin OS (qcc -O3 -ffast-math, SSE2 Vectorized): 498 tokens/second
Character-for-character bit-exact output matching PC native execution (731 chars)
Karpathy's llama2.c architecture running the 15-million-parameter TinyStories transformer model loads the 58 MB model weights directly via mmap(). Using 128-bit SSE2 vectorization in userspace, Quin OS generates text at an astonishing 498 tokens per second on a single CPU core, proving that the operating system's memory subsystem, math library, and floating-point context switches operate with complete mathematical correctness.
Quin OS 2 transitions to an "Apps-are-Packages" paradigm, managed through an integrated Package Manager (pkg) and package build pipeline:
Application Package
Package ID
Architectural Highlights & Capabilities
PDF Viewer
pdf-viewer
Powered by MuPDF 1.28.5 (13 MB standalone). Features PDF/CBZ rendering, in-document search with text highlighting, document outlines, dark mode, password decryption, and text selection/copying.
Passwords Vault
passwords
Cryptographic vault using AES-256-GCM encryption with PBKDF2-HMAC-SHA256 (150,000 iterations). Features automatic lock after 5 minutes and automated clipboard clearing after 30 seconds.
Maps
maps
Offline/online mapping client rendering OpenStreetMap tiles (cached in ~/.cache/maps), Nominatim location search, and place pinning.
Archive Manager
archiver
Extracts and creates ZIP (CRC-verified deflate), TAR, and TAR.GZ archives with strict protection against directory traversal attacks (.. and leading slashes).
Calendar
calendar
Month and agenda view, recurring event scheduling, and standard iCalendar (.ics) file import/export.
RSS Reader
rss-reader
Background syndication client parsing RSS 2.0 and Atom feeds through the kernel HTTP connection pool, featuring offline caching.
Quin Studio IDE
quin-studio
In-OS development environment supporting project packages (.qsp ustar tar format), folder opening (--pick-open-folder), and language extension plugins (Lua, Python, Web, Shell).
Web Browser
r3_browser
Integrates litehtml for CSS box models (supporting up to 64 stylesheets / 3 MB each, HTML5 <details>/<summary>) and QuickJS-ng for ES2020 JavaScript execution.
Table 4: Native application and package ecosystem running under Quin OS 2.
11. Comparative Architectural Analysis
11.1 Quin OS 2 vs. Linux Kernel (v6.x)
Dimension
Quin OS 2
Linux Kernel (v6.x)
Kernel Model
Monolithic transitioning to Isolated Ring-3 Server Model
Modular Monolithic with Loadable Kernel Modules (LKM)
Codebase Scale
~300,000 lines (Kernel, Drivers, GUI, Userspace)
~35,000,000+ lines (Over 30 years of accumulation)
Cold Boot Duration
< 1.8 seconds (Direct BIOS/GRUB to QWM GUI)
8.0 – 25.0 seconds (initramfs, systemd services)
Idle RAM Footprint
~42 MB Total RAM (Complete graphical desktop)
~500 MB – 1.5 GB RAM (with desktop environment)
Physical Memory
Order 0–10 Buddy Allocator with 32-bit atomic CoW refcounts
Multi-tier Buddy Allocator with SLUB/SLAB/SLOB caches
Virtual Memory
4-level paging, HHDM at 0xFFFF800000000000, CoW fork
4-level & 5-level paging, VMA trees, swap, kswapd
Hardware 3D Acceleration
VirtIO-GPU Virgl (SYS_GPU3D) + Mesa 24.0.9 OpenGL
Direct Rendering Infrastructure (DRI3 / DRM / KMS)
HolyC (custom C dialect with in-kernel JIT compiler)
Table 6: Comparative analysis: Quin OS 2 versus TempleOS.
11.3 Quin OS 2 vs. Microsoft Windows 11 & Apple macOS Tahoe
While Linux and TempleOS represent Unix-modular and bare-metal extremes, the contemporary computing landscape is dominated by commercial consumer operating systems: Microsoft Windows 11 (24H2 / NT Kernel 10.0) and Apple macOS Tahoe (macOS 16 / XNU Kernel 24+). Table 7 evaluates Quin OS 2 against these enterprise desktop platforms across kernel architecture, resource efficiency, display pipelines, and privacy:
Dimension
Quin OS 2
Microsoft Windows 11 (24H2)
Apple macOS Tahoe (macOS 16)
Kernel Architecture
Monolithic-to-Isolated Ring-3 Server Model (Freestanding C/asm)
Hybrid Microkernel (Windows NT Executive, ntoskrnl.exe, win32k.sys)
Table 8: Empirical performance benchmarks measured under QEMU/KVM virtualization.
12.2 Key Architectural Optimizations
Five low-level design patterns account for Quin OS's responsiveness and low memory footprint:
Pre-Baked Zero-Decode UI Assets: Runtime image decoding on application launch introduces substantial CPU stalls. Quin OS 2 compiles pre-baked 0xAARRGGBB raw pixel arrays directly into the kernel for all preview cards, icons, and theme chrome widgets. This enables instantaneous rendering without memory allocation or decoding latency.
Integer-Only Ring-0 Rasterization: The graphics subsystem avoids floating-point operations in Ring 0, avoiding FXSAVE/FXRSTOR FPU state save/restore overhead during compositor redraw cycles.
Dirty Damage Clipping: The display server limits blit transfers to modified bounding rectangles, avoiding continuous 14.7 MB whole-frame transfers at 2560×1440 resolution.
Hierarchical Tile Depth Occlusion: Tracks 16×8 tile depth barriers in Quincraft 1.5, rejecting occluded geometry prior to rasterization and skipping 93% of hidden triangles.
Keep-Alive Transport Pooling: Maintains active TLS 1.3 handshakes across HTTP transactions, eliminating repeated cryptographic negotiations.
13. Engineering Roadmap & Future Research
Active engineering on Quin OS 2 is structured across five progressive phases:
Phase 1: Foundation (Completed): Buddy allocator PMM, 4-level paging VMM, ACPI MADT SMP scheduler, and POSIX syscall interface.
Phase 2: Persistent Storage & Networking (Completed): Ext2 read/write on VirtIO-Blk, in-tree dual-stack IPv4/IPv6 and RFC 2018 SACK TCP/IP stack, double-buffered QDS compositor, and QWM window manager.
Phase 4: Hardware 3D & Modern Shell (Completed): VirtIO-GPU 3D (Virgl) acceleration with Mesa 24.0.9 OpenGL, band-parallel 3D engine (71-91 FPS), top Menu Bar, Spotlight global search, Mission Control overview, Screen Recorder (Motion-JPEG AVI + 48kHz PCM), and QuinShift radial tools.
Phase 5: Privileged Userspace Compositor Server (Active / In Progress): Migrating QWM from Ring-0 into an isolated userspace server process (/sbin/qwm.elf) communicating over /dev/shm shared-memory surfaces via QuinIPC, complemented by AVX2 SIMD acceleration for vector compositing.
14. Research Attribution & BibTeX Citation
To cite this research in academic publications, technical reports, or comparative operating system literature, please use the following BibTeX entry:
@article{chamyoung2026quinos2,
title={Quin OS 2: Architecture, Implementation, and Empirical Evaluation of a Freestanding 64-Bit Operating System},
author={Chamyoung, Dr. (Alok)},
journal={Inbora Studio Technical Reports},
volume={2},
number={2},
pages={1--64},
year={2026},
publisher={Inbora Studio},
url={https://inborastudio.github.io/QuinOS/}
}