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.

1. Introduction & Five-Year Evolutionary Timeline (2021–2026)

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:

1.3 Architectural Tenets

The development methodology enforces three strict engineering rules:

2. Kernel Bootstrapping & Machine Initialization

2.1 Multiboot Handover & 64-Bit Transition (`boot.asm`)

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:

; Multiboot 1 Header
MULTIBOOT1_MAGIC     equ 0x1BADB002
MULTIBOOT1_FLAGS     equ 0x00000007  ; PAGE_ALIGN | MEM_INFO | VIDEO_MODE
MULTIBOOT1_CHECKSUM  equ -(MULTIBOOT1_MAGIC + MULTIBOOT1_FLAGS)

; Multiboot 2 Header (Tag Type 5: Request 1920x1080x32 Linear Framebuffer)
MULTIBOOT2_MAGIC     equ 0xE85250D6
MULTIBOOT2_ARCH_X86  equ 0
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:

  1. boot_pml4[0] references boot_pdpt with flags 0x03 (Present | Writable).
  2. boot_pdpt[0] references boot_pd.
  3. boot_pd initializes 512 entries mapping physical addresses 0x00000000 through 0x3FFFFFFF using flags 0x83 (Present | Writable | Huge Page 2MB).
  4. 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:

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.

3. Memory Management Subsystem

3.1 Physical Memory Manager — Buddy Allocator (`pmm.c`)

Quin OS manages physical memory using a binary buddy allocator supporting orders $k \in [0, 10]$, corresponding to contiguous block sizes from $2^0 \times 4\text{ KB} = 4\text{ KB}$ up to $2^{10} \times 4\text{ KB} = 4\text{ MB}$.

#define PMM_MAX_ORDER 10
#define PMM_PAGE_SIZE 4096

typedef struct pmm_block {
    struct pmm_block *next;
} pmm_block_t;

static pmm_block_t *free_lists[PMM_MAX_ORDER + 1];
static uint8_t      *pmm_bitmap;
static uint32_t     *pmm_refcount; /* Atomic reference counts for CoW */
Listing 3: Buddy allocator free-list hierarchy and per-frame CoW reference table.

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:

\text{buddy\_frame} = \text{frame} \oplus (1 \ll k)

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.

3.2 Virtual Memory Manager & Copy-on-Write (`vmm.c`)

The 64-bit Virtual Memory Manager navigates the standard 4-level x86_64 paging architecture. A 64-bit virtual address decomposes into:

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:

  1. If pmm_refcount[frame] == 1, the page is unique: the Writable bit is immediately restored and the TLB invalidated (invlpg).
  2. 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):

  1. Copies a 16-bit real-mode assembly trampoline to physical address 0x8000.
  2. Issues an INIT Inter-Processor Interrupt (IPI) via the Local APIC ICR register (0xFEE00300).
  3. Delivers two Startup IPIs (SIPI) with vector 0x08 (specifying physical page 0x8000).
  4. 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.

4.3 The Cross-Core Work-Stealing Race (`BUG-080`)

Root-Cause Analysis: Multi-Core Stack Corruption Incident

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:

Hardware Vulnerability Hardening: CVE-2012-0217 Mitigation

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.

Category Syscall Numbers Key Implemented Functions
File I/O & VFS 0, 1, 2, 3, 8, 9, 16, 17, 72, 79, 87, 217 read, write, open, close, lseek, stat, fstat, ioctl (FIOCLEX/FIONBIO), pread, pwrite, pipe, mkdir, unlink, getdents64
Memory Virtualization 9, 10, 11, 12, 25 mmap, munmap, mprotect, mremap, brk
Process & Multiprocessing 39, 56, 57, 59, 60, 61, 186, 202, 231 getpid, clone (CLONE_VM/SETTLS), fork, execve, exit, wait4, gettid, futex, exit_group
Dual-Stack Sockets & Net 41, 42, 43, 44, 45, 49, 50, 54, 55 socket (AF_INET/AF_INET6), connect, accept, sendto, recvfrom, bind, listen, setsockopt, getsockopt
Clocks & Timers 228, 230 clock_gettime (REALTIME/MONOTONIC), clock_nanosleep
Quin Windowing & Compositor 500–505, 541–546 SYS_WM_CREATE, SYS_WM_DRAW, SYS_WM_CAPTURE (541), SYS_WM_WINLIST (542), SYS_WM_CLIP (543), SYS_WM_DRAGSTATE (546)
Hardware 3D Acceleration 547 SYS_GPU3D (547): Context create, resource allocate/map, command stream submission
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:

uint64_t aslr_generate_slide(uint64_t max_pages) {
    uint64_t lfsr = g_aslr_state;
    uint64_t bit = ((lfsr >> 0) ^ (lfsr >> 1) ^ (lfsr >> 3) ^ (lfsr >> 4)) & 1;
    g_aslr_state = (lfsr >> 1) | (bit << 63);
    return (g_aslr_state % max_pages) * PMM_PAGE_SIZE;
}

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:

typedef struct {
    uint32_t *back;
    uint32_t *front;
    uint32_t  width, height;
    /* Dirty damage bounding box */
    uint32_t  dmg_x, dmg_y;
    uint32_t  dmg_x2, dmg_y2;
    int       dmg_valid;
} qds_state_t;

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:

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:

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:

6.5 Mission Control Window Overview & Task Switching (`taskview.c`)

Quin OS provides two native task switching paradigms:

6.6 Advanced Drag-and-Drop & QuinShift Radial Ring

The window manager integrates a comprehensive cross-window drag-and-drop subsystem:

6.7 Screen Capture & Motion-JPEG System Recorder (`capture.c`, `clip.c`)

Built directly into the window management architecture:

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:

/* userspace/common/quin_gpu3d.h */
#define SYS_GPU3D 547

#define QGPU_OP_INFO       1
#define QGPU_OP_GET_CAPS   2
#define QGPU_OP_RES_CREATE 3
#define QGPU_OP_RES_UNREF  4
#define QGPU_OP_RES_MAP    5
#define QGPU_OP_EXEC       6
#define QGPU_OP_TRANSFER   7

The SYS_GPU3D system call grants userspace applications direct, isolated access to the host GPU:

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:

8. Dual-Stack Networking & RFC 793 / 2018 Transport Engine

8.1 Dual-Stack IPv4 / IPv6 Subsystem (`ipv6.c`, `ipv4.c`)

Quin OS 2 incorporates a complete, freestanding dual-stack networking subsystem written in pure C:

8.2 Enterprise RFC 793 & RFC 2018 SACK TCP Engine (`tcp.c`)

The Transmission Control Protocol engine has been upgraded to modern internet transport specifications:

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:

9.2 Ext2 Implementation & Hardware Safety Gates (`ext2.c`)

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
Input mouse.c, keyboard.c, virtio_input.c PS/2 Keyboard (IRQ1 scancode set 1); PS/2 Mouse (IRQ12 3-button + acceleration curve); VirtIO Tablet
Table 3: Built-in device driver implementation matrix.

10. Userspace Architecture, Languages, Runtimes & Applications

10.1 Dynamic Linking & Shared Libraries (`docs/DYNAMIC_LINKING.md`)

Quin OS 2 supports dynamically linked ELF64 executables through an authentic implementation of the System V AMD64 dynamic execution model:

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:

10.3 CPython 3.12 & Rust Toolchain Support

Modern developer language runtimes execute natively on Quin OS 2:

10.4 On-Device Machine Learning & LLM Inference (`docs/LLM_ON_QUIN.md`)

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.

10.5 Extensible Package Ecosystem & Native Applications

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)
Task Scheduler Preemptive 3-Priority Round-Robin + LAPIC & 100 Hz PIT Mode 2 Completely Fair Scheduler (CFS) / EEVDF
Display Pipeline In-tree double-buffered QDS compositor & floating QWM Userspace client-server model (X11 / Wayland Compositor)
Network Stack Dual-Stack IPv4/IPv6, RFC 2018 SACK TCP, HTTP Keep-Alive Pool Multi-protocol stack with eBPF, Netfilter, IPsec
C Standard Library musl libc 1.2.4 (Static & Dynamic Linking via ldso) GNU C Library (glibc) or musl libc
Table 5: Comprehensive architectural comparison: Quin OS 2 versus the Linux Kernel.

11.2 Quin OS 2 vs. TempleOS (Terry A. Davis)

Dimension Quin OS 2 TempleOS (Terry A. Davis)
Primary Philosophy Modern, secure, isolated, multitasking desktop OS Biblical temple recreation; single-purpose recreational OS
Privilege Isolation Strict Ring-0 / Ring-3 CPU isolation (SYSCALL/SYSRET) Zero ring separation: All code executes in Ring-0
Memory Protection PML4 4-Level Paging, NX/XD bit, CoW, ASLR, Canaries Identity-mapped flat memory; zero memory protection
Multi-Core SMP Preemptive round-robin across cores with per-CPU run-queues Master/slave core model; APs wait for HolyC job queues
Display Resolution 2560×1440 True Color (32-bit ARGB) Double-Buffered 640×480 16-Color fixed VGA palette
3D Graphics Capability Hardware Virgl GPU + Mesa 24 + Band-Parallel CPU 3D (71-91 FPS) Software 3D wireframe mesh rotation in HolyC
Networking Capability Dual-Stack IPv4/IPv6, RFC 2018 SACK TCP, HTTP/TLS Zero networking support by design
Filesystem Ext2 (read/write), FAT32, USTAR, procfs, devfs, shmfs RedSea 64-bit filesystem, FAT32, ISO9660
Audio Subsystem 16-Bit Stereo PCM audio via AC97 DMA (playback + recording) Single-voice PC speaker frequency modulation
Language Runtimes C99, LLVM C++23, CPython 3.12, Rust 1.99, Llama2 LLM 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) Hybrid Mach/BSD (XNU Kernel, Mach microkernel + BSD subsystem + DriverKit)
Idle RAM Footprint ~42 MB Total RAM (Complete graphical desktop & compositor) ~3.8 GB – 4.5 GB RAM (Explorer, DWM, Defender, telemetry, Edge background) ~2.8 GB – 3.6 GB RAM (WindowServer, Spotlight/mds, launchd, Apple Intelligence)
Cold Boot Duration < 1.8 seconds (Direct BIOS/GRUB to interactive QWM desktop) 12.0 – 25.0 seconds (UEFI cold start / Fast Startup hibernation) 10.0 – 20.0 seconds (Secure Boot cryptographic chain & launchd tree)
Privilege & Security Isolation Hardware Ring-0 / Ring-3 (SYSCALL/SYSRET), IA32_FMASK AC-cleared, LFSR ASLR, Canaries Ring 0 / Ring 3, Virtualization-Based Security (VBS), HVCI, PatchGuard, TPM 2.0 Ring 0 / Ring 3, System Integrity Protection (SIP), Kernel Integrity (KIP), Secure Enclave
Display Compositing Double-buffered QDS with dirty damage clipping, integer QAA anti-aliasing Desktop Window Manager (DWM), DirectX DirectComposition, GPU surface tree Quartz Compositor (WindowServer), Metal-accelerated, Display-P3 Core Animation
3D Graphics Pipeline VirtIO-GPU Virgl (SYS_GPU3D) + Mesa 24.0.9 OpenGL 4.3 + Band-Parallel CPU 3D DirectX 12 Ultimate / Direct3D 11/12, Vulkan, WDDM 3.x driver model Metal 3 / Metal 4 API, MetalFX upscaling (OpenGL/OpenCL deprecated)
Desktop Shell & UX Top Menu Bar (`menubar.c`), Spotlight instant search & math (`spotlight.c`), Mission Control (`taskview.c`), QuinShift ring Centered Taskbar, Start Menu (XAML/WebView2), Win+Tab Task View, Copilot, Snap Layouts Global Menu Bar, Spotlight Search, Mission Control & Stage Manager, AppKit/SwiftUI Dock
Primary Filesystems Ext2 (read/write with safety label gate), FAT32, USTAR, procfs, devfs, shmfs NTFS (master file table, journaling, ACLs, ADS), ReFS, BitLocker APFS (Apple File System, CoW cloning, snapshots, space sharing, FileVault)
Network Transport Dual-Stack IPv4/IPv6, RFC 2018 SACK TCP with scoreboard, HTTP Keep-Alive Pool Winsock2 (WS2_32.dll), TCP with BBR/CUBIC, HTTP/2, HTTP/3 (MsQuic) BSD Sockets, Network.framework, CUBIC TCP, HTTP/2, HTTP/3 QUIC
Application Runtimes musl libc 1.2.4 (dynamic/static), LLVM C++23, CPython 3.12, Rust 1.99, Llama2 LLM Win32, COM, .NET 8/9, UWP, Windows App SDK, WSL2 (Hyper-V VM) Cocoa (AppKit, SwiftUI), POSIX/BSD, Rosetta 2, Swift runtime, Mach-O
Telemetry & Background Overhead Zero telemetry, zero advertisements, zero background bloatware Extensive background telemetry (DiagTrack), Start/Search ads, forced cloud syncing Apple analytics telemetry, iCloud sync daemons, Siri suggestion indexing
Codebase Scale & Auditability ~300,000 lines (100% open, fully auditable from bare metal) ~65,000,000+ lines (Proprietary closed-source commercial software) Hybrid (Darwin/XNU open core ~2M lines; proprietary GUI & frameworks ~35M+ lines)
Table 7: Systems comparison: Quin OS 2 versus Microsoft Windows 11 and Apple macOS Tahoe.

12. Performance Benchmarking & Optimization Techniques

12.1 Empirical Measurements

Metric / Measurement Quin OS 2 Linux (Debian Minimal)
Kernel Standalone ELF Size ~1.4 MB ~9.2 MB (vmlinuz compressed)
Total RAM Footprint at Desktop 42 MB 680 MB
Cold Boot to Interactive Desktop 1.68 seconds 11.4 seconds
Context Switch Overhead (switch_context) ~142 CPU cycles ~380 CPU cycles
Syscall Entry/Exit Overhead (SYSCALL) ~85 CPU cycles ~190 CPU cycles
Quincraft 3D (Virgl GPU @ 960x540) 71.4 FPS N/A
Quincraft 3D (8-Core CPU @ 2560x1440) 90.9 FPS N/A
On-Device LLM Inference (15M Params) 498 tokens/second ~520 tokens/second (AVX2 native)
TCP Throughput under 3.4% Packet Loss 19.2 MB/s (RFC 2018 SACK) ~21.5 MB/s
Second HTTPS Request Latency (Pool) 20 ms ~18 ms
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:

13. Engineering Roadmap & Future Research

Active engineering on Quin OS 2 is structured across five progressive phases:

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/} }

Official Project Repositories