๐ Strawberry Tech Notes
Open a browser tab.
You have a Linux machine.
Not a screenshot of a terminal. Not a website pretending to be a command line. Not a remote server sending terminal output back to you.
An actual Linux kernel, compiled into WebAssembly, running on your device.
You can open a shell, install packages, run Linux programs, work with files, and even launch desktop applications.
Sounds a little unusual, doesn't it?
That's the idea behind Unkernel, an open-source project that takes a rather interesting approach to running Linux in the browser.
But the most interesting part isn't that Linux can run inside a browser.
It's how it manages to do it.
Let's take a look underneath.
1. First, What Does It Usually Mean to Run Linux in a Browser?
When someone says they are running Linux in a browser, there are a few different technologies that might be involved.
And they don't all work the same way.
Imagine opening a terminal and typing
$ uname -a
$ ls
$ python3 --version
For those commands to work, something needs to understand Linux programs, provide the expected operating-system behaviour, and handle things such as files, memory and system calls.
There are several ways to approach this.
๐ Approach 1. Emulate an entire computer
Projects such as v86 and browser-based QEMU builds take the hardware emulation route.
They simulate computer hardware, including a CPU and other devices. An operating system then runs on top of that simulated machine.
The browser isn't simply executing Linux directly. It's hosting an emulated computer.
This is powerful because it can reproduce a familiar hardware environment, but emulating an entire machine introduces overhead.
๐ Approach 2. Recreate the operating system environment
Another approach is to provide a runtime that implements selected operating system APIs.
For example, WebContainers provides a browser-based environment for running Node.js-style development workflows.
Instead of booting a complete Linux kernel, the runtime provides the capabilities that supported applications need.
This can be much faster and more browser friendly, but it isn't the same as running an ordinary Linux kernel with its full set of operating system primitives.
๐ Approach 3. Compile software to WebAssembly
WebAssembly (Wasm) gives developers another option.
Software can be compiled into a format that compatible runtimes can execute inside browsers and other environments.
But compiling a program to WebAssembly doesn't automatically give it Linux.
You still need an environment that provides the operating-system services the program expects.
And this is where Unkernel takes a different direction.
2. Meet Unkernel. A Linux Kernel Compiled to WebAssembly
Unkernel is an open-source project built around an unusual combination.
- A real Linux kernel compiled into WebAssembly.
- A custom ARM64 CPU emulator called
kwemu. - Linux user-space programs running as ARM64 binaries.
- A custom memory management implementation that provides a real Memory Management Unit (MMU).
The project packages the kernel into a WebAssembly module that can run in a compatible browser or in Node.js.
Its GitHub repository describes the kernel as Linux 7.x, with the current source identifying Linux 7.3.4 as its base.
You can explore it here.
Project: https://unkernel.dev
Source code: https://github.com/pithings/unkernel
Here's the important distinction.
Unkernel doesn't emulate the entire computer, and it doesn't replace Linux with a JavaScript implementation. It compiles the Linux kernel itself to WebAssembly.
But there's a catch.
The kernel and the applications running on top of it don't execute in exactly the same way.
To understand that, we need to look at its architecture.
3. The Interesting Part. Split Execution
Unkernel uses a split-execution architecture.
Think of the system as having two main sides.
- The Linux kernel.
- The user-space programs that run on top of it.
They use different execution strategies.
The kernel runs as compiled WebAssembly
The actual Linux kernel code is compiled into WebAssembly.
This includes important operating-system functionality such as
- Process scheduling
- Memory management
- System calls
- Virtual File System (VFS)
- TCP/IP networking
- Filesystem support, including ext4 and overlayfs
When the kernel executes its own logic, it runs as compiled WebAssembly inside the host runtime.
That means the project isn't translating every Linux kernel operation into a collection of JavaScript functions.
It's running compiled kernel code.
User space runs through kwemu
Now consider an application installed inside Linux.
For example
$ python3
$ node
$ apk add curl
These applications are not necessarily compiled to WebAssembly.
Unkernel uses kwemu, a custom ARM64 CPU emulator written in Zig, to execute unmodified ARM64 Linux binaries.
So the architecture looks roughly like this.
Browser / Node.js
|
v
WebAssembly Runtime
|
v
+-----------------------+
| Linux Kernel |
| Compiled to Wasm |
| |
| Scheduler |
| Memory Management |
| Filesystems |
| Networking |
+-----------+-----------+
|
v
+-----------------------+
| kwemu |
| ARM64 Emulator |
| |
| Executes guest |
| ARM64 instructions |
+-----------+-----------+
|
v
+-----------------------+
| Linux User Space |
| |
| Shell |
| Python |
| Node.js |
| Other Linux apps |
+-----------------------+
This is a simplified conceptual diagram, but it captures the key idea.
The kernel is compiled to WebAssembly. User-space programs run through an ARM64 emulator that is linked into the kernel.
And that leads to one of the project's most interesting engineering decisions.
4. System Calls Without the Usual Emulated Trap
Let's say a Linux program wants to read a file.
It doesn't directly manage the storage device itself. It asks the operating system to perform the operation through a system call.
On a conventional ARM64 Linux system, a program uses the svc instruction to request a system call.
That request transfers control from user space into the kernel.
In a traditional CPU-emulation setup, the emulator must interpret the guest instruction, simulate the transition, and move through its own execution machinery before the emulated kernel handles the request.
Unkernel takes a different route.
Its kwemu emulator is linked directly into the WebAssembly-compiled kernel.
When an ARM64 program makes a system call, kwemu can call the corresponding kernel function directly.
In other words, the system doesn't need to simulate the usual hardware exception-and-trap transition between an emulated user program and an emulated kernel.
The kernel function executes as compiled WebAssembly.
Why is that interesting?
Because system calls are everywhere.
Reading files, creating processes, allocating memory and communicating with the operating system all depend on kernel services.
Reducing overhead in this path can make a meaningful difference.
It's one of the central ideas behind Unkernel's performance.
5. The Memory Problem. WebAssembly Has Linear Memory. Linux Expects an MMU.
Now we get to a particularly interesting engineering challenge.
WebAssembly uses a linear memory model.
You can think of it as a large, contiguous region of memory that a Wasm module accesses through memory operations.
Linux, however, expects something much more sophisticated.
It uses virtual memory.
Every process has its own virtual address space, and the operating system manages how virtual addresses map to physical memory.
This is the job of the Memory Management Unit (MMU).
An MMU is essential for capabilities such as
- Process isolation
- Virtual memory
- Memory protection
fork()- Copy-on-write
- Memory-mapped files through
mmap()
Without proper memory-management support, running an ordinary Linux user space becomes much harder.
Some earlier Linux-to-Wasm approaches used NOMMU configurations.
That means they ran without a conventional Memory Management Unit, limiting the operating-system features they could support.
Unkernel implements its own page-table structures inside WebAssembly's linear memory.
Its current implementation uses Sv48-style page tables.
The kwemu emulator consults these page tables when translating guest memory accesses.
This allows the Linux kernel's own memory-management code to manage guest processes rather than relying on a simplified, externally implemented memory model.
It supports Linux memory features including
fork()- Copy-on-write (COW)
mmap()- Memory protection
- Shared memory
A quick look at copy-on-write
Imagine a process creates a child process using fork().
A naive implementation could duplicate all of the parent's memory immediately.
That would be expensive.
With copy-on-write, the parent and child can initially share memory pages.
If one process tries to modify a shared page, the operating system creates a separate copy for that process.
The other process continues using its original page.
This avoids unnecessary copying.
Supporting this kind of memory behaviour is one of the reasons Unkernel's MMU implementation matters.
6. How Can a Synchronous WebAssembly Runtime Handle a Linux Kernel That Needs to Wait?
Here's another problem.
Linux isn't just a collection of functions that execute from beginning to end.
An operating system needs to deal with things that take time.
- Waiting for network packets
- Waiting for storage operations
- Timer events
- Scheduling processes
- Switching between tasks
But ordinary WebAssembly execution is synchronous and run-to-completion.
A WebAssembly function normally runs until it returns. It doesn't automatically suspend its execution and resume later just because a JavaScript promise is pending.
So how does Unkernel handle operations that need to wait?
It uses WebAssembly JSPI, short for JavaScript Promise Integration.
JSPI provides a way for WebAssembly execution to suspend when it calls an asynchronous JavaScript host function, then resume when the associated promise settles.
The relevant APIs include
WebAssembly.Suspending()
WebAssembly.promising()
Conceptually, imagine a kernel operation that needs to wait for an asynchronous host-side event.
Instead of blocking the browser's JavaScript execution forever, the WebAssembly stack can be suspended.
When the operation is ready, execution can resume.
This is important because Linux expects to manage execution across processes and handle operations that aren't immediately ready.
JSPI helps bridge the difference between that execution model and asynchronous browser APIs.
It's not magic, though.
Unkernel depends on compatible JavaScript and WebAssembly runtimes, and its browser requirements include modern JSPI support.
The project provides a support check so an application can determine whether the required features are available before booting.
7. The User-Space Emulator Has a JIT Too
Remember kwemu, the ARM64 emulator?
Interpreting every guest CPU instruction one at a time would be expensive.
Unkernel therefore uses a two-tier execution strategy.
๐ Tier 1. Interpreter
The emulator decodes and executes guest instructions.
This provides a relatively quick startup path, so the guest can begin running programs without first compiling everything.
๐ Tier 2. Dynamic WebAssembly JIT
When certain guest code paths become frequently executed, the system can compile hot blocks into WebAssembly modules at runtime.
The host WebAssembly engine can then use its own JIT compiler to translate that code into machine instructions for the host CPU.
So there are two different things happening.
- The Linux kernel is already compiled to WebAssembly.
- Frequently executed ARM64 guest code can be dynamically translated into WebAssembly too.
This is a clever combination.
The interpreter helps with startup, while the JIT aims to improve performance for code that runs repeatedly.
It's also important not to confuse this with native execution of the original ARM64 binary. The guest instructions are still being translated into a representation the host Wasm runtime can execute.
8. How Does Linux Talk to Browser Hardware?
A Linux machine normally expects devices.
Storage, networking, graphics, input devices and other hardware all need drivers.
But a browser doesn't give a web application unrestricted access to the computer's hardware.
It provides controlled APIs.
Unkernel connects the Linux environment to its host through paravirtualized devices.
Instead of emulating a traditional physical computer with old hardware buses and peripherals, it uses purpose-built interfaces that communicate with the JavaScript host.
Some examples
| Linux capability | Host-side integration |
|---|---|
| Storage | OPFS or IndexedDB |
| Networking | Host sockets or Wisp proxy |
| Graphics | WebGL2 and WebGPU |
| USB | WebUSB |
| Serial devices | Web Serial |
| Bluetooth | Web Bluetooth |
| Camera | Browser media capabilities |
๐ Storage
Unkernel can use browser storage such as the Origin Private File System (OPFS) or IndexedDB.
It supports Linux filesystems, including ext4.
Its root filesystem uses an overlay arrangement. A read-only distribution image sits underneath changes made by the guest.
A persistent data disk can keep those changes across reloads.
Without a persistent disk, changes may remain only in memory and disappear when the session ends.
๐ Networking
The Linux kernel has its own TCP/IP stack.
But browsers generally don't allow websites to open arbitrary raw TCP connections.
So Unkernel needs a bridge between the guest's network stack and the browser's networking capabilities.
It can use a Wisp proxy to carry network traffic over a browser-supported connection.
In Node.js, it can use the host's native sockets instead.
This is a good example of the distinction between running a real Linux networking stack and having unrestricted access to physical network interfaces.
๐ Graphics
Unkernel can connect Linux graphics workloads to browser graphics APIs.
Its graphics integration includes WebGL2 and WebGPU, allowing supported guest graphics workloads to be presented inside the browser.
It can also run desktop environments and applications through its display integration.
The browser is still the host environment. Linux doesn't suddenly gain unrestricted access to the computer's physical GPU.
9. Performance. Is It Actually Fast?
This is where the project becomes particularly interesting.
Unkernel publishes benchmarks comparing its implementation with native Linux and QEMU.
The project reports the following measurements.
| Operation | Native Linux | Unkernel | QEMU |
|---|---|---|---|
getppid syscall |
~110 ns | ~170 ns | ~1,660 ns |
64-byte read
|
~160 ns | ~170 ns | ~2,247 ns |
fork + exit + wait |
~70 ยตs | ~60 ยตs | ~1,200 ยตs |
Time to /init
|
~30 ms | ~70 ms | ~2,500 ms |
| Boot to shell | ~0.2 s | ~0.3 s | ~5โ10 s |
These are project-reported benchmark results, not universal performance guarantees.
The measurements depend on the host, runtime, workload and benchmark setup. They shouldn't be treated as a promise that every Linux application will run at native speed.
But they reveal something important.
Unkernel's design is especially effective at reducing overhead in kernel operations.
System calls, process creation and other kernel-heavy work can perform surprisingly well.
However, CPU-heavy workloads are a different story.
The guest application still has to execute through the ARM64 emulator and its interpreter/JIT pipeline.
The project itself reports that CPU-intensive workloads remain noticeably slower than native execution.
So the interesting conclusion isn't that Unkernel makes every Linux program as fast as native Linux.
It's that a carefully designed WebAssembly execution model can bring some operating-system operations remarkably close to native performance.
10. What Could We Actually Use It For?
A Linux environment inside a browser is more than a fun technical experiment.
It opens up some interesting possibilities.
๐ AI coding agent sandboxes
AI coding agents often need to execute commands generated by a model.
git clone ...
npm install
npm test
python3 script.py
Traditionally, safely executing these commands may require provisioning containers or remote virtual machines.
An environment such as Unkernel could provide a lightweight place to run supported commands and inspect their results.
This is particularly interesting for browser-based development tools and agent workflows.
However, running commands in an isolated environment doesn't automatically make every workload safe. Security boundaries, resource limits, network access and filesystem permissions still matter.
๐ Interactive developer documentation
Imagine reading a tutorial about Linux commands and being able to open a terminal right beside the explanation.
No separate VM installation.
No remote development server that needs to stay running.
Just an interactive environment in the browser.
That could make technical documentation much more hands-on.
๐ Browser-based development tools
Unkernel also provides a JavaScript SDK.
That means developers can integrate its Linux environment into their own applications rather than only using the hosted website.
For example, a web-based coding environment could create a Linux guest, send commands to it, and receive its output.
๐ Hardware development
With supported browser APIs, Linux tools can communicate with certain physical devices through interfaces such as WebUSB and Web Serial.
That opens interesting possibilities for embedded development, device flashing and hardware tooling.
The browser still controls what access is allowed, but the combination is worth paying attention to.
11. What Are the Limitations?
This is where we should separate an exciting engineering achievement from the idea that it can replace every Linux machine.
Unkernel has real limitations.
1. Browser compatibility
It depends on modern WebAssembly features, including JSPI. Older browsers or unsupported environments may not be able to run it.
2. CPU-heavy workloads
The kernel can execute efficiently as WebAssembly, but user-space applications still run through the ARM64 emulator. Heavy computation can be considerably slower than native execution.
3. Browser networking restrictions
A browser-based guest cannot simply expose arbitrary public TCP listening ports. Networking needs to work through supported host integrations or proxies.
4. Hardware access is restricted
WebUSB, Web Serial and Web Bluetooth are controlled browser APIs. They don't provide unrestricted access to every physical device.
5. Resource constraints
The guest still consumes memory and CPU resources on the host device. Running an operating system inside a browser doesn't make those costs disappear.
These limitations don't make the project less interesting.
They help explain where this architecture makes sense and where a traditional server, container or virtual machine remains the better choice.
12. One Last Thing. Unkernel Is Not a Unikernel
The names sound similar, but they're different concepts.
A unikernel generally combines an application with a specialised, minimal library operating system into a single-purpose image.
Unkernel, on the other hand, runs a general-purpose Linux kernel with a multi-process user space.
It can run distributions such as Alpine and Debian, rather than being a single application packaged with a minimal operating-system environment.
The name is a play on words, not a description of the traditional unikernel architecture.
Final Thoughts
What makes Unkernel interesting isn't simply that someone managed to put a Linux terminal inside a browser.
It's the engineering decisions behind it.
A real Linux kernel compiled to WebAssembly. An ARM64 emulator linked directly into that kernel. Custom page tables. A real MMU model. JavaScript Promise Integration for suspending execution. A JIT that translates frequently executed guest code.
Each piece solves a different problem.
And together, they create an environment that challenges the usual trade-offs between emulation, compatibility and performance.
WebAssembly is often introduced as a way to run code written in languages such as C, C++ and Rust inside a browser.
Projects like Unkernel show another direction. WebAssembly can also become a foundation for experimenting with much more complex systems software.
The browser is no longer just displaying an application.
It's becoming a place where an operating-system environment can live.
And honestly, that's a pretty interesting direction for the web.
Further Reading
- Unkernel official project
- Unkernel GitHub repository
- Linux kernel documentation
- WebAssembly on MDN
- WebAssembly JSPI on MDN



Top comments (0)