How mit-pdos/xv6-riscv works
xv6 is a teaching Unix-like operating system for multiprocessor RISC-V. Its main user-to-result path is a user program or shell issuing system calls, the kernel dispatching those requests to process, memory, file, or device services, and results reaching the caller. The graph preserves these major runtime domains and the storage path. Several implementation links are dashed because the supplied excerpts do not show their calls; the file tree and README establish the product, not those specific connections.
Main entry points: fs.c Filesystem · syscall.c Syscall API · trap.c Trap handling · sysfile.c File syscalls
Components 18
User programs
- User programs
user/user.h - Shell
user/sh.c - Init
user/init.c - Utilities
user
System entry
- Syscall API
kernel/syscall.c - Trap handling
kernel/trap.c
Kernel services
- File syscalls
kernel/sysfile.c - Process syscalls
kernel/sysproc.c - Processes
kernel/proc.c - Program loading
kernel/exec.c - Virtual memory
kernel/vm.c - Files and pipes
kernel/file.c
Storage and devices
- Filesystem
kernel/fs.c - Filesystem log
kernel/log.c - Block cache
kernel/bio.c - Virtio disk
kernel/virtio_disk.c - Console I/O
kernel/console.c
Other components
- User
Connections 21
- User → Shell: starts
- User → Init: starts
- Shell → Syscall API: requests
- Init → Syscall API: requests
- User programs → Syscall API: requests
- Utilities → Syscall API: requests
- Syscall API → Trap handling: enters
- Trap handling → File syscalls: dispatches
- Trap handling → Process syscalls: dispatches
- File syscalls → Files and pipes: uses
- File syscalls → Filesystem: operates
- Process syscalls → Processes: operates
- Processes → Program loading: loads programs
- Program loading → Filesystem: reads image
- Program loading → Virtual memory: maps image
- Processes → Virtual memory: manages address space
- Files and pipes → Filesystem: accesses
- Filesystem → Filesystem log: logs updates
- Filesystem → Block cache: uses blocks
- Block cache → Virtio disk: transfers blocks
- Trap handling → Console I/O: handles console I/O