How kkorel/pintos-kernel works
PintOS is a teaching kernel for 32-bit x86, implementing threads and user programs with a base file system. The principal workflow is a user program invoking a system call, which validates user memory and dispatches process or file operations; process execution loads an ELF executable and constructs its argument stack. The kernel also schedules threads, provides blocking synchronization and timer alarms, and accesses disk-backed file-system data. The README documents priority donation, MLFQS, and thirteen system calls. Some subsystem links are based on documentation because their implementation excerpts were not sampled.
Main entry points: syscall.c Syscall dispatch · process.c Process lifecycle · filesys.c Filesystem operations · block.c Block devices
Components 17
Kernel core
- Threads and schedulers
src/threads/thread.c - Synchronization
src/threads/synch.c - Interrupt handling
src/threads/interrupt.c
Device I/O
- Timer alarms
src/devices/timer.c - Block devices
src/devices/block.c - Partition discovery
src/devices/partition.c - IDE disks
src/devices/ide.c
User processes
- Process lifecycle
src/userprog/process.c - Exceptions
src/userprog/exception.c
System calls
- User syscall API
src/lib/user/syscall.c - Syscall dispatch
src/userprog/syscall.c
Base filesystem
- Filesystem operations
src/filesys/filesys.c - File operations
src/filesys/file.c - Directories
src/filesys/directory.c - Inode storage
src/filesys/inode.c - Sector allocation
src/filesys/free-map.c
Other components
- User program
Connections 18
- User program → User syscall API: invokes
- User syscall API → Syscall dispatch: traps to
- Syscall dispatch → Process lifecycle: dispatches
- Syscall dispatch → Filesystem operations: dispatches file calls
- Process lifecycle → Threads and schedulers: creates threads
- Process lifecycle → Filesystem operations: loads executable
- Exceptions → Process lifecycle: terminates on fault
- Timer alarms → Threads and schedulers: wakes sleepers
- Synchronization → Threads and schedulers: blocks and unblocks
- Syscall dispatch → Interrupt handling: registers trap
- Filesystem operations → File operations: operates on files
- Filesystem operations → Directories: directory operations
- File operations → Inode storage: accesses inode
- Directories → Inode storage: stores entries
- Sector allocation → Block devices: reads and writes
- Inode storage → Block devices: reads and writes
- Partition discovery → Block devices: registers partitions
- IDE disks → Block devices: registers disks