EDOS

EDOSx86_64

An operating system written from scratch in Rust.

EDOS boots on UEFI, brings up every core on the machine, and drops you into a compositing desktop with a terminal. The scheduler, the filesystem, the network stack, the USB stack and the window system are all original code.

/dev/ttyS0
  1. [0.000000] <cpu-0:kernel> Booting...
  2. [0.000000] <cpu-0:kernel> cmdline: "root=UUID=87654321-4321-8765-cba9-987654321fed rootfstype=efs"
  3. [0.000000] <cpu-0:kernel> Initializing frame allocator
  4. [0.000000] <cpu-0:kernel> Mapped kernel heap at 0xffffc00000000000-0xffffc00000100000
  5. [0.000000] <cpu-0:kernel> Initializing acpi tables
  6. [0.000000] <cpu-0:kernel> Initializing apic
  7. [0.000000] <cpu-0:kernel> Initializing hpet
  8. [0.000000] <cpu-0:kernel> APIC frequency: 1000008514 Hz (1000) MHz
  9. [0.000000] <cpu-0:kernel> TSC frequency: 3493922000 Hz (3.49) GHz
  10. [0.001371] <cpu-3:kernel> SYSCALL/SYSRET enabled
  11. [0.008760] <cpu-3:kernel> Initializing scheduler
  12. [0.012664] <cpu-3:kernel> [smp] AP online: LAPIC id 3
  13. [0.013531] <cpu-2:kernel> [smp] AP online: LAPIC id 2
  14. [0.016946] <cpu-1:kernel> [smp] AP online: LAPIC id 1
  15. [0.105367] <cpu-0:kernel> Reaper thread started (tid=1)
  16. [0.106243] <cpu-0:kernel> Evict kthread started (tid=2)
  17. [0.209548] <cpu-0:kernel> Scanning PCI devices...
  18. [0.782741] <cpu-0:kernel> Found 8 PCI devices
  19. [0.795513] <cpu-3:kernel> xhci: version 0.0, 64 slots, 8 ports
  20. [0.797027] <cpu-0:kernel> virtio-gpu: initialised, control=64, cursor=16, blob=false
  21. [0.798908] <cpu-0:kernel> virtio-gpu: 1920x1080 @ 74Hz
  22. [0.808125] <cpu-2:e1000e:k:6> e1000e: initialized, MAC 52:54:00:12:34:56
  23. [0.808210] <cpu-2:e1000e:k:6> net: dhcp: sending DISCOVER
  24. [0.808546] <cpu-2:e1000e:k:6> net: dhcp: received ACK, IP 10.0.2.15
  25. [0.814095] <cpu-3:kernel> xhci: initial enumeration complete
  26. [0.854537] <cpu-1:hda:k:7> hda: /dev/dsp registered
  27. [0.926856] <cpu-0:kernel> verify_kernel_no_phys_aliasing: 2722 kernel-half mappings, no aliases
  28. [0.932629] <cpu-0:ahci:k:4> AHCI CAP: SNCQ=true, NCS=31 (32 command slots)
  29. [0.933450] <cpu-0:ahci:k:4> Found SATA drive on port 1
  30. [0.942643] <cpu-0:window-input:k:15> Window input routing thread started
  31. [1.623722] <cpu-0:system-mount:k:16> Found root partition with uuid 87654321-4321-8765-cba9-987654321fed
  32. [1.624278] <cpu-0:fs:k:14> efs journal: clean, no replay needed
  33. [1.624372] <cpu-0:system-mount:k:16> Root filesystem mounted
  34. [1.631909] <cpu-0:system-mount:k:16> Spawned bin/edos-init tid=19 cpu=0
  35. [Terminal] Spawned shell (PID: 26)

Verbatim serial output from a four-core boot, replayed at its own timestamps. The long pause is the PCI scan; the second one is mounting the root filesystem.

The EDOS desktop: four windows showing the process table, the kernel log, a text editor and a widget toolkit demo, over a taskbar.
A 1920×1080 guest on four cores. Every window is a separate userspace process talking to the window manager over shared memory.

ps, on an idle desktop

The kernel's own thread table is the feature list.

Nothing below is a wrapper around someone else's driver. Each of these threads is spawned by name at boot, and each one is a subsystem written for this kernel.

PIDNameWhat it does
1reaperTears down dead threads and releases their file descriptors and mappings.
2evict-inodeDoes the blocking half of inode eviction, so no drop path ever waits on disk.
3kloggerDrains the kernel log ring into /dev/klog, which is what dmesg reads.
4ahciSubmits and completes NCQ commands, up to 32 tags in flight at once.
5xhciRuns USB transfers: HID keyboard and mouse, and mass storage.
6e1000eMoves Ethernet frames and drives DHCP and DNS.
7hdaIntel HDA playback, exposed as /dev/dsp.
8vgavirtio-gpu scanout and the hardware cursor.
9tcp-retransmitTCP timers: retransmission, delayed ACK, and TIME-WAIT expiry.
10keyboardDecodes scancodes into key events.
11mouseReads HID boot-protocol reports and moves the pointer.
12block_writebackFlushes dirty pages, gated on the journal having committed.
13journal_committerCommits EFS metadata transactions.
14fsVFS work that cannot run inline: mounts, evictions, async page fill.
15window-inputRoutes keyboard and pointer events to the focused window.
17ahci_watchdogCatches NCQ commands that never complete.

A filesystem, not a port

EFS is an extent-based filesystem with a metadata journal, written for this kernel and formatted by efs-mkfs, which runs on the host and inside EDOS. Mounting replays the journal when the last shutdown was unclean. Above it sit a page cache, a block cache, write-back gated on journal commits, and read-ahead; below it, AHCI with native command queuing.

How EFS works

A terminal showing df, mount and stat output in EDOS.

A network stack that talks to the internet

Ethernet, ARP, IPv4 with fragment reassembly, ICMP, UDP and a TCP state machine, plus DHCP and DNS clients. The guest takes its address from DHCP within a millisecond of the NIC coming up. The same driver runs on real Intel I219 and I218 hardware.

Inside the network stack

A terminal in EDOS running ping, dns and wget against the internet.

The desktop is userspace

The kernel owns a window registry and routes input to whichever window has focus. Everything you can see is an ordinary process: edos-wm composites and draws decorations, edos-taskbar and edos-terminal are separate programs, and they share pixel buffers with the compositor through shared memory.

How the window system fits together

The EDOS widget toolkit demo window with buttons, a text input, checkboxes and sliders.

56 seconds, no cuts

Driven from outside the guest

Recorded straight off the framebuffer over QEMU's monitor socket: keystrokes and pointer events go in, PNG frames come out. It is how the OS gets tested.

The tree

What is actually in here

Rust
72,777 lines across 335 files
Kernel
45,334 lines, no_std, one binary
Userspace
75 programs on a forked Rust std
Syscalls
102, through SYSCALL/SYSRET
Targets
x86_64-unknown-none, x86_64-unknown-edos
History
1,088 commits

Get it running

Build it, then boot it

git clone https://github.com/edg-l/edos-v2
cd edos-v2
make all      # userspace, kernel, bootable ISO
make run      # QEMU: q35, UEFI, KVM, 4 cores

The kernel builds on plain nightly. Userspace links a real std, so it needs a custom toolchain built from a Rust fork; the build guide walks through it. Prefer a prebuilt image? Downloads.