# jainul-mansuri/-kernel-lab-cpp architecture

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

- Interactive diagram: https://gitdiagram.com/jainul-mansuri/-kernel-lab-cpp
- Repository: https://github.com/jainul-mansuri/-kernel-lab-cpp

## Overview

Mini OS Kernel Simulator is an interactive simulation of processes, CPU scheduling, virtual memory, synchronization, and an inode-based filesystem. The main workflow is to enter commands in the unified shell, create processes, and run the scheduler; users can also request memory accesses and inspect process, queue, memory, and statistics views. The scheduler models CPU bursts and I/O waits, while the MMU provides paging, replacement, and protection. Filesystem operations are a documented product capability, though the sampled CLI excerpt does not show how they are initiated. Some internal memory relationships are left unverified because their implementation excerpts were not provided.

Main entry points: [`src/cli/system.cpp`](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.cpp) (Unified CLI), [`src/cli/system.hpp`](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.hpp) (System Controller), [`src/memory/virtual_memory/virtual_memory.cpp`](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/virtual_memory/virtual_memory.cpp) (Virtual Memory Manager), [`src/scheduler/scheduler.cpp`](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/scheduler/scheduler.cpp) (CPU Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Shell and Control"]
  node_entry["Program Entry<br/>[main.cpp]"]
  node_cli["Unified CLI<br/>[system.cpp]"]
  node_system["System Controller<br/>[system.hpp]"]
end

subgraph group_process["Process Scheduling"]
  node_pcb["Process Control Block<br/>[pcb.hpp]"]
  node_scheduler["CPU Scheduler<br/>[scheduler.cpp]"]
end

subgraph group_memory["Memory Management"]
  node_vm["Virtual Memory Manager<br/>[virtual_memory.cpp]"]
  node_page_structs["Page Structures<br/>[memory_types.hpp]"]
  node_paging["Paging<br/>[paging.cpp]"]
  node_physical_memory["Physical Memory<br/>[memory.cpp]"]
end

subgraph group_sync["Synchronization"]
  node_mutex["Process Mutex<br/>[mutex.cpp]"]
end

subgraph group_filesystem["File System"]
  node_filesystem[("Inode File System<br/>[filesystem.cpp]")]
  node_fs_types["Inode and Blocks<br/>[fs_types.hpp]"]
end

node_user(("Operator"))

node_user -->|"enters commands"| node_cli
node_entry -->|"launches shell"| node_cli
node_cli -->|"dispatches commands"| node_system
node_system -->|"runs scheduler"| node_scheduler
node_system -->|"creates process"| node_pcb
node_system -->|"allocates process memory"| node_vm
node_scheduler -->|"updates process state"| node_pcb
node_system -->|"locks resource"| node_mutex
node_cli -->|"requests memory access"| node_vm
node_cli -->|"displays queues"| node_scheduler
node_cli -->|"displays memory map"| node_vm
node_vm -.->|"uses page tables"| node_page_structs
node_paging -.->|"uses page tables"| node_page_structs
node_physical_memory -.->|"backs memory frames"| node_vm
node_filesystem -->|"stores inode data"| node_fs_types

click node_entry "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/main.cpp"
click node_cli "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.cpp"
click node_system "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.hpp"
click node_pcb "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/scheduler/pcb.hpp"
click node_scheduler "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/scheduler/scheduler.cpp"
click node_mutex "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/core/mutex.cpp"
click node_vm "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/virtual_memory/virtual_memory.cpp"
click node_page_structs "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/virtual_memory/memory_types.hpp"
click node_paging "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/paging/paging.cpp"
click node_physical_memory "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/memory.cpp"
click node_filesystem "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/filesystem/filesystem.cpp"
click node_fs_types "https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/filesystem/fs_types.hpp"

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_entry,node_cli,node_system toneBlue
class node_pcb,node_scheduler toneAmber
class node_vm,node_page_structs,node_paging,node_physical_memory toneMint
class node_mutex toneRose
class node_filesystem,node_fs_types,node_user toneIndigo
```

## Components

### Shell and Control

- [Program Entry](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/main.cpp): `src/main.cpp`
- [Unified CLI](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.cpp): `src/cli/system.cpp`
- [System Controller](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/cli/system.hpp): `src/cli/system.hpp`

### Process Scheduling

- [Process Control Block](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/scheduler/pcb.hpp): `src/scheduler/pcb.hpp`
- [CPU Scheduler](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/scheduler/scheduler.cpp): `src/scheduler/scheduler.cpp`

### Memory Management

- [Virtual Memory Manager](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/virtual_memory/virtual_memory.cpp): `src/memory/virtual_memory/virtual_memory.cpp`
- [Page Structures](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/virtual_memory/memory_types.hpp): `src/memory/virtual_memory/memory_types.hpp`
- [Paging](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/paging/paging.cpp): `src/paging/paging.cpp`
- [Physical Memory](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/memory/memory.cpp): `src/memory/memory.cpp`

### Synchronization

- [Process Mutex](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/core/mutex.cpp): `src/core/mutex.cpp`

### File System

- [Inode File System](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/filesystem/filesystem.cpp): `src/filesystem/filesystem.cpp`
- [Inode and Blocks](https://github.com/jainul-mansuri/-kernel-lab-cpp/blob/main/src/filesystem/fs_types.hpp): `src/filesystem/fs_types.hpp`

### Other components

- **Operator**

## Connections

- Operator → Unified CLI: enters commands (evidence: `README.md`)
- Program Entry → Unified CLI: launches shell (evidence: `src/main.cpp`)
- Unified CLI → System Controller: dispatches commands (evidence: `src/cli/system.cpp`)
- System Controller → CPU Scheduler: runs scheduler
- System Controller → Process Control Block: creates process
- System Controller → Virtual Memory Manager: allocates process memory
- CPU Scheduler → Process Control Block: updates process state (evidence: `src/scheduler/scheduler.cpp`)
- System Controller → Process Mutex: locks resource
- Unified CLI → Virtual Memory Manager: requests memory access (evidence: `README.md`)
- Unified CLI → CPU Scheduler: displays queues (evidence: `src/cli/system.cpp`)
- Unified CLI → Virtual Memory Manager: displays memory map (evidence: `src/cli/system.cpp`)
- Virtual Memory Manager → Page Structures: uses page tables
- Paging → Page Structures: uses page tables
- Physical Memory → Virtual Memory Manager: backs memory frames
- Inode File System → Inode and Blocks: stores inode data (evidence: `src/filesystem/filesystem.cpp`)
