How devking-kunal/cos works
cOS is an educational RISC-V operating system whose main workflow boots the kernel, starts the first user process, and runs user programs through system calls into kernel services. Process management and virtual memory support execution; filesystem calls resolve paths and transfer data through the buffer cache to the VirtIO disk. The README also documents process telemetry (procinfo) and console I/O. The tree omits assembly entry/trap stubs, so those implementation details are not mapped; the documented trap-to-dispatch relationship is shown.
Main entry points: main.c Kernel Bring-up · trap.c Trap Handling · syscall.c Syscall Dispatch · sysproc.c Process Syscalls
Components 20
Startup and I/O
- Kernel Bring-up
kernel/main.c - Trap Handling
kernel/trap.c - Console Input
kernel/console.c - UART Driver
kernel/uart.c - Interrupt Controller
kernel/plic.c
User Programs
- Init Process
user/init.c - Command Shell
user/sh.c - User API
user/user.h
Execution Services
- Syscall Dispatch
kernel/syscall.c - File Syscalls
kernel/sysfile.c - Process Syscalls
kernel/sysproc.c - Process Scheduler
kernel/proc.c
Memory Management
- Virtual Memory
kernel/vm.c - Page Allocator
kernel/kalloc.c
Storage
- Open File Layer
kernel/file.c - Filesystem
kernel/fs.c - Block Cache
kernel/bio.c - VirtIO Disk
kernel/virtio_disk.c
Other components
- RISC-V Platform
- User
Connections 25
- RISC-V Platform → Kernel Bring-up: starts kernel
- Kernel Bring-up → Process Scheduler: initializes processes
- Kernel Bring-up → Virtual Memory: initializes paging
- Kernel Bring-up → Trap Handling: sets trap vectors
- Kernel Bring-up → Interrupt Controller: configures interrupts
- Kernel Bring-up → Block Cache: initializes cache
- Kernel Bring-up → Filesystem: initializes inodes
- Kernel Bring-up → VirtIO Disk: initializes device
- Process Scheduler → Init Process: executes /init
- User → Command Shell: enters commands
- Init Process → Command Shell: starts shell
- Command Shell → User API: invokes user services
- User API → Trap Handling: requests kernel service
- Trap Handling → Syscall Dispatch: dispatches syscall
- Syscall Dispatch → File Syscalls: dispatches file calls
- Syscall Dispatch → Process Syscalls: dispatches process calls
- Process Syscalls → Process Scheduler: queries process state
- Process Syscalls → Virtual Memory: measures resident pages
- File Syscalls → Open File Layer: operates on descriptors
- Open File Layer → Filesystem: accesses inodes
- Filesystem → Block Cache: reads and writes blocks
- Block Cache → VirtIO Disk: requests disk I/O
- Virtual Memory → Page Allocator: allocates pages
- Console Input → UART Driver: reads and writes
- Interrupt Controller → Trap Handling: signals interrupts