grid.9tab.us

Things to do with a grid

A grid of one tab is a file server talking to itself. Open the join link in a few more tabs first: a couple as cpu servers, one as a terminal. The terminal gets a screen with rio; type the commands below into its shell window. The names here (fs is the first node, cpu-4f2a a cpu node) are examples: the grid window shows yours.

What ships with 9tab

More nodes

The first node's join panel has a link and a QR code, for a terminal, a console terminal or a cpu server. Scan it with a phone and the phone is a cpu server: it does arithmetic for the grid while you look at another screen, which is what phones were always for.

A phone can also join as a console terminal: a shell prompt, no rio, typed on the phone's own keyboard.

With 9tab built from its source, a terminal joins too, no browser involved:

node host/cli.mjs --hub https://grid.9tab.us --grid <id> --key <key> --role cpu

The id and key are the ones in the join link. The key is the grid's secret, so keep it out of your shell history if you care.

grid

The window at the top of the terminal's screen lists every node, with its role and address, and follows them as they come and go. Click a cpu row (or the first node's) with button 1 and you get a rio window with a shell on that node. Button 3 on a row gives a menu: a shell, or stats for that node.

rio wants three buttons, here and from now on. If you can't middle-click you are going to have a bad time.

mandel

mandel

The Mandelbrot set, cut into tiles and farmed out to this terminal and every cpu server in the grid over rcpu. Each tile is framed in the colour of the node that computed it, and the status lines say who did how much. Button 1 zooms in, button 2 zooms out; n tints each tile with its node's colour, a renders again, q quits. Join another tab and watch it take its share of the next render. On a node without a screen, mandel -b renders blind and prints the times.

chat

chat

Every node shares one root, so a group chat is one append-only file and an rc script. Run it on two nodes and type. End it with Delete, or Ctrl-D on a console.

gridps and gridstats

gridps
gridstats

gridps is ps on every node at once, each line marked with the node's name. gridstats draws the load of every node in its window and adds new nodes as they join.

Copy and paste

rio's snarf buffer is your device's clipboard: snarf in rio and paste in another app, and the other way round once you press Paste from this device under the clipboard toggle. Programs get it as /dev/snarf:

echo -n 'hello from the grid' >/dev/snarf

Your files stay

The first node keeps the grid's files in your browser. Close the tab, come back, press Resume on the front page, and they are all there; the joiners boot again onto the same files. The files panel exports everything you changed as a .tar.gz, for when you stop trusting a browser tab with your life's work.

Rebuild the demos

Their sources are in the root, and the compilers came with 9front:

cd /sys/src/cmd/mandel; mk install

From unchanged sources you get the same binary, byte for byte. Change something first; that is the fun part.

Other things to try

Stock 9front, nothing added, but more fun with several machines in one browser.

Work on another node

rcpu -h cpu-4f2a
cat /dev/sysname
ls /mnt/term

A shell on the cpu node, with the terminal's own files and devices at /mnt/term. exit comes back.

Ping a tab

ip/ping -n 3 cpu-4f2a

ICMP between two browser tabs, through 9front's own IP stack in each. Nobody's network admin will ever know.

Borrow a node's network or processes

rimport cpu-4f2a /net /n/cpunet
cat /n/cpunet/ndb

That is the cpu node's network stack, mounted here. Its processes work the same way; ps reads /proc, so give it the remote one in a namespace of its own:

@{rfork n; rimport fs /proc /n/p; bind /n/p /proc; ps}

Swap ps for echo 'stk()' | acid pid and you have a stack trace of a process on the file server, taken from a terminal. The DHCP server's is a good one to start with.

Write some C

cd $home
echo '#include <u.h>' >hello.c
echo '#include <libc.h>' >>hello.c
echo 'void main(void){ print("hello from %s\n", sysname()); exits(nil); }' >>hello.c
7c hello.c && 7l -o hello hello.7 && ./hello
rcpu -h cpu-4f2a -c $home/hello

Compiled on the terminal, run on the cpu node, both in tabs. (Real editors: acme and sam are there.)

A network service in one line

On a cpu node (an rcpu window will do):

aux/listen1 -t 'tcp!*!7777' /bin/fortune &

And from anywhere else:

aux/dial -e tcp!cpu-4f2a!7777 </dev/null

Read the manual

man rc
lookman snarf

The whole manual is there, fetched a page at a time.

Games

games/mahjongg
games/sudoku
games/catclock

There are more in /bin/games. None of them is networked, but they are much better than work.

start a grid