# cfenollosa/os-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/cfenollosa/os-tutorial
- Repository: https://github.com/cfenollosa/os-tutorial

## Overview

os-tutorial is a sequence of small, progressively developed OS examples, not one integrated application. The visible progression moves from C basics through VGA output and interrupt handling to a kernel with keyboard, timer, and libc support; the README also identifies memory management and a simple shell as course goals. The graph emphasizes the later kernel snapshots and the documented tutorial workflow. Source excerpts are partial, so some documented capabilities and unsampled subsystem links are shown only where the README or index supports them.

Main entry points: [`23-fixes/cpu/isr.c`](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/isr.c) (Interrupt dispatch), [`23-fixes/drivers/screen.c`](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/drivers/screen.c) (Screen output), [`23-fixes/kernel/kernel.c`](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/kernel/kernel.c) (Shell kernel), [`20-interrupts-timer/drivers/keyboard.c`](https://github.com/cfenollosa/os-tutorial/blob/master/20-interrupts-timer/drivers/keyboard.c) (Keyboard driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lessons["Kernel lessons"]
  node_c_basics["C foundations<br/>[function.c]"]
  node_barebones["Barebones kernel<br/>[kernel.c]"]
  node_video_ports["Video port lesson<br/>[kernel.c]"]
end

subgraph group_cpu["CPU and interrupts"]
  node_interrupt_lesson["Interrupt handling<br/>[isr.c]"]
  node_irq_lesson["IRQ handling<br/>[isr.c]"]
  node_isr["Interrupt dispatch<br/>[isr.c]"]
  node_idt["Interrupt table<br/>[idt.c]"]
end

subgraph group_io["Drivers and I/O"]
  node_video_driver["VGA screen<br/>[screen.c]"]
  node_scrolling["Screen scrolling<br/>[screen.c]"]
  node_timer["Timer driver<br/>[timer.c]"]
  node_keyboard["Keyboard driver<br/>[keyboard.c]"]
  node_screen["Screen output<br/>[screen.c]"]
  node_ports["Port I/O<br/>[ports.c]"]
end

subgraph group_runtime["Kernel runtime"]
  node_shell_kernel["Shell kernel<br/>[kernel.c]"]
  node_string["String utilities<br/>[string.c]"]
  node_memory["Memory utilities<br/>[mem.c]"]
end

node_learner(("Tutorial learner"))
node_hardware(("Keyboard and timer hardware"))

node_learner -->|"starts with"| node_c_basics
node_c_basics -->|"continues to"| node_barebones
node_barebones -->|"continues to"| node_video_ports
node_video_ports -->|"continues to"| node_video_driver
node_video_driver -->|"extends"| node_scrolling
node_scrolling -->|"continues to"| node_interrupt_lesson
node_interrupt_lesson -->|"continues to"| node_irq_lesson
node_irq_lesson -->|"continues to"| node_timer
node_timer -->|"continues to"| node_keyboard
node_shell_kernel -->|"installs"| node_isr
node_shell_kernel -->|"prints through"| node_screen
node_shell_kernel -->|"uses"| node_string
node_shell_kernel -->|"uses"| node_memory
node_isr -->|"configures"| node_idt
node_isr -->|"reports through"| node_screen
node_isr -->|"initializes"| node_keyboard
node_isr -->|"uses"| node_string
node_screen -->|"accesses cursor"| node_ports
node_screen -->|"copies screen data"| node_memory
node_keyboard -->|"prints keys"| node_screen
node_hardware -->|"provides scancodes"| node_keyboard
node_hardware -.->|"interrupt source"| node_timer

click node_c_basics "https://github.com/cfenollosa/os-tutorial/blob/master/12-kernel-c/function.c"
click node_barebones "https://github.com/cfenollosa/os-tutorial/blob/master/13-kernel-barebones/kernel.c"
click node_video_ports "https://github.com/cfenollosa/os-tutorial/blob/master/15-video-ports/kernel/kernel.c"
click node_video_driver "https://github.com/cfenollosa/os-tutorial/blob/master/16-video-driver/drivers/screen.c"
click node_scrolling "https://github.com/cfenollosa/os-tutorial/blob/master/17-video-scroll/drivers/screen.c"
click node_interrupt_lesson "https://github.com/cfenollosa/os-tutorial/blob/master/18-interrupts/cpu/isr.c"
click node_irq_lesson "https://github.com/cfenollosa/os-tutorial/blob/master/19-interrupts-irqs/cpu/isr.c"
click node_timer "https://github.com/cfenollosa/os-tutorial/blob/master/20-interrupts-timer/cpu/timer.c"
click node_keyboard "https://github.com/cfenollosa/os-tutorial/blob/master/20-interrupts-timer/drivers/keyboard.c"
click node_shell_kernel "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/kernel/kernel.c"
click node_isr "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/isr.c"
click node_idt "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/idt.c"
click node_screen "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/drivers/screen.c"
click node_ports "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/ports.c"
click node_string "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/libc/string.c"
click node_memory "https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/libc/mem.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_c_basics,node_barebones,node_video_ports toneBlue
class node_interrupt_lesson,node_irq_lesson,node_isr,node_idt toneAmber
class node_video_driver,node_scrolling,node_timer,node_keyboard,node_screen,node_ports toneMint
class node_shell_kernel,node_string,node_memory toneRose
class node_learner,node_hardware toneIndigo
```

## Components

### Kernel lessons

- [C foundations](https://github.com/cfenollosa/os-tutorial/blob/master/12-kernel-c/function.c): `12-kernel-c/function.c`
- [Barebones kernel](https://github.com/cfenollosa/os-tutorial/blob/master/13-kernel-barebones/kernel.c): `13-kernel-barebones/kernel.c`
- [Video port lesson](https://github.com/cfenollosa/os-tutorial/blob/master/15-video-ports/kernel/kernel.c): `15-video-ports/kernel/kernel.c`

### CPU and interrupts

- [Interrupt handling](https://github.com/cfenollosa/os-tutorial/blob/master/18-interrupts/cpu/isr.c): `18-interrupts/cpu/isr.c`
- [IRQ handling](https://github.com/cfenollosa/os-tutorial/blob/master/19-interrupts-irqs/cpu/isr.c): `19-interrupts-irqs/cpu/isr.c`
- [Interrupt dispatch](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/isr.c): `23-fixes/cpu/isr.c`
- [Interrupt table](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/idt.c): `23-fixes/cpu/idt.c`

### Drivers and I/O

- [VGA screen](https://github.com/cfenollosa/os-tutorial/blob/master/16-video-driver/drivers/screen.c): `16-video-driver/drivers/screen.c`
- [Screen scrolling](https://github.com/cfenollosa/os-tutorial/blob/master/17-video-scroll/drivers/screen.c): `17-video-scroll/drivers/screen.c`
- [Timer driver](https://github.com/cfenollosa/os-tutorial/blob/master/20-interrupts-timer/cpu/timer.c): `20-interrupts-timer/cpu/timer.c`
- [Keyboard driver](https://github.com/cfenollosa/os-tutorial/blob/master/20-interrupts-timer/drivers/keyboard.c): `20-interrupts-timer/drivers/keyboard.c`
- [Screen output](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/drivers/screen.c): `23-fixes/drivers/screen.c`
- [Port I/O](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/cpu/ports.c): `23-fixes/cpu/ports.c`

### Kernel runtime

- [Shell kernel](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/kernel/kernel.c): `23-fixes/kernel/kernel.c`
- [String utilities](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/libc/string.c): `23-fixes/libc/string.c`
- [Memory utilities](https://github.com/cfenollosa/os-tutorial/blob/master/23-fixes/libc/mem.c): `23-fixes/libc/mem.c`

### Other components

- **Tutorial learner**
- **Keyboard and timer hardware**

## Connections

- Tutorial learner → C foundations: starts with
- C foundations → Barebones kernel: continues to
- Barebones kernel → Video port lesson: continues to
- Video port lesson → VGA screen: continues to
- VGA screen → Screen scrolling: extends (evidence: `17-video-scroll/drivers/screen.c`)
- Screen scrolling → Interrupt handling: continues to
- Interrupt handling → IRQ handling: continues to
- IRQ handling → Timer driver: continues to
- Timer driver → Keyboard driver: continues to
- Shell kernel → Interrupt dispatch: installs (evidence: `23-fixes/kernel/kernel.c`)
- Shell kernel → Screen output: prints through (evidence: `23-fixes/kernel/kernel.c`)
- Shell kernel → String utilities: uses (evidence: `23-fixes/kernel/kernel.c`)
- Shell kernel → Memory utilities: uses (evidence: `23-fixes/kernel/kernel.c`)
- Interrupt dispatch → Interrupt table: configures (evidence: `23-fixes/cpu/isr.c`)
- Interrupt dispatch → Screen output: reports through (evidence: `23-fixes/cpu/isr.c`)
- Interrupt dispatch → Keyboard driver: initializes (evidence: `23-fixes/cpu/isr.c`)
- Interrupt dispatch → String utilities: uses (evidence: `23-fixes/cpu/isr.c`)
- Screen output → Port I/O: accesses cursor (evidence: `23-fixes/drivers/screen.c`)
- Screen output → Memory utilities: copies screen data (evidence: `23-fixes/drivers/screen.c`)
- Keyboard driver → Screen output: prints keys (evidence: `20-interrupts-timer/drivers/keyboard.c`)
- Keyboard and timer hardware → Keyboard driver: provides scancodes (evidence: `20-interrupts-timer/drivers/keyboard.c`)
- Keyboard and timer hardware → Timer driver: interrupt source
