Skip to content
burk3Public

About

The 9front kernel as WebAssembly: each browser tab is a Plan 9 node, tabs form a grid

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

67 Commits

Folders and files

Repository files navigation

9tab

9tab is the 9front kernel compiled to one WebAssembly module, with user space emulated: unmodified 9front arm64 binaries run on kwemu, an aarch64 CPU (with a JIT to wasm) linked into the kernel. Each browser tab, or Node process, is one Plan 9 node. Nodes share a virtual ethernet and form a grid with 9front's own IP stack, DHCP, 9P, factotum, dp9ik and rcpu: the first tab is the file, auth, DHCP and cpu server; other tabs and devices join as cpu servers or terminals with rio. It is largely written by an AI, with a human steering and checking.

Site: https://9tab.us/. Public grid hub: https://grid.9tab.us/. Source: https://github.com/burk3/9tab.

What you need

  • Node.js (a recent release; the host, hub, tools and tests are plain ESM with no dependencies, so there is nothing to npm install).
  • zig 0.17.1, as vendor/zig/zig, or named by ZIG, or on PATH.
  • Binaryen's wasm-opt (version 133, or any with --table64-lowering), as vendor/binaryen/bin/wasm-opt, or named by WASM_OPT, or on PATH: the build lowers the linked wasm64 kernel to a 32-bit memory. node tools/getbinaryen.mjs downloads the official release for this platform into vendor/binaryen and checks it against a pinned SHA-256.
  • The 9front arm64 userland seed, vendor/seed/9front-arm64.tar (or named by SEED). It is made from the official 9front arm64 QEMU image, vendor/9front-12175.arm64.qcow2.gz, by tools/p9vm.mjs; see tools/README-p9vm.md. That, tools/mkarm64.mjs and the guest tests also need qemu-system-aarch64 and 7z.

vendor/ and build/ are not in the repository. The build downloads nothing: put the toolchain and the seed in vendor/ yourself (or run tools/getbinaryen.mjs for Binaryen).

Build and run

node tools/build.mjs            # kernel -> build/9tab.wasm, build/9tab-jit.wasm
                                # (lowered from the linked build/9tab64*.wasm)
node tools/mkseedroot.mjs       # root image -> build/root.tar.gz, build/root.tar,
                                # build/root.files.txt, build/rootfiles/
node host/cli.mjs --root build/root.tar.gz   # boot one node under Node (Ctrl-] quits)
node --test test/               # tests

A grid in the browser:

node server/hub.mjs             # prints http://localhost:8080/ and the LAN addresses

Open the printed URL and press "Start a grid". That tab is the first node. Its page shows a join link and a QR code: open the link in more tabs, or scan it with another device that can reach the hub (use a LAN address, not localhost, so the code carries one). The join key stays in the URL fragment; the hub only switches ethernet frames. Without the hub, on any static file server, tabs of one browser still form a grid over BroadcastChannel. A node can also join from the command line: node host/cli.mjs --hub URL --grid ID --key K --role cpu.

The public hub at https://grid.9tab.us/ is the same hub on Cloudflare (a Worker and one Durable Object per grid, sharing server/switch.mjs with the Node hub): node tools/mkcf.mjs stages its files and cf/hub/wrangler.jsonc deploys it; see "Hosting on Cloudflare" in AGENTS.md.

Browsers: a current Chrome, Edge or Firefox (the kernel needs JSPI and WebAssembly exception handling; the served kernel has a 32-bit memory, so memory64 is not needed). Safari has not been tried. A three-button mouse is assumed.

Where things are written down

AGENTS.md is the contract: layout, the fixed architecture decisions, the host interface, the grid and how joining works, the persistent root, the dialect changes made to 9front's C. web/README.md covers the page, tools/README-p9vm.md the 9front VM.

Licences

The 9front-derived code and 9tab's own code are MIT, as are the few files from unkernel, Project Nayuki's QR code library and wasi-libc that keep their authors' notices; emu/ (kwemu, from the unkernel project, https://github.com/pithings/unkernel) is GPL-2.0-or-later, so the built kernel modules are GPL-2.0-or-later. LICENSE says which licence covers each directory and file; the texts are in LICENSES/. 9tab is not affiliated with or endorsed by 9front.

About

The 9front kernel as WebAssembly: each browser tab is a Plan 9 node, tabs form a grid

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages