WaveOS: an operating system written in Reef

WaveOS is a research operating system and proving ground for the Reef programming language. The kernel, drivers and userland are written in Reef: 83 source files, about 40K lines. C and assembly cover only the Limine boot stubs, trap entry, context switching and the Active Object runtime bridge (kernel/boot/). WaveOS primarily targets RISC-V, but is also actively ported to ARM64 and AMD64 platforms.

On real hardware, it reaches an interactive serial console on the Orange Pi RV2 (SpacemiT K1, RISC-V).

How it's built

  • The kernel has Active Objects and a cooperative scheduler with priority queues; the console and keyboard poller run as Active Objects.
  • The kernel has its own mark-and-sweep garbage collector.
  • Memory uses 4-level page tables, and each user program runs in its own address space.
  • Hardware is discovered through the device tree (FDT) or ACPI. Drivers cover USB keyboards over xHCI and EHCI, PCIe, the framebuffer and virtio-blk disks.

What's new

  • Storage and filesystems: WaveOS reads GPT partition tables and mounts several volumes at once through a VFS. ext2 is fully read/write, and FAT32 is read-only.
  • Live system files: kernel state appears under /kern and devices under /dev.
  • Programs from disk: the shell runs Reef programs from /bin, with arguments, over 38 system calls.
  • A real shell: line editing, history and tab completion, plus file, volume, system and power commands.
  • Clock: date reads and sets the time in UTC on QEMU.
  • Built-in help: a help reader with an article index.