Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Phase 2 roadmap

Phase 1 (the 8-week OJT roadmap, September to December 2026) ended with PsyDian 0.1.0: a single-task kernel with a shell, structured diagnostics and an AI Bridge whose suggestions the kernel checks before anything runs.

Phase 2 turns that kernel into an operating system that can run more than one thing at a time, keep programs apart from the kernel and from each other, and remember what happened across reboots.

Goals

  1. Run several tasks at once and switch between them on the timer.
  2. Separate user programs from the kernel with their own privilege level and address space.
  3. Store data on a disk, including the logs and diagnostics that today live only in memory.
  4. Load and run programs from that disk, and move the shell out of the kernel.
  5. Keep the AI useful as the system grows: diagnostics that name the task that failed, answers grounded in PsyDian’s own documentation, and an offline option.

The safety rule from Phase 1 does not change: the AI only suggests, the kernel checks, and the user decides.

Milestones

Each milestone is a release. The work for each one is tracked as a GitHub milestone with one tracking issue.

ReleaseThemeTargetDone when
0.2.0MultitaskingJanuary 2027Two tasks run at the same time, ps lists them, and a fault names the task that caused it
0.3.0User mode and system callsFebruary 2027A ring 3 program prints through a system call, and a bad memory access in it is reported without stopping the kernel
0.4.0Storage and a file systemMarch 2027Files can be listed, read and written, and the logs survive a reboot
0.5.0Programs from diskApril 2027The shell starts programs from the disk and itself runs in user mode

Dates are targets for two part-time developers, not promises. A milestone ships when its “done when” line is true and its tests pass.

Dependency order

0.1.0 single task
  -> 0.2.0 tasks, context switch, scheduler
       -> 0.3.0 ring 3, system calls, one address space per program
            -> 0.4.0 disk driver, file system, persistent logs
                 -> 0.5.0 ELF loader, shell in user mode

Every later milestone needs multitasking: user programs are tasks, the disk driver waits for the device while other tasks run, and the AI request should not freeze the shell.

0.2.0: Multitasking

The 100 Hz timer (PIT channel 0, IRQ 0) already interrupts the CPU every 10 ms. Phase 2 uses that tick to share the CPU between tasks.

WorkNotes
Task structure and per-task kernel stacksEach task gets its own stack with an unmapped guard page below it, so an overflow is a clean page fault
Context switchSaves and restores the callee-saved registers and the stack pointer; written as a small naked function
Round-robin scheduler, cooperative firstyield_now() switches to the next ready task; an idle task runs hlt when nothing else is ready
Preemption on the timerEvery N ticks the timer handler switches tasks, after sending EOI
Task lifecyclespawn, exit, sleep(ms) built on timer ticks
Locking rulesCritical sections and locks that are safe when a switch can happen at any tick
Shell commandsps lists tasks and their state; kill <id> stops one
DiagnosticsLog records and diagnostic frames carry the task id
TestsTwo tasks interleave; a sleeping task wakes on time; a fault reports its task

0.3.0: User mode and system calls

  • Ring 3 code and data segments in the GDT, and the TSS rsp0 stack used on every switch back to the kernel.
  • syscall / sysret entry with a small system call table: write, exit, sleep, getpid.
  • One page table per program, sharing the kernel’s upper half, so programs cannot read each other’s memory.
  • A fault in user mode becomes a diagnostic and ends that program, not the kernel.

0.4.0: Storage and a file system

  • A virtio block driver for QEMU’s disk.
  • A simple file system (FAT or a small PsyDian format, decided in an architecture decision record).
  • Shell commands to list, read and write files.
  • Logs and diagnostics written to disk, so the AI Bridge can look at history after a reboot.

0.5.0: Programs from disk

  • An ELF loader that maps a program into its own address space and starts it in ring 3.
  • The shell moves to user mode and starts programs by name.
  • A tiny user-space library for programs (system call wrappers, print).

AI track

The AI Bridge can move forward in parallel with the kernel milestones.

WorkMilestone
Include the failing task’s id and name in the AI context0.2.0
Local AI by default when Ollama is installed, so PsyDian works offline0.3.0
Answers grounded in PsyDian’s documentation and recent diagnostics (retrieval)0.4.0
Use the diagnostic history saved on disk0.4.0
Voice input and output (stretch)later

After Phase 2

UEFI boot and real hardware, more than one CPU core, networking, a graphical interface, and an on-device model so the AI can run inside the system without a host bridge.

How to help

Pick an issue in the current milestone, or one labelled good first issue, and read the contributing guide. Bigger design questions belong in Discussions before code.