Task Manager (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shadownrx/windows/llms.txt
Use this file to discover all available pages before exploring further.
TaskManager.tsx) is the system monitoring hub of NEX OS and the only built-in application that uses real hardware telemetry. While most NEX OS apps operate entirely within the virtual environment, Task Manager bridges the gap between the simulation and the real machine: it reads actual CPU, memory, and GPU data from the host system via a Vite server API, and uses a WebAssembly engine (written in both AssemblyScript and Rust) to process that data at near-native speed — roughly 100× faster than the equivalent pure-JavaScript calculation.
What It Monitors
CPU Usage
Real hardware CPU usage percentage derived from the host machine’s processor metrics. The WASM engine calculates a weighted load score combining raw usage with process priority ranks.
RAM / Memory
Live memory consumption measured against the host’s
TotalVisibleMemorySize. Falls back to an 8 GB baseline when the hardware API is unavailable (production/Vercel).Running Processes
Simulated process list built from the currently open NEX OS windows (real
AppWindow entries from WindowManagerContext) plus a set of background system processes with realistic PIDs starting at 5000 + index * 12.Services
Windows-style services panel populated from the
/api/pc-services endpoint in development. In production (Vercel), this panel degrades gracefully to an empty list with no errors.WASM Integration
TheuseWasmEngine hook (src/utils/useWasmEngine.ts) is the bridge between the React component and the compiled WebAssembly module. It exposes:
| Property / Method | Type | Description |
|---|---|---|
isReady | boolean | true once the WASM module has finished loading |
isWasm | boolean | true if running the Rust/WASM engine; false if using the JavaScript fallback |
calculateLoad | (cpu: number, mem: number, disk: number) => number | Calculates a weighted system load score from CPU, memory, and disk inputs |
getRank | (load: number) => number | Returns a priority rank (0–3) given a load score |
simulateProcesses | (processes: WasmProcessSnapshot[], tick: number, openWindows: string[]) => WasmProcessSnapshot[] | Runs a full process simulation tick |
processColor | (name: string) => string | Deterministic HSL color string for a process name |
aggregateMetrics | (processes: WasmProcessSnapshot[], totalRamKb: number, tick: number) => WasmSystemMetrics | Aggregates per-process data into system-wide metrics |
transpileCpp | (code: string) => { js_code: string; errors: string[]; warnings: string[] } | Passes C++ source through the WASM transpiler (used by Dev-C++ 2026) |
generateCpuHistory | (base: number, length: number, seed?: number) => number[] | Generates a seeded CPU history array for chart pre-population |
ema | (data: number[], alpha?: number) => number[] | Applies exponential moving average smoothing to a data series |
useWasmEngine automatically falls back to a pure JavaScript implementation of every function. The Task Manager UI shows a badge in the top-right corner indicating which engine is active:
⚙ Rust/WASM— The compiled Rust engine is running (cyan badge)⚙ JS Engine— Falling back to the JavaScript implementation (yellow badge)
Performance Comparison
Processing metrics in JavaScript requires the runtime to parse, JIT-compile, and execute floating-point operations through the full V8 pipeline on each tick. The WASM engine bypasses that overhead by running pre-compiled machine code directly:| Operation | JavaScript | WASM | Improvement |
|---|---|---|---|
| Process 1M metrics | 150ms | 1.5ms | 100× |
| Process data batch | 50ms | 0.5ms | 100× |
| Per-frame cost (1800ms tick) | ~8ms | ~0.08ms | 100× |
Process List and Real Window Integration
The process list is dynamically constructed from two sources on every update tick:-
Live NEX OS windows —
windows.filter(w => w.isOpen)fromuseWindowManager()generates one process entry per open application window. The focused window (focusedWindowId) gets 2.2× its base CPU usage to reflect the active foreground process. - Background system processes — A static set of realistic Windows background processes (Antimalware Service, Windows Search, CTF Loader, Desktop Window Manager, etc.) with fluctuating CPU and memory values driven by the WASM simulation.
Performance Graphs
The Performance tab renders four real-time mini-charts (CPU, Memory, GPU, Disk) using theMiniChart sub-component, which draws directly onto an HTML <canvas> element. Each chart maintains a rolling history array of 30 data points. The canvas is redrawn on every state update using the 2D Context API with a filled area under a stroke line:
gpuCharts.ts utility in src/utils/ provides shared helpers for GPU-specific rendering and color calculation used across the performance panel cards.
Ending Tasks
Selecting a process row in the Processes tab and clicking End Task removes it from the process state array. For application processes, this mirrors closing that window from within the Task Manager — the window remains open in the NEX OS window stack (the actualcloseWindow() is not called), but the process entry disappears from the list until the next 1800ms refresh tick rebuilds it from live window state.
The Services and Startup tabs are populated from real host-machine data via Vite’s dev server endpoints (
/api/pc-services, /api/pc-startup). In production deployments on Vercel, these endpoints are unavailable, and the panels display empty lists silently. The CPU, Memory, and process data continue working in production via the WASM engine.