Skip to main content
The BPE/U (Browser Processing Engine/Unit) is a virtual CPU-like engine that executes Aurora OS entirely in modern web browsers. It replaces the traditional hardware boot chain with a software-emulated equivalent, enabling development and testing without bare metal hardware.

Architecture

BPE/U implements a complete OS runtime stack in JavaScript:
┌──────────────────────────────────────────────────────┐
│              AURORA OS Desktop (os.js)                │
├──────────────────────────────────────────────────────┤
│              BPE/U Syscall Interface (INT 0x80)       │
├──────────┬──────────┬──────────┬──────────┬──────────┤
│Scheduler │ MemoryMgr│   VFS    │ ProcMgr  │Auth/Crypt│
│ (MLFQ)   │(PageTbl) │ (OPFS)   │(PCB/PID) │(PBKDF2)  │
├──────────┴──────────┴──────────┴──────────┴──────────┤
│              BPE/U Hardware Abstraction               │
│  Display(DOM) Storage(OPFS) Network(WS) Clock Input   │
├──────────────────────────────────────────────────────┤
│              Browser Host (Chrome/FF/Safari)           │
└──────────────────────────────────────────────────────┘

Boot sequence

BPE/U emulates a complete boot chain:
1

BIOS POST

Displays BIOS Power-On Self Test screen with hardware detection animationImplementation: wasm-runtime/pwa/bpe/bpe-boot.js:15
2

Bootloader

Shows bootloader splash screen (“AURORA OS Bootloader v1.0”)Implementation: wasm-runtime/pwa/bpe/bpe-boot.js:45
3

Kernel init

Initializes BPE subsystems: memory, process manager, VFS, syscall tableImplementation: wasm-runtime/pwa/bpe/bpe-core.js:80
4

Auth check

Checks if user accounts exist in OPFS. If none, triggers OOBE.Implementation: wasm-runtime/pwa/bpe/bpe-auth.js:120
5

OOBE or Login

First-time setup (Out-of-Box Experience) or login screenImplementation: wasm-runtime/pwa/bpe/bpe-oobe.js, bpe-login.js
6

Desktop

Desktop environment loads with window manager, dock, and applicationsImplementation: wasm-runtime/pwa/os.js:200
Boot time: < 2 seconds from page load to desktop

Core components

BPE core engine

The core engine manages the virtual CPU state:
// wasm-runtime/pwa/bpe/bpe-core.js:25
class BPE {
    constructor() {
        this.registers = {
            rax: 0n, rbx: 0n, rcx: 0n, rdx: 0n,
            rsi: 0n, rdi: 0n, rsp: 0n, rbp: 0n,
            rip: 0n, rflags: 0n
        };
        this.interrupts = new Map();  // INT handlers
        this.tickTimer = null;         // 1000 Hz tick
        this.halted = false;
    }

    tick() {
        // Execute one instruction cycle
        // Check for pending interrupts
        // Update timers
    }

    registerInterrupt(num, handler) {
        this.interrupts.set(num, handler);
    }
}
Features:
  • Virtual registers (64-bit)
  • Interrupt table (INT 0x80 for syscalls)
  • 1000 Hz tick timer (matches native kernel PIT frequency)
  • State machine for halt/resume
Implementation: wasm-runtime/pwa/bpe/bpe-core.js

Memory manager

BPE implements virtual memory with page tables:
// wasm-runtime/pwa/bpe/bpe-memory.js:30
class BPEMemory {
    constructor() {
        this.frames = new Map();       // Physical frame allocator
        this.pageTable = new Map();    // Virtual → Physical mapping
        this.nextFrame = 0;
    }

    allocFrame() {
        const frame = this.nextFrame++;
        this.frames.set(frame, new Uint8Array(4096));  // 4 KiB pages
        return frame;
    }

    mapPage(virt, phys, flags) {
        this.pageTable.set(virt >> 12, { phys, flags });
    }

    read(virt, size) {
        const page = this.pageTable.get(virt >> 12);
        const offset = virt & 0xFFF;
        return this.frames.get(page.phys).slice(offset, offset + size);
    }
}
Features:
  • 4 KiB page size (matches x86_64)
  • Page table mapping (virtual → physical)
  • Read/write with page fault handling
  • Memory-mapped I/O for hardware emulation
Implementation: wasm-runtime/pwa/bpe/bpe-memory.js

Process manager

BPE implements a UNIX-like process model:
// wasm-runtime/pwa/bpe/bpe-process.js:40
class BPEProcess {
    constructor(pid, name) {
        this.pid = pid;
        this.name = name;
        this.state = 'READY';          // READY, RUNNING, BLOCKED, ZOMBIE
        this.priority = 0;             // -20 to +19 (nice value)
        this.vruntime = 0;             // For MLFQ scheduler
        this.registers = {};           // Saved context
        this.pageTable = new Map();    // Per-process page table
    }
}

class BPEScheduler {
    constructor() {
        this.processes = new Map();
        this.runQueue = [];            // Sorted by vruntime (MLFQ)
        this.currentPID = 1;           // Init process
    }

    schedule() {
        // Pick process with lowest vruntime
        const next = this.runQueue.sort((a, b) => 
            a.vruntime - b.vruntime
        )[0];
        
        // Context switch
        this.contextSwitch(next);
    }
}
Features:
  • Multi-Level Feedback Queue (MLFQ) scheduler
  • Process states (READY, RUNNING, BLOCKED, ZOMBIE)
  • Priority-based scheduling (nice values)
  • Context switching with register save/restore
Implementation: wasm-runtime/pwa/bpe/bpe-process.js

Virtual file system

BPE uses OPFS (Origin Private File System) for persistent storage:
// wasm-runtime/pwa/bpe/bpe-vfs.js:25
class BPEVFS {
    constructor() {
        this.opfsRoot = null;          // OPFS directory handle
        this.inodes = new Map();       // Inode cache
        this.mountPoints = new Map();  // Mount table
    }

    async init() {
        this.opfsRoot = await navigator.storage.getDirectory();
        await this.mount('/', 'opfs');
    }

    async readFile(path) {
        const handle = await this.lookup(path);
        const file = await handle.getFile();
        return await file.arrayBuffer();
    }

    async writeFile(path, data) {
        const handle = await this.createOrOpen(path);
        const writable = await handle.createWritable();
        await writable.write(data);
        await writable.close();
    }
}
Storage hierarchy:
  1. OPFS (primary) — Not cleared by “Clear browsing data”
  2. IndexedDB (fallback) — With navigator.storage.persist()
  3. Service Worker cache (backup) — For offline PWA
  4. localStorage (last resort) — Limited to 10 MB
Implementation: wasm-runtime/pwa/bpe/bpe-vfs.js, persistent-fs.js

Syscall interface

BPE provides 50+ syscalls via INT 0x80:
// wasm-runtime/pwa/bpe/bpe-syscall.js:15
class BPESyscall {
    constructor(bpe) {
        this.bpe = bpe;
        this.handlers = {
            0: this.sys_exit,
            1: this.sys_write,
            2: this.sys_yield,
            3: this.sys_fork,
            // ... 50+ syscalls
        };
    }

    invoke(num, args) {
        const handler = this.handlers[num];
        if (!handler) return -1;  // ENOSYS
        return handler.apply(this, args);
    }

    sys_write(buf, len) {
        // Write to console or file descriptor
        console.log(new TextDecoder().decode(buf.slice(0, len)));
        return len;
    }

    sys_fork() {
        // Clone current process
        const child = this.bpe.procMgr.clone(this.bpe.currentPID);
        return child.pid;  // Return child PID to parent, 0 to child
    }
}
Syscall categories:
  • Process: exit, fork, execve, waitpid, yield, getpid, kill
  • File: open, close, read, write, stat, mkdir, unlink
  • Memory: mmap, munmap, brk
  • IPC: msgsnd, msgrcv, pipe
  • Network: socket, bind, connect, send, recv (via WebSocket)
Implementation: wasm-runtime/pwa/bpe/bpe-syscall.js

Authentication system

BPE implements persistent authentication with PBKDF2 and AES-GCM:
// wasm-runtime/pwa/bpe/bpe-auth.js:30
class BPEAuth {
    async hashPassword(password, salt) {
        const enc = new TextEncoder();
        const keyMaterial = await crypto.subtle.importKey(
            'raw', enc.encode(password), 'PBKDF2', false, ['deriveBits']
        );
        
        const bits = await crypto.subtle.deriveBits(
            {
                name: 'PBKDF2',
                salt: salt,
                iterations: 600000,    // 600k iterations (OWASP recommended)
                hash: 'SHA-256'
            },
            keyMaterial,
            256
        );
        
        return new Uint8Array(bits);
    }

    async encryptCredentials(data) {
        const key = await this.getMachineKey();  // Stored in OPFS
        const iv = crypto.getRandomValues(new Uint8Array(12));
        
        const encrypted = await crypto.subtle.encrypt(
            { name: 'AES-GCM', iv },
            key,
            new TextEncoder().encode(JSON.stringify(data))
        );
        
        return { encrypted, iv };
    }
}
Security features:
  • PBKDF2: 600,000 iterations (exceeds OWASP 2023 recommendation)
  • AES-GCM: Authenticated encryption for credential storage
  • Machine key: Unique key per browser installation (stored in OPFS)
  • Rate limiting: 5 failed attempts → 30 second lockout
Implementation: wasm-runtime/pwa/bpe/bpe-auth.js

Hardware abstraction

BPE maps browser APIs to hardware devices:
Hardware: Framebuffer console Browser: DOM manipulation
class BPEDisplay {
    constructor() {
        this.canvas = document.getElementById('framebuffer');
        this.ctx = this.canvas.getContext('2d');
    }

    putPixel(x, y, color) {
        this.ctx.fillStyle = color;
        this.ctx.fillRect(x, y, 1, 1);
    }
}
Implementation: wasm-runtime/pwa/bpe/bpe-display.js

Key files

FilePurposeLines
bpe/bpe-core.jsEngine: state machine, registers, interrupts, tick timer250
bpe/bpe-memory.jsVirtual memory: page tables, frame allocator180
bpe/bpe-process.jsProcess manager: PCB, MLFQ scheduler220
bpe/bpe-vfs.jsVFS: inodes, OPFS persistence310
bpe/bpe-syscall.js50+ syscalls on INT 0x80680
bpe/bpe-auth.jsPBKDF2 auth, AES-GCM encrypted creds290
bpe/bpe-boot.jsBIOS POST → Bootloader → Kernel init140
bpe/bpe-oobe.jsFirst-run: Welcome → User creation → Setup260
bpe/bpe-login.jsLogin screen, lock screen, multi-user230
bpe/bpe-panic.jsKernel panic screen, watchdog95
bpe/bpe-settings.jsSettings integration (account, engine info)180
bpe/bpe-integration.jsWires BPE into existing OS120
Total: ~2,955 lines of BPE engine code Location: wasm-runtime/pwa/bpe/

Performance

MetricValueNotes
Boot time< 2 sBIOS → Desktop
Syscall overhead~50 μsFunction call + validation
OPFS read~2 msAsync I/O
OPFS write~5 msAsync I/O + flush
Frame rate60 fpsGPU-accelerated animations
Memory usage~50 MBTypical desktop session
Tick frequency1000 HzMatches native kernel PIT
Performance measured on Chrome 120, Intel i7-9700K. Firefox and Safari may differ.

Browser compatibility

BPE requires modern browser APIs:
BrowserVersionOPFSWebCryptoWebSocketStatus
Chrome102+✅ Recommended
Edge102+✅ Recommended
Firefox111+✅ Supported
Safari15.2+✅ Supported
Opera88+✅ Supported
Mobile⚠️⚠️ Limited
OPFS requires HTTPS or localhost. The OS will not work on file:// URLs.

Next steps

WASM runtime

Learn about WebAssembly integration

Quick start

Run Aurora OS in your browser

User accounts

Set up authentication and users

Security

Explore BPE security features

Build docs developers (and LLMs) love