How jjake-08/xv6-riscv works
xv6 is a teaching Unix-like operating system for multiprocessor RISC-V. Its principal workflow is a user program issuing system calls that the kernel handles while managing processes, memory, files, and devices. The graph highlights those domain areas and the kernel’s syscall boundary as an internal layer. The supplied excerpts chiefly expose interfaces and selected modules; unverified runtime links are dashed rather than presented as inspected call paths.
Main entry points: syscall.c Syscall dispatch · sysfile.c File syscalls · fs.c Filesystem · sh.c Command shell
Components 18
Userland
- Command shell
user/sh.c - System init
user/init.c - User API
user/user.h - User utilities
user
Kernel services
- Syscall dispatch
kernel/syscall.c - File syscalls
kernel/sysfile.c - Program loading
kernel/exec.c - Process management
kernel/proc.c - Trap handling
kernel/trap.c - Virtual memory
kernel/vm.c
Storage
- File descriptors
kernel/file.c - Filesystem
kernel/fs.c - Filesystem journal
kernel/log.c - Block cache
kernel/bio.c
RISC-V platform
- Virtio disk
kernel/virtio_disk.c - Console I/O
kernel/console.c - RISC-V interface
kernel/riscv.h
Other components
- User
Connections 17
- User → Command shell: runs commands
- System init → Command shell: starts shell
- Command shell → User API: uses API
user/sh.c - User utilities → User API: uses API
user/usertests.c - User API → Syscall dispatch: requests services
- Syscall dispatch → File syscalls: dispatches file calls
- Syscall dispatch → Process management: dispatches process calls
- Syscall dispatch → Program loading: dispatches exec
- Process management → Virtual memory: manages address spaces
- Trap handling → Syscall dispatch: handles user calls
- File syscalls → File descriptors: uses descriptors
- File syscalls → Filesystem: accesses files
- Filesystem → Filesystem journal: logs updates
- Filesystem → Block cache: reads blocks
- Block cache → Virtio disk: requests I/O
- Console I/O → RISC-V interface: uses machine interface
kernel/console.c - Trap handling → RISC-V interface: uses machine interface
kernel/trap.c