# sabratech/pintos architecture

> Architecture diagram of the GitHub repository sabratech/pintos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sabratech/pintos
- Repository: https://github.com/sabratech/pintos

## Overview

Pintos is a small 80x86 operating-system framework. Its principal workflow is booting the kernel, scheduling threads, loading user programs, and servicing their system calls; file-system and device subsystems provide persistent and hardware-facing services. The graph preserves those documented capabilities and highlights the sampled process, scheduler, interrupt, and IDE responsibilities. Source excerpts are partial, so connections not directly visible or documented are omitted rather than inferred from module names alone.

Main entry points: [`src/userprog/process.c`](https://github.com/sabratech/pintos/blob/master/src/userprog/process.c) (Process management), [`src/threads/thread.c`](https://github.com/sabratech/pintos/blob/master/src/threads/thread.c) (Thread scheduler), [`src/threads/interrupt.c`](https://github.com/sabratech/pintos/blob/master/src/threads/interrupt.c) (Interrupt handling), [`src/threads/init.c`](https://github.com/sabratech/pintos/blob/master/src/threads/init.c) (Kernel initialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel core"]
  node_boot["Kernel initialization<br/>[init.c]"]
  node_scheduler["Thread scheduler<br/>[thread.c]"]
  node_synchronization["Thread synchronization<br/>[synch.c]"]
  node_interrupts["Interrupt handling<br/>[interrupt.c]"]
  node_memory["Page allocation<br/>[palloc.c]"]
end

subgraph group_user["User processes"]
  node_process["Process management<br/>[process.c]"]
  node_syscalls["System call handling<br/>[syscall.c]"]
  node_exceptions["User exceptions<br/>[exception.c]"]
  node_addressspaces["Address spaces<br/>[pagedir.c]"]
end

subgraph group_storage["File system"]
  node_filesystem["File-system operations<br/>[filesys.c]"]
  node_directories["Directories<br/>[directory.c]"]
  node_inodes["Inodes<br/>[inode.c]"]
  node_free_map["Free-space map<br/>[free-map.c]"]
end

subgraph group_hardware["Devices"]
  node_ide["IDE disk driver<br/>[ide.c]"]
  node_block["Block devices<br/>[block.c]"]
  node_timer["Timer device<br/>[timer.c]"]
end

node_user(("User program"))

node_user -->|"requests services"| node_syscalls
node_boot -->|"starts threads"| node_scheduler
node_boot -->|"enables programs"| node_process
node_process -->|"exits through"| node_scheduler
node_scheduler -->|"activates address space"| node_process
node_process -->|"activates mappings"| node_addressspaces
node_process -->|"allocates user pages"| node_memory
node_filesystem -->|"uses directory operations"| node_directories
node_directories -->|"uses inode operations"| node_inodes
node_inodes -->|"references free map"| node_free_map
node_ide -->|"registers disk"| node_block
node_ide -.->|"handles interrupts"| node_interrupts
node_timer -.->|"registers timer interrupt"| node_interrupts
node_interrupts -->|"may yield"| node_scheduler
node_scheduler -->|"uses synchronization"| node_synchronization
node_exceptions -.->|"registers handlers"| node_interrupts

click node_boot "https://github.com/sabratech/pintos/blob/master/src/threads/init.c"
click node_scheduler "https://github.com/sabratech/pintos/blob/master/src/threads/thread.c"
click node_synchronization "https://github.com/sabratech/pintos/blob/master/src/threads/synch.c"
click node_interrupts "https://github.com/sabratech/pintos/blob/master/src/threads/interrupt.c"
click node_memory "https://github.com/sabratech/pintos/blob/master/src/threads/palloc.c"
click node_process "https://github.com/sabratech/pintos/blob/master/src/userprog/process.c"
click node_syscalls "https://github.com/sabratech/pintos/blob/master/src/userprog/syscall.c"
click node_exceptions "https://github.com/sabratech/pintos/blob/master/src/userprog/exception.c"
click node_addressspaces "https://github.com/sabratech/pintos/blob/master/src/userprog/pagedir.c"
click node_filesystem "https://github.com/sabratech/pintos/blob/master/src/filesys/filesys.c"
click node_directories "https://github.com/sabratech/pintos/blob/master/src/filesys/directory.c"
click node_inodes "https://github.com/sabratech/pintos/blob/master/src/filesys/inode.c"
click node_free_map "https://github.com/sabratech/pintos/blob/master/src/filesys/free-map.c"
click node_ide "https://github.com/sabratech/pintos/blob/master/src/devices/ide.c"
click node_block "https://github.com/sabratech/pintos/blob/master/src/devices/block.c"
click node_timer "https://github.com/sabratech/pintos/blob/master/src/devices/timer.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_boot,node_scheduler,node_synchronization,node_interrupts,node_memory,node_user toneBlue
class node_process,node_syscalls,node_exceptions,node_addressspaces toneAmber
class node_filesystem,node_directories,node_inodes,node_free_map toneMint
class node_ide,node_block,node_timer toneRose
```

## Components

### Kernel core

- [Kernel initialization](https://github.com/sabratech/pintos/blob/master/src/threads/init.c): `src/threads/init.c`
- [Thread scheduler](https://github.com/sabratech/pintos/blob/master/src/threads/thread.c): `src/threads/thread.c`
- [Thread synchronization](https://github.com/sabratech/pintos/blob/master/src/threads/synch.c): `src/threads/synch.c`
- [Interrupt handling](https://github.com/sabratech/pintos/blob/master/src/threads/interrupt.c): `src/threads/interrupt.c`
- [Page allocation](https://github.com/sabratech/pintos/blob/master/src/threads/palloc.c): `src/threads/palloc.c`

### User processes

- [Process management](https://github.com/sabratech/pintos/blob/master/src/userprog/process.c): `src/userprog/process.c`
- [System call handling](https://github.com/sabratech/pintos/blob/master/src/userprog/syscall.c): `src/userprog/syscall.c`
- [User exceptions](https://github.com/sabratech/pintos/blob/master/src/userprog/exception.c): `src/userprog/exception.c`
- [Address spaces](https://github.com/sabratech/pintos/blob/master/src/userprog/pagedir.c): `src/userprog/pagedir.c`

### File system

- [File-system operations](https://github.com/sabratech/pintos/blob/master/src/filesys/filesys.c): `src/filesys/filesys.c`
- [Directories](https://github.com/sabratech/pintos/blob/master/src/filesys/directory.c): `src/filesys/directory.c`
- [Inodes](https://github.com/sabratech/pintos/blob/master/src/filesys/inode.c): `src/filesys/inode.c`
- [Free-space map](https://github.com/sabratech/pintos/blob/master/src/filesys/free-map.c): `src/filesys/free-map.c`

### Devices

- [IDE disk driver](https://github.com/sabratech/pintos/blob/master/src/devices/ide.c): `src/devices/ide.c`
- [Block devices](https://github.com/sabratech/pintos/blob/master/src/devices/block.c): `src/devices/block.c`
- [Timer device](https://github.com/sabratech/pintos/blob/master/src/devices/timer.c): `src/devices/timer.c`

### Other components

- **User program**

## Connections

- User program → System call handling: requests services
- Kernel initialization → Thread scheduler: starts threads
- Kernel initialization → Process management: enables programs
- Process management → Thread scheduler: exits through (evidence: `src/threads/thread.c`)
- Thread scheduler → Process management: activates address space (evidence: `src/threads/thread.c`)
- Process management → Address spaces: activates mappings (evidence: `src/userprog/process.c`)
- Process management → Page allocation: allocates user pages (evidence: `src/userprog/process.c`)
- File-system operations → Directories: uses directory operations (evidence: `src/filesys/directory.c`)
- Directories → Inodes: uses inode operations (evidence: `src/filesys/directory.c`)
- Inodes → Free-space map: references free map (evidence: `src/filesys/inode.c`)
- IDE disk driver → Block devices: registers disk (evidence: `src/devices/ide.c`)
- IDE disk driver → Interrupt handling: handles interrupts (evidence: `src/devices/ide.c`)
- Timer device → Interrupt handling: registers timer interrupt (evidence: `src/devices/timer.c`)
- Interrupt handling → Thread scheduler: may yield (evidence: `src/threads/interrupt.c`)
- Thread scheduler → Thread synchronization: uses synchronization (evidence: `src/threads/thread.c`)
- User exceptions → Interrupt handling: registers handlers (evidence: `src/userprog/exception.c`)
