# playershiqiancn/tsuki_os architecture

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

- Interactive diagram: https://gitdiagram.com/playershiqiancn/tsuki_os
- Repository: https://github.com/playershiqiancn/tsuki_os

## Overview

Tsuki OS is a small graphical operating system. Its main user flow is launching a TSK application from the desktop or terminal, running it as a process with a window, and handling its UI, input, and system-service requests. The graph also preserves file, network, and TLX compatibility services. Relationships are limited to README statements and source-index references or excerpts; several implementation details, including desktop dispatch and some drivers, were not sampled.

Main entry points: [`kernel/syscall.c`](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/syscall.c) (System call dispatcher), [`userspace/lib.c`](https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/lib.c) (Userspace library), [`kernel/tlx.c`](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/tlx.c) (TLX compatibility), [`kernel/process.c`](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/process.c) (Process manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["Desktop applications"]
  node_desktop["Desktop shell<br/>[start_tsk.c]"]
  node_wmapp["Window manager app<br/>[wm_tsk.c]"]
  node_terminal["Terminal<br/>[terminal_tsk.c]"]
  node_settings["Settings<br/>[settings_tsk.c]"]
  node_image["Image viewer<br/>[image_tsk.c]"]
  node_app["Basic app<br/>[app.c]"]
end

subgraph group_kernel["Kernel services"]
  node_syscall["System call dispatcher<br/>[syscall.c]"]
  node_process["Process manager<br/>[process.c]"]
  node_paging["Address-space manager<br/>[paging.c]"]
  node_window["Window system<br/>[window.c]"]
  node_font["Font services<br/>[font.c]"]
  node_tlx["TLX compatibility<br/>[tlx.c]"]
  node_console["Console services<br/>[console.c]"]
end

subgraph group_io["Devices and storage"]
  node_video["Framebuffer renderer<br/>[video.c]"]
  node_filesystem[("Ext2 file system<br/>[fs.c]")]
  node_disk["Disk driver<br/>[disk.c]"]
  node_network["Network driver<br/>[net.c]"]
  node_pci["PCI driver<br/>[pci.c]"]
  node_ps2["PS/2 input<br/>[ps2.c]"]
end

subgraph group_userspace["Application runtime"]
  node_lib["Userspace library<br/>[lib.c]"]
  node_ui["UI widgets<br/>[ui.c]"]
  node_jpeg["JPEG decoder<br/>[jpeg.c]"]
end

node_user(("User"))

node_user -.->|"uses"| node_desktop
node_user -.->|"uses"| node_terminal
node_desktop -->|"uses API"| node_lib
node_terminal -->|"uses API"| node_lib
node_settings -->|"uses API"| node_lib
node_image -->|"uses API"| node_lib
node_app -->|"uses API"| node_lib
node_desktop -.->|"uses widgets"| node_ui
node_terminal -->|"uses widgets"| node_ui
node_settings -->|"uses widgets"| node_ui
node_image -->|"decodes images"| node_jpeg
node_lib -->|"issues calls"| node_syscall
node_syscall -->|"dispatches file calls"| node_filesystem
node_syscall -->|"dispatches process calls"| node_process
node_syscall -->|"dispatches window calls"| node_window
node_syscall -->|"dispatches drawing"| node_video
node_syscall -->|"checks input"| node_ps2
node_syscall -->|"dispatches network calls"| node_network
node_syscall -->|"handles TLX calls"| node_tlx
node_process -->|"uses address spaces"| node_paging
node_process -->|"binds windows"| node_window
node_window -->|"renders through"| node_video
node_window -->|"tracks processes"| node_process
node_filesystem -.->|"uses disk interface"| node_disk
node_network -->|"uses PCI interface"| node_pci
node_network -->|"uses paging"| node_paging
node_tlx -->|"uses file services"| node_filesystem
node_tlx -->|"uses process services"| node_process
node_tlx -->|"uses input services"| node_ps2
node_tlx -->|"uses console services"| node_console
node_font -->|"loads fonts"| node_filesystem
node_video -->|"uses glyphs"| node_font

click node_desktop "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/start_tsk.c"
click node_wmapp "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/wm_tsk.c"
click node_terminal "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/terminal_tsk.c"
click node_settings "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/settings_tsk.c"
click node_image "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/image_tsk.c"
click node_app "https://github.com/playershiqiancn/tsuki_os/blob/main/apps/app.c"
click node_syscall "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/syscall.c"
click node_process "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/process.c"
click node_paging "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/paging.c"
click node_window "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/window.c"
click node_video "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/video.c"
click node_font "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/font.c"
click node_filesystem "https://github.com/playershiqiancn/tsuki_os/blob/main/fs/fs.c"
click node_disk "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/disk.c"
click node_network "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/net.c"
click node_pci "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/pci.c"
click node_ps2 "https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/ps2.c"
click node_tlx "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/tlx.c"
click node_console "https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/console.c"
click node_lib "https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/lib.c"
click node_ui "https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/ui.c"
click node_jpeg "https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/jpeg.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_desktop,node_wmapp,node_terminal,node_settings,node_image,node_app,node_user toneBlue
class node_syscall,node_process,node_paging,node_window,node_font,node_tlx,node_console toneAmber
class node_video,node_filesystem,node_disk,node_network,node_pci,node_ps2 toneMint
class node_lib,node_ui,node_jpeg toneRose
```

## Components

### Desktop applications

- [Desktop shell](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/start_tsk.c): `apps/start_tsk.c`
- [Window manager app](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/wm_tsk.c): `apps/wm_tsk.c`
- [Terminal](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/terminal_tsk.c): `apps/terminal_tsk.c`
- [Settings](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/settings_tsk.c): `apps/settings_tsk.c`
- [Image viewer](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/image_tsk.c): `apps/image_tsk.c`
- [Basic app](https://github.com/playershiqiancn/tsuki_os/blob/main/apps/app.c): `apps/app.c`

### Kernel services

- [System call dispatcher](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/syscall.c): `kernel/syscall.c`
- [Process manager](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/process.c): `kernel/process.c`
- [Address-space manager](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/paging.c): `kernel/paging.c`
- [Window system](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/window.c): `drivers/window.c`
- [Font services](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/font.c): `kernel/font.c`
- [TLX compatibility](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/tlx.c): `kernel/tlx.c`
- [Console services](https://github.com/playershiqiancn/tsuki_os/blob/main/kernel/console.c): `kernel/console.c`

### Devices and storage

- [Framebuffer renderer](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/video.c): `drivers/video.c`
- [Ext2 file system](https://github.com/playershiqiancn/tsuki_os/blob/main/fs/fs.c): `fs/fs.c`
- [Disk driver](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/disk.c): `drivers/disk.c`
- [Network driver](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/net.c): `drivers/net.c`
- [PCI driver](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/pci.c): `drivers/pci.c`
- [PS/2 input](https://github.com/playershiqiancn/tsuki_os/blob/main/drivers/ps2.c): `drivers/ps2.c`

### Application runtime

- [Userspace library](https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/lib.c): `userspace/lib.c`
- [UI widgets](https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/ui.c): `userspace/ui.c`
- [JPEG decoder](https://github.com/playershiqiancn/tsuki_os/blob/main/userspace/jpeg.c): `userspace/jpeg.c`

### Other components

- **User**

## Connections

- User → Desktop shell: uses (evidence: `README.md`)
- User → Terminal: uses (evidence: `README.md`)
- Desktop shell → Userspace library: uses API
- Terminal → Userspace library: uses API (evidence: `apps/terminal_tsk.c`)
- Settings → Userspace library: uses API (evidence: `apps/settings_tsk.c`)
- Image viewer → Userspace library: uses API (evidence: `apps/image_tsk.c`)
- Basic app → Userspace library: uses API (evidence: `apps/app.c`)
- Desktop shell → UI widgets: uses widgets
- Terminal → UI widgets: uses widgets (evidence: `apps/terminal_tsk.c`)
- Settings → UI widgets: uses widgets (evidence: `apps/settings_tsk.c`)
- Image viewer → JPEG decoder: decodes images (evidence: `apps/image_tsk.c`)
- Userspace library → System call dispatcher: issues calls (evidence: `userspace/lib.c`)
- System call dispatcher → Ext2 file system: dispatches file calls (evidence: `kernel/syscall.c`)
- System call dispatcher → Process manager: dispatches process calls (evidence: `kernel/syscall.c`)
- System call dispatcher → Window system: dispatches window calls (evidence: `kernel/syscall.c`)
- System call dispatcher → Framebuffer renderer: dispatches drawing (evidence: `kernel/syscall.c`)
- System call dispatcher → PS/2 input: checks input (evidence: `kernel/syscall.c`)
- System call dispatcher → Network driver: dispatches network calls (evidence: `kernel/syscall.c`)
- System call dispatcher → TLX compatibility: handles TLX calls (evidence: `kernel/syscall.c`)
- Process manager → Address-space manager: uses address spaces (evidence: `kernel/process.c`)
- Process manager → Window system: binds windows
- Window system → Framebuffer renderer: renders through (evidence: `drivers/window.c`)
- Window system → Process manager: tracks processes (evidence: `drivers/window.c`)
- Ext2 file system → Disk driver: uses disk interface
- Network driver → PCI driver: uses PCI interface (evidence: `drivers/net.c`)
- Network driver → Address-space manager: uses paging (evidence: `drivers/net.c`)
- TLX compatibility → Ext2 file system: uses file services (evidence: `kernel/tlx.c`)
- TLX compatibility → Process manager: uses process services (evidence: `kernel/tlx.c`)
- TLX compatibility → PS/2 input: uses input services (evidence: `kernel/tlx.c`)
- TLX compatibility → Console services: uses console services (evidence: `kernel/tlx.c`)
- Font services → Ext2 file system: loads fonts (evidence: `kernel/font.c`)
- Framebuffer renderer → Font services: uses glyphs (evidence: `drivers/video.c`)
