# nari3040/kjg-sw-ai-w07 architecture

> Architecture diagram of the GitHub repository nari3040/kjg-sw-ai-w07, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nari3040/kjg-sw-ai-w07
- Repository: https://github.com/nari3040/kjg-sw-ai-w07

## Overview

This tree is a 64-bit KAIST Pintos operating-system kernel, not the Docker development environment described by the README. Its main runtime path is user code entering the user-program subsystem, which loads executables and manages process state; threads, interrupts, virtual memory, and file storage provide internal services. The tree also contains device drivers and kernel support libraries. The supplied excerpts confirm some calls and imports, but leave syscall dispatch and several subsystem internals unsampled; unverified workflow links are therefore marked dashed.

Main entry points: [`pintos/threads/interrupt.c`](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/interrupt.c) (Interrupt dispatch), [`pintos/vm/vm.c`](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/vm.c) (VM management), [`pintos/filesys/filesys.c`](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/filesys.c) (Filesystem entry), [`pintos/userprog/process.c`](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/process.c) (Process loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Execution &amp; interrupts"]
  node_threads["Thread scheduler<br/>[thread.c]"]
  node_interrupts["Interrupt dispatch<br/>[interrupt.c]"]
  node_sync["Synchronization<br/>[synch.c]"]
  node_intrinsics["CPU primitives<br/>[intrinsic.h]"]
end

subgraph group_user["User programs"]
  node_syscalls["System calls<br/>[syscall.c]"]
  node_process["Process loader<br/>[process.c]"]
  node_exceptions["Exceptions<br/>[exception.c]"]
  node_gdt["Descriptor tables<br/>[gdt.c]"]
end

subgraph group_memory["Virtual memory"]
  node_vm_core["VM management<br/>[vm.c]"]
  node_vm_uninit["Lazy pages<br/>[uninit.c]"]
  node_vm_anon["Anonymous pages<br/>[anon.c]"]
  node_vm_file["File-backed pages<br/>[file.c]"]
  node_vm_inspect["VM inspection<br/>[inspect.c]"]
  node_palloc["Page allocator<br/>[palloc.c]"]
end

subgraph group_storage["File storage"]
  node_filesys["Filesystem entry<br/>[filesys.c]"]
  node_directory["Directories<br/>[directory.c]"]
  node_file["Open files<br/>[file.c]"]
  node_inode["Inodes<br/>[inode.c]"]
  node_fat["FAT allocation<br/>[fat.c]"]
  node_free_map["Free-space map<br/>[free-map.c]"]
  node_page_cache[("Page cache<br/>[page_cache.c]")]
end

subgraph group_devices["Devices"]
  node_disk["Disk driver<br/>[disk.c]"]
  node_timer["Timer driver<br/>[timer.c]"]
  node_serial["Serial input/output<br/>[serial.c]"]
  node_kbd["Keyboard driver<br/>[kbd.c]"]
  node_vga["VGA output<br/>[vga.c]"]
end

node_user_actor(("User process"))

node_user_actor -.->|"invokes"| node_syscalls
node_syscalls -.->|"dispatches"| node_process
node_process -->|"opens executable"| node_filesys
node_process -->|"reads executable"| node_file
node_process -->|"manages address space"| node_vm_core
node_process -->|"configures process context"| node_gdt
node_threads -->|"uses interrupt control"| node_interrupts
node_interrupts -->|"yields on return"| node_threads
node_interrupts -->|"programs CPU state"| node_intrinsics
node_threads -.->|"uses locks"| node_sync
node_exceptions -->|"registers handlers"| node_interrupts
node_vm_core -.->|"dispatches page operations"| node_vm_uninit
node_vm_core -.->|"dispatches page operations"| node_vm_anon
node_vm_core -.->|"dispatches page operations"| node_vm_file
node_vm_core -->|"uses inspection interface"| node_vm_inspect
node_vm_core -.->|"allocates frames"| node_palloc
node_filesys -.->|"routes directory operations"| node_directory
node_directory -->|"uses inode operations"| node_inode
node_directory -->|"uses filesystem interface"| node_filesys
node_inode -->|"uses allocation map"| node_free_map
node_inode -->|"uses filesystem interface"| node_filesys
node_fat -->|"accesses disk"| node_disk
node_fat -->|"uses filesystem interface"| node_filesys
node_filesys -.->|"uses cache"| node_page_cache
node_disk -.->|"registers disk interrupts"| node_interrupts
node_timer -.->|"registers timer interrupts"| node_interrupts
node_serial -.->|"uses interrupt handling"| node_interrupts

click node_syscalls "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/syscall.c"
click node_process "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/process.c"
click node_exceptions "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/exception.c"
click node_gdt "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/gdt.c"
click node_threads "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/thread.c"
click node_interrupts "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/interrupt.c"
click node_sync "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/synch.c"
click node_vm_core "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/vm.c"
click node_vm_uninit "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/uninit.c"
click node_vm_anon "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/anon.c"
click node_vm_file "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/file.c"
click node_vm_inspect "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/inspect.c"
click node_filesys "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/filesys.c"
click node_directory "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/directory.c"
click node_file "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/file.c"
click node_inode "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/inode.c"
click node_fat "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/fat.c"
click node_free_map "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/free-map.c"
click node_page_cache "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/page_cache.c"
click node_disk "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/disk.c"
click node_timer "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/timer.c"
click node_serial "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/serial.c"
click node_kbd "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/kbd.c"
click node_vga "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/vga.c"
click node_palloc "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/palloc.c"
click node_intrinsics "https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/include/intrinsic.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_threads,node_interrupts,node_sync,node_intrinsics,node_user_actor toneBlue
class node_syscalls,node_process,node_exceptions,node_gdt toneAmber
class node_vm_core,node_vm_uninit,node_vm_anon,node_vm_file,node_vm_inspect,node_palloc toneMint
class node_filesys,node_directory,node_file,node_inode,node_fat,node_free_map,node_page_cache toneRose
class node_disk,node_timer,node_serial,node_kbd,node_vga toneIndigo
```

## Components

### Execution & interrupts

- [Thread scheduler](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/thread.c): `pintos/threads/thread.c`
- [Interrupt dispatch](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/interrupt.c): `pintos/threads/interrupt.c`
- [Synchronization](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/synch.c): `pintos/threads/synch.c`
- [CPU primitives](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/include/intrinsic.h): `pintos/include/intrinsic.h`

### User programs

- [System calls](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/syscall.c): `pintos/userprog/syscall.c`
- [Process loader](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/process.c): `pintos/userprog/process.c`
- [Exceptions](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/exception.c): `pintos/userprog/exception.c`
- [Descriptor tables](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/userprog/gdt.c): `pintos/userprog/gdt.c`

### Virtual memory

- [VM management](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/vm.c): `pintos/vm/vm.c`
- [Lazy pages](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/uninit.c): `pintos/vm/uninit.c`
- [Anonymous pages](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/anon.c): `pintos/vm/anon.c`
- [File-backed pages](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/file.c): `pintos/vm/file.c`
- [VM inspection](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/vm/inspect.c): `pintos/vm/inspect.c`
- [Page allocator](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/threads/palloc.c): `pintos/threads/palloc.c`

### File storage

- [Filesystem entry](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/filesys.c): `pintos/filesys/filesys.c`
- [Directories](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/directory.c): `pintos/filesys/directory.c`
- [Open files](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/file.c): `pintos/filesys/file.c`
- [Inodes](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/inode.c): `pintos/filesys/inode.c`
- [FAT allocation](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/fat.c): `pintos/filesys/fat.c`
- [Free-space map](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/free-map.c): `pintos/filesys/free-map.c`
- [Page cache](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/filesys/page_cache.c): `pintos/filesys/page_cache.c`

### Devices

- [Disk driver](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/disk.c): `pintos/devices/disk.c`
- [Timer driver](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/timer.c): `pintos/devices/timer.c`
- [Serial input/output](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/serial.c): `pintos/devices/serial.c`
- [Keyboard driver](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/kbd.c): `pintos/devices/kbd.c`
- [VGA output](https://github.com/nari3040/kjg-sw-ai-w07/blob/main/pintos/devices/vga.c): `pintos/devices/vga.c`

### Other components

- **User process**

## Connections

- User process → System calls: invokes
- System calls → Process loader: dispatches
- Process loader → Filesystem entry: opens executable (evidence: `pintos/userprog/process.c`)
- Process loader → Open files: reads executable (evidence: `pintos/userprog/process.c`)
- Process loader → VM management: manages address space (evidence: `pintos/userprog/process.c`)
- Process loader → Descriptor tables: configures process context (evidence: `pintos/userprog/process.c`)
- Thread scheduler → Interrupt dispatch: uses interrupt control (evidence: `pintos/threads/thread.c`)
- Interrupt dispatch → Thread scheduler: yields on return (evidence: `pintos/threads/interrupt.c`)
- Interrupt dispatch → CPU primitives: programs CPU state (evidence: `pintos/threads/interrupt.c`)
- Thread scheduler → Synchronization: uses locks
- Exceptions → Interrupt dispatch: registers handlers (evidence: `pintos/userprog/exception.c`)
- VM management → Lazy pages: dispatches page operations
- VM management → Anonymous pages: dispatches page operations
- VM management → File-backed pages: dispatches page operations
- VM management → VM inspection: uses inspection interface (evidence: `pintos/vm/vm.c`)
- VM management → Page allocator: allocates frames
- Filesystem entry → Directories: routes directory operations
- Directories → Inodes: uses inode operations (evidence: `pintos/filesys/directory.c`)
- Directories → Filesystem entry: uses filesystem interface (evidence: `pintos/filesys/directory.c`)
- Inodes → Free-space map: uses allocation map (evidence: `pintos/filesys/inode.c`)
- Inodes → Filesystem entry: uses filesystem interface (evidence: `pintos/filesys/inode.c`)
- FAT allocation → Disk driver: accesses disk (evidence: `pintos/filesys/fat.c`)
- FAT allocation → Filesystem entry: uses filesystem interface (evidence: `pintos/filesys/fat.c`)
- Filesystem entry → Page cache: uses cache
- Disk driver → Interrupt dispatch: registers disk interrupts
- Timer driver → Interrupt dispatch: registers timer interrupts
- Serial input/output → Interrupt dispatch: uses interrupt handling
