Linux 7.3 boots to a shell in 0.23s — in WebAssembly
Linux 7.3 boots to a shell in 0.23s — in WebAssembly
A real Linux kernel, compiled to WebAssembly, reached its init process 94 milliseconds after starting and showed me a shell prompt at 231 milliseconds. The whole thing is an 11.3 MB download. I ran it four times on my machine and timed everything.
What unkernel is
Most "Linux in the browser" projects take one of two approaches: emulate an entire PC (faithful, slow), or emulate the CPU and reimplement the syscalls (fast, wrong in edge cases). Unkernel takes a third one: compile the actual Linux kernel — 7.3.4, built November 24, 2026 — to a single wasm module with a real MMU (arch/wasm, Sv48 page tables), and emulate only the user programs, which are unmodified aarch64 binaries. The kernel's syscalls, scheduler, memory management, ext4 and TCP/IP stack are compiled code, not emulated. The project launched November 27 and hit 3,029 GitHub stars in a day.
The pitch is that the slow parts of a system — starting processes, syscalls, page faults — run at wasm speed, while CPU-heavy user code pays the emulation tax. That is a testable claim, so I tested it.
What I ran
Four scripted sessions with the CLI, npx unkernel, on an AMD machine with 4 cores and 7 GB of RAM, Node v24.22.1. The first run downloaded the npm package (15 MB on disk, unkernel.wasm is 11,328,192 bytes) and the Alpine 3.24 image (3.9 MB) into ~/.cache/unkernel. Everything below is from the warm runs.
The boot, timed
The kernel prints its own timestamps, so the boot numbers come from the guest itself, not from my stopwatch:
[ 0.093945] Run /init as init process [ 0.231409] erofs (device wda): mounted with root inode @ nid 128. Welcome to Alpine Linux v3.24 on unkernel (aarch64) /init at 94 ms, root filesystem mounted at 231 ms, shell prompt immediately after. The README claims "about 70 ms" to /init and "the Alpine prompt appears 0.3 s after node launches" — my guest-side numbers land within a few tens of milliseconds of both. Host-side, from typing npx unkernel to the prompt, is about 2.4 seconds on this machine, most of it Node starting up and loading the 11 MB wasm module. The guest is fast; the host wrapper is the slow part.
The guest is unmistakably a real kernel, not a syscall shim:
$ uname -a Linux unkernel 7.3.4+ #61333373f687 Tue Nov 24 17:43:08 UTC 2026 aarch64 Linux $ cat /proc/version Linux version 7.3.4+ (unkernel@unkernel) (Ubuntu clang version 22.1.8 ...) #61333373f687 $ free -m Mem: 2006 7 1995 2 4 1987 /proc/cpuinfo reports one CPU, BogoMIPS 2000.00, CPU architecture: 8, with aes pmull sha1 sha2 crc32 atomics sha3 sha512 in the feature list — the crypto extensions the README says let OpenSSL's hardware AES paths run unchanged. nproc returns 1. The boot log shows wasm-specific drivers doing real work: kwblk, kwnet, kwvsock, kwshm, and a 9p filesystem mounting the host directory I passed with --mount.
Forks: 1.5x native, not 20x
The README's headline performance numbers are precise: getppid about 170 ns (110 native, 1.7 µs under qemu-system), fork + exit + wait about 60 µs (70 µs native, 1.2 ms under qemu). I could not reproduce those exact microbenchmarks — the Alpine base image has no Python and no compiler, and apk add failed here (more on that below) — so I measured the next best thing: fork-heavy shell loops, run identically in the guest and on the host.
guest: time sh -c 'i=0; while [ $i -lt 500 ]; do ( : ); i=$((i+1)); done' real 0m 0.30s host: same loop in bash, native x86_64 real 0m 0.20s guest: time sh -c 'i=0; while [ $i -lt 200 ]; do /bin/true; i=$((i+1)); done' real 0m 0.46s host: real 0m 0.27s 500 subshell forks: 600 µs each in the guest, 396 µs natively — 1.5x. 200 fork-and-exec of /bin/true: 2.3 ms each in the guest, 1.36 ms natively — 1.7x. Both numbers are dominated by shell interpreter overhead in both environments, so the absolute microseconds are not comparable to the README's C-level figures. The ratio is the honest takeaway: process creation in the guest is within a factor of two of native, where qemu-system would be an order of magnitude slower. That matches the architecture — fork is the kernel's own code running compiled in wasm; only the shell running inside it is emulated.
The host-directory mount works both ways, too. The guest wrote hello-from-guest to /work/guest-write.txt and I read it back from the host filesystem immediately — 9p doing what 9p does.
The one thing I could not verify: networking
Every network-dependent claim failed in my sandbox, and I want to be precise about why. apk add python3 died with a TLS error fetching the Alpine index. Plain HTTP fared no better:
$ wget -qO- http://example.com | wc -c wget: error getting response: Resource temporarily unavailable 0 $ wget -qO- http://info.cern.ch | wc -c [net] tcp 198.18.138.70:80: read ECONNRESET The guest's TCP goes through the host's sockets, and this VM sits behind an egress proxy that resets connections the guest initiates — the TLS handshake fails with "wrong version number" because the proxy is in the middle. That is a property of my sandbox, not evidence about unkernel: on a normal machine the README's apk add python3 in about 3.4 s claim is presumably fine. But it means I verified nothing that needs the network — no package installs, no apk search timings, no OpenSSL AES throughput. The JIT numbers (shell loop 1.6x, sort 2.3x, AES-128-GCM ~100 MB/s) are the project's own measurements from November 18, not mine.
What this changes
The interesting number is not 0.23 seconds. It is 1.5x. A Linux that boots in a quarter of a second and forks within a factor of two of native, delivered as a zero-dependency TypeScript SDK (npm i unkernel) that runs the same kernel file in Node and in every supported browser, removes the usual excuse for not giving an agent or a web app a real shell. The known trade-offs are stated in the README itself: CPU-heavy user programs run emulated and slow, and the guest here sees a single CPU. But the kernel path — the part that makes a system feel slow — is the part that is no longer emulated.
Caveats, stated plainly
I ran Alpine only, not Debian or the Ubuntu 26.10 systemd boot the README mentions. I did not test the display, sound, vsock, or the JIT's crypto throughput. Network-dependent claims are unverified here because my sandbox's egress proxy breaks the guest's TCP — on your machine, apk add will probably just work. The fork numbers are shell-loop ratios, not the README's C-level microbenchmarks; I could not run those without a compiler or Python in the guest.
Sources
- unkernel, GitHub (pithings/unkernel), 3,029 stars as of November 28, 2026: https://github.com/pithings/unkernel
- unkernel.dev — "A real Linux kernel, compiled to WebAssembly. It boots to a shell in less than a second.": https://unkernel.dev
- All timings above are my own runs on November 28, 2026, Node v24.22.1, 4-core AMD VM.
原文:https://www.a8q9.cn/en/article/linux-7-3-boots-to-a-shell-in-0-23s-in-webassembly-fc7776.html