RVOS
A minimal RISC-V operating system kernel running on QEMU virt.
A small teaching operating system kernel written in C that runs inside a RISC-V emulator, covering memory management, task scheduling, file system, system calls, and an interactive shell, built to help people learn OS internals hands-on.
RVOS is a small operating system kernel written in C, designed to run inside QEMU, a program that pretends to be a RISC-V computer so you can test low-level code without physical hardware. The project started as a teaching kernel and grew into a compact lab project covering most of the core pieces an operating system needs: memory management, task scheduling, system calls, a file system, and a basic interactive shell.
The kernel supports multiple "harts" (hardware threads, the RISC-V word for CPU cores), meaning it can run tasks in parallel across more than one simulated core. It uses a virtual memory model called Sv32, which gives each running task its own separate address space so tasks cannot accidentally read or write each other's memory. A weighted priority round-robin scheduler decides which task runs next, taking into account each task's priority level and a budget counter.
The file system lives entirely in memory and supports common operations: creating, reading, writing, listing, and deleting files. Fourteen system calls are available to user-space tasks, covering console output, file operations, process information, and memory statistics. The interactive shell exposes these through simple commands like ps (show running tasks), free (show memory usage), ls (list files), cat, touch, and write.
To use the project, you need a RISC-V cross-compiler toolchain and the QEMU emulator for RISC-V 32-bit targets. From the source directory, two make commands build and launch the kernel. A debug target starts QEMU paused so you can attach GDB for step-by-step inspection.
The source layout is clear: each major subsystem (scheduler, memory, traps, UART, file system, shell) lives in its own C file. The README includes a full list of source files with a one-line description of each. This is primarily a learning project for people studying operating system internals and the RISC-V architecture.
Where it fits
- Study how an OS kernel manages memory and schedules tasks by reading and modifying the C source for each subsystem.
- Run and debug a RISC-V OS in QEMU to understand how system calls bridge user programs and the kernel.
- Build new shell commands or file system features on top of the existing kernel as a hands-on systems programming exercise.