detrytus

trylobite

A small Unix-like operating system for a computer that counts in threes.

trylobite runs on detrytus, a balanced-ternary machine. It has processes, a filesystem, a shell with pipes and job control, a network stack, ssh, a vi, and about sixty programs. detrytus doesn't exist in silicon, so you boot trylobite in the emulator on your own computer, in a few minutes, with no special hardware and no root access.

The name is trilobite with a tryte in it: an ancient sea creature, living among the detritus.

What you can do with it

Try it

You need rustup (Rust 1.97 or later), Python 3 and make.

git clone https://github.com/sgaduuw/trylobite
cd trylobite
tools/install-detrytus
make
make run

The first make compiles every program and takes a few minutes. You then get the boot messages and a $ prompt: try ls, hello | upper, ps, rmandel or vi notes. exit powers the machine off.

How it works

trylobite is a microkernel. The kernel itself only runs processes, gives each its own memory, passes messages between them and keeps track of their open files. Everything else, even the disk driver and the filesystem, is an ordinary process that other processes send messages to:

          ┌──▶ fsd (files) ──▶ diskd (disk) ──▶ block device
          ├──▶ consd (console) ──▶ console
  sh ─────┼──▶ piped (pipes)
          └──▶ ipd (ARP, ping, UDP, TCP) ──▶ netd (frames) ──▶ network device

Nothing is binary underneath, and a few things look different because of it:

The kernel is partly detrytus assembly and partly Rust, and every program on the disk is Rust, translated from the compiler's intermediate code to detrytus machine code by detrytus's own tools.

Read more

The trylobite repository has the full documentation: its README, the kernel and every system call in docs/kernel.md, and the disk format in docs/filesystem.md.