danos/docs/os-development
Daniel Samson 0fbd2c8f12
init: a protocol you were not granted does not exist
The registry consults the open rows it has been parsing since P2, so
reaching a contract now takes a grant as well as a binding. A caller
without one is answered exactly as it would be for a name nobody ever
bound: same status, same empty reply, same absent capability, byte for
byte, and no log line on either path — klog_read is ungated, so a line on
one and not the other would be the oracle the design set out to remove.
Refusal and absence being one answer is what lets a supervisor later
narrow, fake or park a child's namespace without the child learning what
it was denied.

The manifest gains a third permission for a shape the plan did not
foresee: attestation is one hop, but the driver tree is three deep — the
PS/2 keyboard and mouse are spawned by ps2-bus, which the device manager
spawned — so no row could name them and PS/2 input would simply stop.
A supervise grant lets a delegate vouch for what its children *reach*,
never for what they claim; the bind path is untouched, and the laundering
deputy is still refused.

The review found the receive side of a rule this track had already
written down. Every process holds a sendable handle to the registrar —
resolve installs one for anyone who asks — and ipc_reply_wait never asked
who owned the endpoint, so a stranger could dequeue there: take the
provider endpoints riding bind requests, and answer other clients' opens
in the registrar's name. Receiving is the owner's privilege, like binding
a signal or a timer; sending remains anyone's.

Suite 109/109.
2026-08-01 04:44:45 +01:00
..
README.MD update docs/os-development/README.MD 2026-07-23 01:41:47 +01:00
acpi.md re-org docs 2026-07-23 00:25:34 +01:00
architecture.md re-org docs 2026-07-23 00:25:34 +01:00
arm.md re-org docs 2026-07-23 00:25:34 +01:00
communication.md docs: the communication stack — /protocol namespace, layered model, non-unix hierarchy, SMEP/SMAP plan 2026-07-31 18:11:28 +01:00
discovery.md init: /protocol replaces the ServiceId registry 2026-08-01 02:39:07 +01:00
efi.md docs: catch the docs up with the finished package split 2026-07-30 04:24:34 +01:00
frame-allocator.md re-org docs 2026-07-23 00:25:34 +01:00
framebuffer.md re-org docs 2026-07-23 00:25:34 +01:00
gop.md re-org docs 2026-07-23 00:25:34 +01:00
halting.md re-org docs 2026-07-23 00:25:34 +01:00
heap.md re-org docs 2026-07-23 00:25:34 +01:00
interrupts.md re-org docs 2026-07-23 00:25:34 +01:00
logging.md re-org docs 2026-07-23 00:25:34 +01:00
memory-map.md re-org docs 2026-07-23 00:25:34 +01:00
paging.md re-org docs 2026-07-23 00:25:34 +01:00
power.md init: /protocol replaces the ServiceId registry 2026-08-01 02:39:07 +01:00
process-lifecycle.md re-org docs 2026-07-23 00:25:34 +01:00
process-management.md re-org docs 2026-07-23 00:25:34 +01:00
protocol-namespace.md init: a protocol you were not granted does not exist 2026-08-01 04:44:45 +01:00
release-iso.md re-org docs 2026-07-23 00:25:34 +01:00
resilience.md re-org docs 2026-07-23 00:25:34 +01:00
scheduling.md re-org docs 2026-07-23 00:25:34 +01:00
shared-fate-plan.md re-org docs 2026-07-23 00:25:34 +01:00
smep-smap.md docs: the security-track execution plan — path flag-day, namespace phases, kernel hardening 2026-07-31 19:10:23 +01:00
smp.md re-org docs 2026-07-23 00:25:34 +01:00
syscall.md re-org docs 2026-07-23 00:25:34 +01:00
system-image.md docs: the communication stack — /protocol namespace, layered model, non-unix hierarchy, SMEP/SMAP plan 2026-07-31 18:11:28 +01:00
sysv.md re-org docs 2026-07-23 00:25:34 +01:00
threading-plan.md init: /protocol replaces the ServiceId registry 2026-08-01 02:39:07 +01:00
threading.md init: /protocol replaces the ServiceId registry 2026-08-01 02:39:07 +01:00
timers.md re-org docs 2026-07-23 00:25:34 +01:00
vdso.md init: /protocol replaces the ServiceId registry 2026-08-01 02:39:07 +01:00

README.MD

OS Development

This document explains the architectural decisions behind the operating system.

Written in Zig?

The OS is written in Zig because it has excellent EFI support, so the OS boots quickly without a third-party bootloader.

Zig comes batteries included for systems work — cross-compilation, a build system, and a test runner are all part of the toolchain. Building with -Doptimize=ReleaseSafe keeps runtime safety checks on in the shipped kernel, which removes entire classes of bugs. The built-in test suite, combined with a QEMU integration harness, means every feature is proven to work, before it is shipped.

The codebase of the OS prioritizes readability. The aim is a codebase where someone new to OS development can find their way around without a guide.

A microkernel?

The kernel is a thin layer: it schedules processes and manages memory. Everything else — drivers, file systems, the display — runs in user space as separate, isolated processes.

The payoff is resilience. When a driver crashes, it doesn't take the OS down with it; it gets restarted. That makes this an ideal environment for developing an operating system, because a buggy driver is an ordinary bug: patch it, restart the service, and keep going.

There is a security benefit too. Processes are isolated and talk over Inter-Process Communication (IPC) channels, so compromising one service doesn't hand an attacker the whole machine. Vulnerabilities tend to stay contained in the process they started in.

Other operating systems choose to pack all of these duties into one binary as a Monolithic kernel, mostly for performance: a function call inside the kernel is faster than passing a message between isolated processes. That cost is real — an IPC round-trip is a few microseconds where a function call is nanoseconds — but it is also workload-shaped. Compute-bound programs don't notice it at all. For bulk data like file contents and pixels, the design moves data through shared memory and DMA so it is copied once, the same as a monolithic kernel; only small control messages cross the IPC boundary. What remains is the per-message cost on chatty paths, and the scheduler and memory management are designed to keep that small.

Private ABI

The syscall layer is private. The numbers and structures in abi.zig are an internal detail shared between the kernel and the system's own libraries, and they are free to change between builds.

The public boundary sits one level up: the vDSO that programs call into, and the documented IPC protocols such as the VFS protocol. Programs that stick to those interfaces keep working while the kernel rearranges itself underneath. This is the opposite of the Linux approach, where raw syscall numbers are frozen forever; here, stability is promised at the library and protocol level, and nowhere below it.

Steal the best bits and dump the legacy

The OS is Unix-like, but selectively. It borrows the ideas that have aged well — everything is a file, small services composed over clean interfaces — and skips the parts of POSIX that have caused decades of headaches.

Some concrete choices:

  • spawn, not fork. Creating a process starts a fresh program and returns the child's id. There is no clone-the-whole-address-space-then-immediately-throw-it-away dance, and none of the subtle state-inheritance bugs that come with it.
  • Time is a syscall. The kernel owns the clock and timers directly. There is no time daemon to keep alive and no ambiguity about where the truth lives.
  • Lifecycle events arrive as messages. A supervisor learns that a child exited through an IPC message on an endpoint it already owns — delivered like any other message, not as an interrupt that can fire between any two instructions.

The test for keeping an idea is simple: does it still pull its weight, or is it only there because it was there in 1979?