~/satyajit
  • we ran it
  • interactive

Linux in a browser tab: unkernel compiles the kernel to wasm and emulates only the programs

mdjsonmcp

2026-12-01 · 28 min · webassembly · sandboxing · microvm · webgpu · agentic-coding

A 4:12 narrated explainer, drawn in code. Every number and picture in it is this article's own; the sources are below.

› transcript

A browser tab. A boot log scrolls past, the kernel starts, and a Debian prompt is waiting. A coding agent answers inside it. Asked who it is, it says it works in a workspace in the user's home directory. And uname says this is a real Linux kernel, on arm64. I'm Trampoline. Let's find where the emulation stops. Programs are unmodified arm64 binaries. They run on kwemu, a software CPU written in Zig and linked into the kernel. When a program makes a syscall, there is no emulated trap. kwemu simply returns to the kernel, which handles it as compiled wasm. A page fault takes the same road. The real Linux memory manager runs, then kwemu carries on. The JavaScript host only sees device traffic: disks, network, screen, sound. Compare a whole-machine emulator, where the kernel itself runs on the emulated CPU, and every syscall pays for it. v86 and container2wasm emulate a whole computer, kernel included. WebVM's CheerpX throws the kernel away and reimplements the syscalls. Runtimes like WASIX need programs rebuilt for wasm, and without an MMU, fork is a guess. unkernel keeps the real kernel at wasm speed, with real page tables, and emulates only the programs. Their own numbers. getppid takes 172 nanoseconds, against 110 native and 1,662 under qemu-system. fork, exit and wait came in at 57 microseconds, against 73 native. Pure computation is the other story. The interpreter is well behind native. A program stores to a page it has never touched. kwemu's TLB has nothing for it. It walks the kernel's own page tables, like hardware. kwemu never writes an entry itself. So it returns a fault, and Linux sets the bit. Copy on write, mmap and fork are all the kernel's own code. I took the published module apart. Eighty-four imports. Clock, console, devices, the task switch. Not one syscall leaves it. Then the cost. On my server, a sort that the host does in an instant took seven seconds with kwemu's JIT, and twenty five without it. A Durable Object cannot compile wasm, so it gets the slow one. The price is snapshots. A task suspended in JSPI lives inside the engine, which cannot save it. So the kernel parks every user task where its state is just registers. And every kernel thread at a point where it holds no locks. Then the host copies memory, skipping free pages. A restore starts each task on a fresh stack and reseeds the random generator. On my server a restored machine answered in under sixty milliseconds, and two copies read different random values. Eighteen days after the repository appeared, it was running in a Cloudflare Durable Object. You ssh in. Your key picks your machine. And agent writes and runs a script, while the model stays outside the VM. Raw TCP reaches a Worker that speaks SSH, written in Go and compiled to wasm. The key's fingerprint names the Durable Object. Same key, same machine. The disk is a SQLite table, one row per page. And agent is a host command. Pi runs on the JavaScript side, so the model and its keys never enter the guest. kido boots Apple's XNU on a full arm64 emulator. The machine is the emulator's state, so snapshot and fork come free. On my server the same shell loop ran about fifteen times slower than in unkernel. unkernel compiles the kernel, so syscalls are fast and Linux behaves like Linux. Freezing it needs the kernel's help. Put the agent's tools in the guest and its model and credentials outside it. That is the shape worth copying. Linux in a tab: the kernel compiled, the programs emulated, and the keys kept outside. Every source is in the full article. I'm Trampoline. Bye!

Why read this

Hightop 30%

Reads unkernel, computerplease and kido, times unkernel with and without its JIT, snapshots and forks, and boots both in the page.

  • Checked against the source
  • Runs in a browser
  • A lasting reference

Developer tools & infraMixed licencesPractitioner teardown

How this was scored
Is it new?
2 of 3: A real new idea, method or capability
Can I trust it?
3 of 3: Reproduces the headline result, or shows from primary files it is wrong
Can I run it?
2 of 3: Open code or weights with real limits
Will I understand it?
2 of 3: Mechanism from first principles with figures
Can I act on it?
2 of 3: A concrete recipe, numbers or comparison
Will it last?
2 of 3: A reference for a year or more
Does it affect many?
1 of 3: A specialist community
Only here?
2 of 3: A teardown or measurement few others did

Score 73 of 100, ranked 101 of 795 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored

On 27 November Guillermo Rauch posted that unkernel.dev "runs a full Linux kernal and distro in a browser tab. No tricks. The full thing. It can run coding agents, it can even run Chrome inside Chrome". Half a million people watched the clip. A day later @alvarombt summed it up in Spanish: a real Linux kernel compiled to WebAssembly, 3.6 MB, booting in a tab in under a second, running unmodified ARM64 Alpine and Debian binaries.

unkernel.dev is absolutely unreal. It runs a full Linux kernal and distro in a browser tab. No tricks. The full thing. It can run coding agents, it can even run Chrome inside Chrome 🤯 and it's… fast!?

Counts as of 2026-12-01

People have run Linux in a browser for over a decade, so "Linux in a tab" alone is not news. What is new is where the line between compiled and emulated code sits. Most earlier projects either emulate the kernel along with everything else, or throw the kernel away and reimplement the syscalls. unkernel compiles the kernel itself to wasm and emulates only user space. Its README credits the idea, a native kernel with emulated user space behind a software MMU, to Kernarium; unkernel is the first I have seen do it with Linux in a browser. That one decision decides how fast a syscall is, whether fork is real, how threads work and what a snapshot has to capture.

Within days, two projects built on the idea or argued with it. On 30 November Steve Faulkner put unkernel in a Cloudflare Durable Object you reach with ssh, a machine per SSH key, with the coding agent running outside the VM on the JavaScript host. On 28 November @_uwu_cocoa answered "that's so lame and so yesterday" with kido, which boots Apple's arm64 XNU kernel in a tab and forks the live machine in about 120 ms, by its own count. kido turns out to make the opposite choice from unkernel, which makes it a useful comparison.

I read pithings/unkernel at ad23026 (30 November), including its contributor notes in .agents/, southpolesteve/computerplease at cbf8e86, and kido-sh/kido-wasm at db147cc. I pulled the published npm package [email protected] and took its unkernel.wasm apart with a small section parser. Then I ran unkernel's SDK under Node, and both playgrounds in headless Chromium, on one of my servers: an Intel i7-6850K with 12 threads, Node v24.23.0. None of their code ran on the machine I write on, and every number below is the project's own unless I say I measured it.

pithings/unkernel@ad23026 · snapshot 2026-12-01

A real Linux kernel, compiled to WebAssembly. It boots to a shell in less than a second.

stars
5.0K
license
GPL-2.0
branch
main
forks
362
open issues
66
source
10.2 MB
commit date
2026-11-30
source by language
TypeScript6.1 MBC1.5 MBZig1.1 MBJavaScript853.9 kBRust341.4 kBShell246.2 kBPython106.0 kB

Read at ad23026 (30 November 2026): README, .agents/kernel.md, kernel/parking.md, kernel/smp.md, include/kw_emu.h. The npm bundle measured here is 0.3.0-261130-3ef745b.

GitHub REST API, 2026-12-01 — branch, commit, commitDate, createdAt, description, forks, homepage, languages, license, openIssues, pushedAt, stars

The quickest way to understand it is to use it. The box below boots the project's own page in a frame when you press the button, and not before. This article is not cross-origin isolated, so unkernel runs on one CPU here, and ?data=0 means nothing is saved. kido's tab restores its warm Darwin snapshot from play.kido.sh; its code has no JSPI dependency. unkernel needs a browser with JSPI, which the box checks before it loads anything.

I checked the frame from a page with no isolation headers, in headless Chromium on my server: unkernel reached its prompt 2.11 s after load on one CPU and ran a typed uname, and kido was ready in 2.27 s.

It does not need the project's page either. I served the SDK's browser build, the release's uniprocessor kernel and its Alpine image from a plain static server with no isolation headers, and a page of about twenty lines booted it in headless Chromium on my server: one CPU, the first command back 445 ms after load, 16.6 MB served, and the distro image read with Range requests. Any page can embed it the same way.

unkernel.dev in Rauch's clip: the boot log, Debian on four CPUs, a coding agent in the guest, uname, and the machine settings. (@rauchg, 27 November; the boot time on screen is the page's own.)

Four ways to put Linux in a tab

The unkernel README sorts earlier projects into groups, and the groups are a good map. I checked each against that project's own documentation rather than unkernel's description of it.

Emulate the whole machine. v86 emulates an x86 PC, and its README says machine code "is translated to WebAssembly modules at runtime in order to achieve decent performance". The guest kernel is real Linux, but it runs on the emulated CPU too. A syscall is an emulated trap into an emulated kernel, a page fault walks emulated page tables, and disk I/O goes through an emulated controller. container2wasm is the same idea packaged for containers: Bochs for x86_64, TinyEMU for riscv64, or QEMU's wasm port with its TCG JIT, with Linux and runc inside. Its README notes that the kernel is pre-booted at build time with wizer to cut startup, for its WASI target so far.

Emulate the CPU, drop the kernel. WebVM runs on CheerpX, which its README describes as an "x86-to-WebAssembly JIT compiler", a "virtual block-based file system" and a "Linux syscall emulator". There is no Linux kernel. That makes it fast, and it covers exactly as much Linux as Leaning Technologies has reimplemented. It is also the one closed engine in the group: WebVM is Apache-2.0, but CheerpX may not be self-hosted without a commercial licence.

Recompile the programs. WASIX, WebContainers and the NOMMU Linux ports (linux-wasm, LKL) run code that was rebuilt for wasm. That is fast, but no unmodified binary runs, and without an MMU fork cannot copy an address space, so it becomes vfork or an approximation.

unkernel's choice. Compile the real kernel to wasm, as the NOMMU ports do, but give it a real MMU and run unmodified aarch64 programs on a software CPU. The kernel's code runs at wasm speed and keeps Linux's behaviour in the corners. The only emulated thing is the program, and the program spends much of its time asking the kernel for something.

KernelUser spaceMMUA syscall is
v86, JSLinux, container2wasmLinux, emulatedunmodified, emulatedemulatedan emulated trap into an emulated kernel
WebVM (CheerpX)noneunmodified x86, JIT to wasmthe runtime'sa call into a syscall emulator
WASIX, WebContainers, linux-wasma runtime, or NOMMU Linuxrebuilt for wasmnonea wasm import call
unkernelLinux 7.3.4, compiled to wasmunmodified aarch64, interpreted and JIT-compiledreal Sv48 page tablesa return from kw_run() into compiled kernel code
kidoXNU, emulatedunmodified arm64 Mach-O, emulatedemulated Stage-1an emulated exception to VBAR_EL1

A syscall is a function return

Three stacked boxes. Top: Linux programs, unmodified aarch64 binaries, which run on kwemu. Middle, inside unkernel.wasm: kwemu, the user-mode CPU, an aarch64 CPU written in Zig, and Linux 7.x, the kernel, as native wasm, with syscalls going from kwemu to the kernel and a return arrow back; the kernel box lists MMU, cgroups, namespaces, userfaultfd, ext4, overlayfs, tmpfs, FUSE, 9p, loop, fanotify, TCP/IP, TUN, vsock, ALSA, evdev and fbdev. Bottom: the JavaScript SDK with console, terminals, exec, host files, disks, network, fetch, screen, input, sound, vsock, shm, snapshots and worker, joined to the kernel by paravirtual devices.
unkernel's own diagram. The user-mode CPU box still says 'an interpreter (JIT to come)'; the README and the code now have the JIT. (unkernel repository, assets/architecture.svg, rendered on white.)

The kernel is Linux 7.3.4 plus a patch series, with an arch/wasm that grew from Joel Severin's linux-wasm port. It is built with clang to a single module. The user-mode CPU is kwemu, written in Zig and linked into the same module. Its contract with the kernel is one C header, include/kw_emu.h, at ABI version 4.

When a program executes SVC #0, kwemu does not emulate an exception level, a vector table or an ERET. kw_run() simply returns to its caller in the kernel with an event code, and the kernel's arm64 syscall path runs: the number in x8, arguments in x0 to x5, through the real syscall table, as compiled wasm. When it is done, the kernel's user_mode_loop() calls kw_run() again. A page fault comes back the same way, as KW_EV_FAULT. The README says it plainly: "There is no emulated trap and no emulated kernel mode in between."

That is why the README's syscall numbers sit next to native rather than next to QEMU. They measured getppid at 172 ns against 110 native and 1,662 under qemu-system, and fork, exit and wait at 57 µs against 73 native. Those were taken on 14 November with the riscv64 user space the project started with; the kernel path is the same for arm64, but they are the project's numbers, not mine.

Four panels of horizontal bars, time per operation, lower is faster, measured under Node. getppid: native 110 ns, qemu-user 320 ns, qemu-system 1,662 ns, unkernel 172 ns. read 64 B from /dev/zero: 161, 481, 2,247 and 172 ns. pipe write plus read: 417, 1,032, 7,256 and 482 ns. fork plus exit plus wait: 73, 537, 1,178 and 57 µs.
The README's kernel-path benchmarks, measured under Node on 2026-11-14 with the earlier riscv64 user space. Pure computation is the other story: the README puts the interpreter at 250 to 300 million guest instructions a second, well behind native. (unkernel repository, assets/performance.svg.)

The flip side is that everything that is not the kernel is slow. Programs run on kwemu's decoded-op interpreter, and hot blocks go to a second tier that compiles them to small wasm modules at run time (kw_host_jit_compile). The README's own Alpine numbers with the JIT are a shell loop in 2.5 s against 4.0 s without it, and seq 100000 | sort -r in 3.1 s against 7.1 s. The README is candid about the rest: apk search over the main index takes about 0.8 s and apk add python3 about 3.4 s. CPU-heavy work in the guest, a compiler above all, pays the interpreter's price.

What the host sees

If the kernel is in the module, what is left for the JavaScript host to do? I listed the imports of the published unkernel.wasm in the npm package, which is the uniprocessor kernel (the SMP build adds a few, such as wasm_cpu_start). There are 84. Thirteen are WASI preview 1: the clock, random bytes, console reads and writes, poll_oneoff for idle, and the file calls that load the initramfs. One is the memory. The other seventy are unkernel's own, and sixty-four of those are device drivers: block, network, framebuffer, input, sound, camera, vsock, shared memory, virtio-gpu, serial, Bluetooth and USB, each a handful of calls. The remaining six are the task switch, the snapshot point, a stack dump and the JIT's three hooks. Nothing is named after a syscall. openat, mmap and clone are handled entirely inside the module, and only device I/O ever leaves it.

The size in the Spanish post is real but needs a footnote. The npm bundle's unkernel.wasm is 12,692,003 bytes, 12.1 MiB. About 8.2 MiB of it is the kernel's code and data. The rest is custom sections: the 1.53 MiB base initramfs, a 2.04 MiB patch that turns the uniprocessor kernel into the SMP one when you ask for more CPUs, and function names. Brotli at level 11 takes that file to 3,867,222 bytes, 3.69 MiB. The page loads a different file, the SMP build: in the current release unkernel-smp.wasm is 11,772,862 bytes, 4,162,671 gzipped, and the page's boot log from an earlier build reports "Downloaded unkernel-smp.wasm, 3.6 MiB". So the 3.6 MB in the post is a compressed transfer of the page's kernel, the same order as my brotli number, and not the size of the module. The README's own figure for a first visit to the page is about 10 MB, because the Alpine image comes on top. In headless Chromium on my server, unkernel.dev had fetched 9,222,573 bytes in 23 requests when the prompt appeared, 3.64 s after navigation.

The unkernel.dev desktop over a mountain photograph. A terminal window titled con shows unkernel, Linux on WebAssembly, and a boot log: Checked browser features (6 ms), Downloaded unkernel-smp.wasm, 3.6 MiB (0 ms), Compiled the kernel (0 ms), Found the base initramfs (1.5 MiB), and Starting the kernel worker in progress. The top bar says Allocating memory.
The page's boot log on 28 November: the kernel download is reported as 3.6 MiB, a compressed transfer. (@alvarombt, 28 November.)

Memory: a real MMU, done by the emulator

The kernel runs only in its direct map. Virtual equals physical equals an offset into the wasm memory, and phys_base is 0. Guest RAM sits below 4 GiB. vmalloc is patched to hand out direct-mapped memory too, so there are no kernel page tables to walk at all.

User space is where the MMU matters, and here unkernel does something unusual. The user page tables use the RISC-V Sv48 format whatever the guest ISA is: four levels, nine bits each, a 12-bit page offset. This is a leftover of the riscv64 start, and it does not matter to the program, which never sees its page tables. kwemu walks them exactly like hardware does, keeps a software TLB, and never writes a page-table entry itself. If the accessed bit is clear, or the dirty bit is clear on a store, kwemu returns KW_EV_FAULT and lets the kernel set the bit (a fast path that does what a RISC-V core with Svadu does) or run handle_mm_fault(). So copy-on-write after fork, mmap of a file, userfaultfd, shared memory and swapless reclaim are all Linux's own code. The address space is arm64's 48 bits: anything at or above 1 << 48 faults, and since kwemu has no top-byte-ignore, tagged pointers fault too.

The kernel's own accesses to user memory (copy_to_user and friends) walk those tables in software as well, and retry while another thread races them. The notes record a page being taken away under them up to 17 times in a row under host load on 17 November. That is the kind of corner a syscall emulator never has to think about, and a reimplementation usually gets wrong.

Threads: JSPI stacks that cannot move

A kernel has to switch tasks in the middle of a function. Plain wasm cannot do that: there is one call stack and no way to set it aside. unkernel uses JSPI (WebAssembly.Suspending and WebAssembly.promising). Every kernel task runs on its own wasm stack. __switch_to calls the suspending import wasm_switch_to, which parks the current stack on a promise and resumes the next one, or starts a fresh stack for a new task through the promising export ret_from_fork. This is why the browser list in the README is "anything with JSPI": Chrome and Edge 137 and up, Firefox 153, Safari 27.

The uniprocessor kernel has one CPU and no preemption. It gets control back three ways. A time slice is 200,000 user instructions, and each syscall or fault costs 1,000 of them, so a loop of cheap syscalls still gets preempted (apt busy-polling pselect() on dpkg's pipe was the bug that forced this). While user code is busy, the kernel yields to the host every 20 ms. And idle goes through poll_oneoff. Time is odd in one respect: the arm64 counter register counts retired instructions, not wall time, so there is no vDSO and clock_gettime is a real syscall.

The SMP kernel is a second build of the same tree: one module instance per CPU, each in its own Web Worker or Node thread, all on one shared memory, with wasm atomics for the kernel's locks. JSPI limits it again. A suspended stack belongs to the thread that created it, so a task can move to another CPU only at the points where its stack can be thrown away: a user task on its way back to user mode, a kernel thread at a restart point. Device imports are answered on CPU 0 only. The README's guidance is that four CPUs get about 3x on parallel work and eight or sixteen add little.

What it costs on my server

Boot is as fast as the README says. Under Node, createKernel() with Alpine resolved in about 40 ms, and the first exec("true") came back after a median of 183 ms over five boots with the JIT, 168 ms over three without it. Squeezing the guest to computerplease's 64 MiB changed nothing: 170 ms. The CLI's scripted run (boot, wait one second, type poweroff, exit) took 1.65 to 1.69 s from process start to exit.

Then I ran the SDK's own profile workloads, the same shell lines the project uses, three times each, on one guest CPU.

Anything that is mostly the kernel is cheap: 60 spawns of /bin/true took 102 ms with the JIT and 100 ms without, and find over the image took 21 ms either way, because process creation and directory walks are compiled kernel code. Anything that is mostly user instructions is slow: sorting 100,000 numbers took 6,884 ms against 29 ms in the server's own shell. And the JIT is worth a lot more on real work than the README's loop suggests: sha256sum over 16 MiB went from 3,471 ms to 467 ms, the sort from 24,977 ms to 6,884 ms (3.6 times, by my arithmetic), gzip from 5,416 ms to 2,737 ms. In that run the JIT compiled 1,318 blocks into 9,228,277 bytes of wasm and spent 522.7 ms doing it. My sort is not the README's (sort -rn piped into md5sum here, sort -r there, on a 2016 desktop chip), so the absolute numbers differ from theirs; the shape is the same.

SMP did what the README promises. Eight parallel seq 20000 | sort -rn | md5sum jobs took 12,913 ms on one CPU and 4,016 ms on four, in worker mode, about 3.2x by my arithmetic. Booting the four-CPU machine took 813 ms against 365 ms for one.

In the browser the numbers hold up. In headless Chromium, unkernel.dev was cross-origin isolated, booted four CPUs with 2,048 MiB, and ran the 40,000-iteration shell loop in 2.78 to 3.69 s by time, in line with the 3,518 ms I got under Node.

Snapshots: park everything first

Here the design pays a price that the emulators do not. A task suspended in JSPI has its continuation inside the engine, and the engine cannot serialise it. So before unkernel can save a machine, every task has to reach a point where its whole state is in guest memory. The kernel parks them: user tasks at the top of user_mode_loop(), where they are just pt_regs and a task_struct; every kernel thread at a kw_park_point() in its loop, where it holds no locks. Then, at a consistent point in the idle loop, the kernel marks its free pages in a bitmap and calls wasm_snapshot_point(), and the host copies the memory during that one call, skipping free pages. A restore instantiates the same build, copies the memory back, and enters through kw_resume instead of _start, so every task starts again on a fresh stack.

A kernel thread without a park point makes every snapshot fail with EBUSY and its name, so every new driver thread needs one. And a restore steps the wall clock and reseeds the RNG through add_vmfork_randomness(), so two machines restored from one snapshot do not hand out the same random numbers. Without that, forking a machine with SSH host keys or TLS sessions would be a quiet security bug.

The notes give the sizes. The idle base shell in a 2 GiB guest saved to 46 MiB on 30 November. A Debian guest that had read every file under /usr and written 300 MiB saved to 593.0 MiB as is, and to 65.1 MiB when the snapshot first syncs and drops the clean page cache, which took 33 ms. The restored machine then reads back what it needs: its first commands took 0.32 s instead of 0.25 s.

I checked the mechanism end to end under Node. With a 256 MiB Alpine guest I wrote a marker file to /tmp, took snapshot({ stop: true }), and restored it twice in a row. The snapshot took 18 ms and encoded to 22,087,752 bytes, 4,276,636 gzipped. Each restore had a working shell in under 60 ms (59 and 56 ms to the first command), the marker was there both times, and the two restores read different values from /proc/sys/kernel/random/uuid. That last check shows the copies diverge; I did not separate the reseed from anything else that might cause it.

kido needs none of this. Its guest kernel runs on an emulated CPU whose entire state is Rust structs in linear memory, so the host can stop scheduling instructions and write everything out. That is the general rule: a full-system emulator snapshots for free, and a kernel compiled to the host's instruction set has to cooperate.

Eighteen days later, in a Durable Object

The unkernel repository was created on 12 November, and its npm package the same day. On 30 November Steve Faulkner shipped computerplease:

computerplease.dev You might have seen you can run a full Linux kernel in a Durable Object. Thanks to unkernel by @_pi0_ [1] So obviously I wired it up to Cloudflare TCP Workers. Now you get a full Linux env running in a DO. Try it: ssh ssh.computerplease.dev The DO is keyed by your SSH key [2], so the computer is entirely yours. The filesystem is backed by SQLite and persists across hibernation. But there is more... of course I also want a coding agent, but most of them won't fit. The guest has 64 MB of RAM and a 128 MB disk. The guest linux VM is just running inside a Worker, so you can run code on the host and expose it as cli commands in the guest. I put Pi Durable on the JS host side and exposed it in the linux guest as "agent" command.

Show more

It flips the usual Workers model: the host is JS and the guest is native Linux running on a wasm CPU. Any command in the guest can be a shim that calls out to JS. And the secrets and the model never enter the VM. [1] unkernel: github.com/pithings/unker… doing Linux in a DO: x.com/acoyfellow/sta… and x.com/smjain/status [2] No SSH key. Run: ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""

Counts as of 2026-12-01

computerplease from the post: ssh in, uname, and the agent command writing and running a script; the model call happens outside the VM. (@southpolesteve, 30 November.)
southpolesteve/computerplease@cbf8e86 · snapshot 2026-12-01
stars
19
license
MIT
branch
main
forks
3
open issues
1
source
152.2 kB
commit date
2026-11-30
source by language
TypeScript104.3 kBPython11.0 kBCSS10.9 kBHTML10.4 kBJavaScript6.8 kBGo6.2 kBShell2.5 kB

Read at cbf8e86 (30 November 2026). Path: gateway/main.go and src/gateway.ts (SSH), src/tenant.ts (the VM Durable Object), src/data-disk.ts (SQLite block device), src/host/bridge.ts and src/host/agent.ts (host commands), src/network.ts (egress).

GitHub REST API, 2026-12-01 — branch, commit, commitDate, createdAt, forks, languages, license, openIssues, pushedAt, stars

The README draws the path as Spectrum TCP on port 22, a Worker running an SSH server written in Go and compiled to wasm, a Durable Object running unkernel with Alpine, and SQLite for the disk. Reading the code fills in the parts that make it work.

Identity is the routing key. The Worker authenticates the SSH key and sends the session to VM.idFromName(fingerprint). The same key always reaches the same object, and so the same disk; a different key gets a different machine. There is no account system.

The disk is a table. DataDisk implements unkernel's BlockDevice on the object's SQLite: one row per 4,096-byte page in disk_pages, all-zero pages deleted rather than stored, each kwblk request one transaction. Its flush() deliberately does not wait for storage.sync(). The comment explains why that is safe: a Durable Object's output gate already holds every outgoing message, SSH bytes included, until the writes before it are durable, so a crash can only lose writes nobody was told about, which is a valid ext4 crash state. The same comment says waiting on every flush had cost about 90 storage round trips on a new tenant's first boot.

The guest is small, and the JIT is off. createKernel is called with memoryMiB: 64 and jit: false. The README gives the limits: 64 MiB of RAM, a 128 MiB disk, two sessions per machine, 15 minutes idle and an hour's lifetime. The repository does not say why the JIT is off, but Cloudflare's runtime documentation does list WebAssembly.compile and WebAssembly.instantiate with a buffer among the things a Worker may not call. kwemu's second tier works by compiling fresh wasm modules at run time, so my reading is that it cannot work in a Worker at all, and every guest instruction there goes through the interpreter. My runs above show what that costs: the same sort takes 24,977 ms instead of 6,884 ms, and hashing 16 MiB takes 3,471 ms instead of 467 ms.

One kernel per isolate. unkernel supports one running kernel per thread, and Cloudflare can place several Durable Objects in one isolate. tenant.ts keeps a module-level kernelInUse flag and a queue of at most four waiters that give up after 8 seconds. A second tenant landing in a busy isolate gets "the demo is running another machine". That is the real density limit of the design today: one live Linux per isolate, not per object.

The agent lives on the host. agent in the guest is an unkernel host command: a stub at /run/kw/bin/agent that forwards argv, working directory, uid and stdio over vsock to a JavaScript handler. The handler cannot start Worker I/O from inside the kernel's call path, so it queues a job and has the live terminal session start a self-RPC, VM.runHostJob(), that owns the command. Pi Durable runs there and calls Workers AI through the binding. Its tool calls come back into the guest as ordinary processes. Steve's post puts it as "the secrets and the model never enter the VM". A coding agent would not fit in 64 MiB anyway.

Egress has one hole to plug. A Worker's connect() cannot open sockets to Cloudflare's own IP ranges. For those destinations only, the Worker terminates TLS 1.3 itself with a demo CA that it installs into the guest, and re-issues the request with fetch(). Everything else is a plain socket and the guest does its own TLS. If you deploy your own copy, the README tells you to make your own CA, which you should.

This is the use I find more interesting than the browser tab. Cloudflare's own Computer workspace keeps state in a Durable Object and runs real binaries in a container that mounts it over FUSE. computerplease removes the container: the Linux machine is a computation inside the object, its disk is the object's SQLite, and the agent and its credentials sit on the other side of an interface that is just a list of commands. Compared with a micro-VM sandbox like NVX, the isolation boundary is the wasm module and the V8 isolate, not a hypervisor, and the CPU is an interpreter at a few hundred million instructions a second. For an agent that mostly runs git, python and curl, that is plausible. For one that compiles Rust, it is not.

kido does it the other way

Still running that linux kernel in your browser? that's so lame and so yesterday Lets boot an arm64 darwin kernel in your browser, snapshot the whole live XNU VM mid-session, and instant-fork it into two independent Darwin instances side-by-side in ~120ms!! It also registers your browser's WebGPU as a virtual PCIe device inside XNU, compiles real Apple .metallib shaders to WGSL on the fly, and runs real Metal compute right in Safari and Chrome. Try snapshot and then restore (even after rm -rf /), btw we also have instant fork! play.kido.sh 👀

Counts as of 2026-12-01

kido is a native macOS micro-VM tool, and kido-wasm is its browser engine, Apache-2.0 and written in Rust. Its README describes a "Clean-room, Apache-2.0 full-system ARMv8-A (AArch64) emulator and WebAssembly VMM", and the code matches: an A64 decoder and interpreter, a Stage-1 MMU with 4, 16 and 64 KiB granules and a software TLB, exception delivery at EL0 and EL1, GICv2 and GICv3, the generic timer, PSCI, a PL011 UART and a PCIe bus with virtio devices. The kernel is Apple's open-source XNU from the macOS 26.5 release, built with Nix in kido's KidoDarwin image, running at EL1 on that emulated CPU. A syscall in kido is an emulated SVC that jumps to the guest's exception vector at VBAR_EL1, exactly what v86 does for x86.

kido-sh/kido-wasm@db147cc · snapshot 2026-12-01

Clean-room Apache-2.0 Rust AArch64 VMM and WebGPU Metal runtime booting unmodified arm64 Darwin (XNU) in your browser

stars
20
license
Apache-2.0
branch
main
forks
1
open issues
0
source
2.0 MB
commit date
2026-11-29
source by language
Rust1.4 MBJavaScript493.6 kBCSS16.6 kBShell16.0 kBHTML15.9 kBPython8.1 kB
aarch64arm64darwinemulatorkidomacosmetalrust

Read at db147cc (29 November 2026): crates/arm64-core (CPU, MMU, exceptions), crates/snapshot (KWSN), crates/virtio-metal, web/src/vm-worker.js (snapshot and fork).

GitHub REST API, 2026-12-01 — branch, commit, commitDate, createdAt, description, forks, homepage, languages, license, openIssues, pushedAt, stars, topics

So on the axis this article is about, kido is in the v86 group, not unkernel's. I found no JIT anywhere in the workspace, and the page's own throughput counter is labelled "Active AArch64 interpreter throughput". What kido gets in return is what full-system emulators always get: the machine's state is the emulator's state, so snapshot and fork are close to free. A fork takes a raw snapshot of VM 1, starts a second Web Worker with a fresh module instance, and restores it there with the same read-only disk chunks and a copy of the dirty blocks. The post puts that at about 120 ms.

On my server, in headless Chromium with no GPU, kido was ready 3.59 s after navigation: a 31,709,216-byte warm snapshot of a 512 MiB machine, downloaded in 821 ms and restored in 1,373 ms. Darwin reported one CPU. The page's counter read 27.3 to 28.7 MIPS. The same 40,000-iteration loop that takes unkernel about 3.5 s took zsh 53.3 s in kido, by zsh's own time; about fifteen times longer by my arithmetic, but the shells differ, so read it as an order of magnitude. Fork worked, and the page reported "Forked in 997 ms": a raw 109,220,654-byte snapshot, restored in the second worker in 481 ms. That is eight times the post's figure, on an old desktop chip with software rendering, so I would not call the 120 ms wrong, but I could not reproduce it.

kido's social card: Real arm64 Darwin in your browser, unmodified XNU kernel and Apple Metal with live snapshots and instant fork. Two terminal panes: VM 1 with a Snapshot 95 ms badge runs metal-demo, which reports MTLDevice WebGPU, matmul 64x64 PASS and a Mandelbrot rendered on the GPU in 5.2 ms; VM 2, a fork marked 124 ms and 512 MiB, runs kl update and kl add libffi. Badges read about 120 ms fork, WebGPU Metal, Apache-2.0.
kido's own card for the playground, with its own timings. (kido-wasm repository, web/public/og-image.png.)

The other trick is the GPU. kido registers a virtio PCI device (0x1af4:0x1090) that XNU sees as a Metal compute device. When a guest program loads a real Apple .metallib, the host compiles its AIR bitcode to WGSL with kido's separate air2 compiler and runs it on the page's WebGPU. unkernel does the same kind of thing for Linux at the API level instead: the guest's Mesa renders through virglrenderer on WebGL2, and its Vulkan goes to WebGPU through a SPIR-V-to-WGSL translator.

And Android, by someone who has done it before

Boom! Full Android running in a browser tab—boots in 1 second! When Apple nuked Twoyi from the TestFlight, I took it to the web. Getting past the brutal 30-second initial boot time was rough, but I finally nailed it. Your move, App Store—try pulling Safari and Chrome.

Counts as of 2026-12-01

weishu, whose profile lists KernelSU, Twoyi and VirtualXposed (Twoyi is "a lightweight Android container on Android"), says Twoyi now runs Android in a tab and boots in a second, after Apple pulled the iOS build from TestFlight. The post has a clip and no link, and I could not find code, so I cannot tell you which of the groups above it belongs to. A one-second boot of something Android-sized suggests a snapshot restore rather than a cold boot, but that is my guess, not something the post says.

Where the line should sit

Moving the line between compiled and emulated code changes more than speed. unkernel's placement makes syscalls, page faults and fork cost roughly what they cost natively, gives every corner of Linux's behaviour for free, and fits a real kernel in a download of a few MiB. It pays in two places. Programs run on an interpreter with a JIT bolted on, which is fine for a shell and an agent's tools and bad for a compiler. And because the kernel's tasks live on JSPI stacks, snapshots need a cooperative parking protocol that every kernel thread has to honour, and threads can only migrate at safe points.

kido's placement pays the other way: every instruction of the kernel is interpreted, and in exchange the machine can be frozen, copied and forked without the kernel's help. If what you want is many disposable copies of one warm machine, that is the better trade. If what you want is a Linux that behaves like Linux and boots in a tab or a Durable Object, unkernel's is.

My position: unkernel is the first browser Linux I would put an agent in, and computerplease shows the shape that makes sense. Keep the guest small and disposable, keep the model and the keys on the host, and give the guest a list of host commands instead of credentials. I would not trust the wasm sandbox as the only boundary for hostile code without the V8 isolate around it, and I would not expect CPU-bound work in the guest to be anything but slow until the JIT can run where the guest runs.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Linux in a browser tab: unkernel compiles the kernel to wasm and emulates only the programs", ai.satyajit.si, December 2026.

bibtex
@misc{ghana2026linuxinabrowsertab,
  author = {Satyajit Ghana},
  title  = {Linux in a browser tab: unkernel compiles the kernel to wasm and emulates only the programs},
  url    = {https://ai.satyajit.si/articles/linux-in-a-browser-tab},
  year   = {2026}
}
share