# how-to-song/kraftonjungle_week7 architecture

> Architecture diagram of the GitHub repository how-to-song/kraftonjungle_week7, 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/how-to-song/kraftonjungle_week7
- Repository: https://github.com/how-to-song/kraftonjungle_week7

## Overview

Pintos is a 64-bit x86-64 teaching operating system. Its principal workflow is to start and schedule a user process, load its executable, handle system calls and faults, and use kernel memory and file/device services to produce process-visible results. The graph separates process management, virtual memory, filesystem, and kernel/device responsibilities. Source excerpts establish several calls; other links are included only where the SOURCE INDEX supports them. The README describes a Docker-based development environment, not additional runtime product behavior.

Main entry points: [`pintos/userprog/process.c`](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/process.c) (Process lifecycle), [`pintos/vm/vm.c`](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/vm.c) (VM management), [`pintos/threads/thread.c`](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/thread.c) (Threads and scheduler), [`pintos/threads/interrupt.c`](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/interrupt.c) (Interrupt dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Kernel execution"]
  node_scheduler["Threads and scheduler<br/>[thread.c]"]
  node_interrupts["Interrupt dispatch<br/>[interrupt.c]"]
  node_sync["Synchronization<br/>[synch.c]"]
  node_timer["Timer device<br/>[timer.c]"]
  node_serial["Serial device<br/>[serial.c]"]
end

subgraph group_process["User processes"]
  node_syscalls["System calls<br/>[syscall.c]"]
  node_processes["Process lifecycle<br/>[process.c]"]
  node_exceptions["Exceptions and faults<br/>[exception.c]"]
  node_segments["CPU segments<br/>[gdt.c]"]
end

subgraph group_memory["Virtual memory"]
  node_vmcore["VM management<br/>[vm.c]"]
  node_anon["Anonymous pages<br/>[anon.c]"]
  node_filepages["File-backed pages<br/>[file.c]"]
  node_uninit["Lazy page setup<br/>[uninit.c]"]
  node_vminspect["VM inspection<br/>[inspect.c]"]
end

subgraph group_storage["Storage and devices"]
  node_filesys["Filesystem operations<br/>[filesys.c]"]
  node_directories["Directories<br/>[directory.c]"]
  node_files["Open files<br/>[file.c]"]
  node_inodes["Inodes<br/>[inode.c]"]
  node_fat["FAT allocation<br/>[fat.c]"]
  node_freemap["Free-space map<br/>[free-map.c]"]
  node_pagecache["Page cache<br/>[page_cache.c]"]
  node_disk["Disk driver<br/>[disk.c]"]
end

node_user(("User program"))

node_user -.->|"requests services"| node_syscalls
node_syscalls -.->|"dispatches"| node_processes
node_processes -->|"opens executable"| node_filesys
node_processes -->|"reads executable"| node_files
node_processes -->|"uses threads"| node_scheduler
node_processes -->|"manages address space"| node_vmcore
node_processes -->|"updates task state"| node_segments
node_exceptions -->|"registers handlers"| node_interrupts
node_exceptions -->|"uses thread state"| node_scheduler
node_scheduler -->|"uses interrupt controls"| node_interrupts
node_scheduler -.->|"uses locks"| node_sync
node_interrupts -->|"yields on return"| node_scheduler
node_vmcore -.->|"dispatches page operations"| node_anon
node_vmcore -.->|"dispatches page operations"| node_filepages
node_vmcore -->|"uses page types"| node_uninit
node_vmcore -->|"supports inspection"| node_vminspect
node_vmcore -->|"uses cache pages"| node_pagecache
node_filesys -.->|"uses directory services"| node_directories
node_directories -->|"operates on inodes"| node_inodes
node_fat -->|"accesses disk"| node_disk
node_inodes -->|"allocates sectors"| node_freemap
node_disk -->|"waits during detection"| node_timer
node_disk -->|"waits for completion"| node_sync
node_serial -->|"registers device interrupts"| node_interrupts
node_timer -->|"registers timer interrupt"| node_interrupts

click node_scheduler "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/thread.c"
click node_interrupts "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/interrupt.c"
click node_sync "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/synch.c"
click node_syscalls "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/syscall.c"
click node_processes "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/process.c"
click node_exceptions "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/exception.c"
click node_segments "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/gdt.c"
click node_vmcore "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/vm.c"
click node_anon "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/anon.c"
click node_filepages "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/file.c"
click node_uninit "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/uninit.c"
click node_vminspect "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/inspect.c"
click node_filesys "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/filesys.c"
click node_directories "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/directory.c"
click node_files "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/file.c"
click node_inodes "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/inode.c"
click node_fat "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/fat.c"
click node_freemap "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/free-map.c"
click node_pagecache "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/page_cache.c"
click node_disk "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/disk.c"
click node_timer "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/timer.c"
click node_serial "https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/serial.c"

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_scheduler,node_interrupts,node_sync,node_timer,node_serial,node_user toneBlue
class node_syscalls,node_processes,node_exceptions,node_segments toneAmber
class node_vmcore,node_anon,node_filepages,node_uninit,node_vminspect toneMint
class node_filesys,node_directories,node_files,node_inodes,node_fat,node_freemap,node_pagecache,node_disk toneRose
```

## Components

### Kernel execution

- [Threads and scheduler](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/thread.c): `pintos/threads/thread.c`
- [Interrupt dispatch](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/interrupt.c): `pintos/threads/interrupt.c`
- [Synchronization](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/threads/synch.c): `pintos/threads/synch.c`
- [Timer device](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/timer.c): `pintos/devices/timer.c`
- [Serial device](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/serial.c): `pintos/devices/serial.c`

### User processes

- [System calls](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/syscall.c): `pintos/userprog/syscall.c`
- [Process lifecycle](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/process.c): `pintos/userprog/process.c`
- [Exceptions and faults](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/exception.c): `pintos/userprog/exception.c`
- [CPU segments](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/userprog/gdt.c): `pintos/userprog/gdt.c`

### Virtual memory

- [VM management](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/vm.c): `pintos/vm/vm.c`
- [Anonymous pages](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/anon.c): `pintos/vm/anon.c`
- [File-backed pages](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/file.c): `pintos/vm/file.c`
- [Lazy page setup](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/uninit.c): `pintos/vm/uninit.c`
- [VM inspection](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/vm/inspect.c): `pintos/vm/inspect.c`

### Storage and devices

- [Filesystem operations](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/filesys.c): `pintos/filesys/filesys.c`
- [Directories](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/directory.c): `pintos/filesys/directory.c`
- [Open files](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/file.c): `pintos/filesys/file.c`
- [Inodes](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/inode.c): `pintos/filesys/inode.c`
- [FAT allocation](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/fat.c): `pintos/filesys/fat.c`
- [Free-space map](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/free-map.c): `pintos/filesys/free-map.c`
- [Page cache](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/filesys/page_cache.c): `pintos/filesys/page_cache.c`
- [Disk driver](https://github.com/how-to-song/kraftonjungle_week7/blob/dev/pintos/devices/disk.c): `pintos/devices/disk.c`

### Other components

- **User program**

## Connections

- User program → System calls: requests services
- System calls → Process lifecycle: dispatches
- Process lifecycle → Filesystem operations: opens executable (evidence: `pintos/userprog/process.c`)
- Process lifecycle → Open files: reads executable (evidence: `pintos/userprog/process.c`)
- Process lifecycle → Threads and scheduler: uses threads (evidence: `pintos/userprog/process.c`)
- Process lifecycle → VM management: manages address space (evidence: `pintos/userprog/process.c`)
- Process lifecycle → CPU segments: updates task state (evidence: `pintos/userprog/process.c`)
- Exceptions and faults → Interrupt dispatch: registers handlers (evidence: `pintos/userprog/exception.c`)
- Exceptions and faults → Threads and scheduler: uses thread state (evidence: `pintos/userprog/exception.c`)
- Threads and scheduler → Interrupt dispatch: uses interrupt controls (evidence: `pintos/threads/thread.c`)
- Threads and scheduler → Synchronization: uses locks
- Interrupt dispatch → Threads and scheduler: yields on return (evidence: `pintos/threads/interrupt.c`)
- VM management → Anonymous pages: dispatches page operations
- VM management → File-backed pages: dispatches page operations
- VM management → Lazy page setup: uses page types
- VM management → VM inspection: supports inspection (evidence: `pintos/vm/vm.c`)
- VM management → Page cache: uses cache pages
- Filesystem operations → Directories: uses directory services
- Directories → Inodes: operates on inodes (evidence: `pintos/filesys/directory.c`)
- FAT allocation → Disk driver: accesses disk (evidence: `pintos/filesys/fat.c`)
- Inodes → Free-space map: allocates sectors (evidence: `pintos/filesys/inode.c`)
- Disk driver → Timer device: waits during detection (evidence: `pintos/devices/disk.c`)
- Disk driver → Synchronization: waits for completion (evidence: `pintos/devices/disk.c`)
- Serial device → Interrupt dispatch: registers device interrupts (evidence: `pintos/devices/serial.c`)
- Timer device → Interrupt dispatch: registers timer interrupt (evidence: `pintos/devices/timer.c`)
