ahrightos-process
ahrightos-process contains the portable process-management primitives used by
the AhRightOS teaching kernel: PID allocation, saved contexts, process control
blocks, process states, and the round-robin scheduler.
The crate is no_std outside tests and intentionally avoids QEMU-specific
entry code, so students can unit-test process behavior on the host before
booting the full kernel.
ProcessContext publishes layout constants used by the RISC-V context-switch
assembly, and the crate tests assert that the ABI offsets stay stable.
Lifecycle contracts
- Parent child lists are de-duplicated so repeated bookkeeping cannot create phantom children.
RoundRobinScheduler::find_zombie_childis the reap path used bywait.has_living_childrenintentionally excludes zombies: a zombie is reapable state, not a runnable/blocking child. This preventswaitfrom blocking after all remaining children have exited.- Kernel ELF loading now rejects non-
ET_EXECfiles and entry points outsidePT_LOADsegments; AhRightOS does not claim a full Linuxexecvemodel yet.
flowchart LR
Kernel[ahrightos-kernel] --> Process[ahrightos-process]
Process --> PID[ProcessId]
Process --> PCB[ProcessControlBlock]
Process --> Context[ProcessContext]
Process --> Scheduler[RoundRobinScheduler]