# mo2hefny/process_scheduler architecture

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

- Interactive diagram: https://gitdiagram.com/mo2hefny/process_scheduler
- Repository: https://github.com/mo2hefny/process_scheduler

## Overview

Process Scheduler simulates multiprocessor scheduling from a user-selected input file, advances processes through scheduling and I/O states, and writes process and processor statistics. The principal workflow is input loading → timestep simulation → statistics/output, with UI monitoring alongside execution. Scheduling algorithms, process state, and queue/container implementations form the main internal layers. The README documents simulation stages and capabilities; sampled source confirms the entry point, UI interactions, and core data structures, but not every scheduler-to-processor call.

Main entry points: [`Scheduler/Scheduler.cpp`](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp) (Scheduler), [`Processors/Processor.cpp`](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Processor.cpp) (Processor base), [`UI/UI.cpp`](https://github.com/mo2hefny/process_scheduler/blob/master/UI/UI.cpp) (Simulation UI), [`Data Structures/Queue/LinkedQueue.h`](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/LinkedQueue.h) (Linked queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_entry["Program entry<br/>[main.cpp]"]
  node_interface["Simulation UI<br/>[UI.cpp]"]
end

subgraph group_simulation["Simulation domain"]
  node_scheduler["Scheduler<br/>[Scheduler.cpp]"]
  node_input["Input loading<br/>[Scheduler.cpp]"]
  node_timestep["Timestep simulation<br/>[Scheduler.cpp]"]
  node_transitions["Process transitions<br/>[Scheduler.cpp]"]
  node_migration["Migration and stealing<br/>[Scheduler.cpp]"]
  node_statistics["Statistics and output<br/>[Scheduler.cpp]"]
  node_process["Process state<br/>[Process.cpp]"]
end

subgraph group_algorithms["Scheduling algorithms"]
  node_processor["Processor base<br/>[Processor.cpp]"]
  node_fcfs["FCFS scheduling"]
  node_sjf["SJF scheduling"]
  node_rr["Round Robin<br/>[Round_Robin.cpp]"]
  node_edf["Deadline scheduling"]
end

subgraph group_structures["Data structures"]
  node_definitions["Domain definitions<br/>[DEFS.h]"]
  node_linkedlist["Linked list<br/>[LinkedList.h]"]
  node_node["Linked node<br/>[Node.h]"]
  node_linkedqueue["Linked queue<br/>[LinkedQueue.h]"]
  node_priorityqueue["Priority queue<br/>[PriorityQueue.h]"]
  node_queueadt["Queue interface<br/>[QueueADT.h]"]
  node_arraystack["Array stack<br/>[ArrayStack.h]"]
  node_stackadt["Stack interface<br/>[StackADT.h]"]
end

node_user(("User"))

node_user -->|"starts"| node_entry
node_entry -->|"creates"| node_scheduler
node_scheduler -->|"loads input"| node_input
node_input -->|"provides processes"| node_timestep
node_timestep -->|"advances states"| node_transitions
node_timestep -->|"handles migration"| node_migration
node_timestep -->|"collects results"| node_statistics
node_scheduler -.->|"creates UI"| node_interface
node_interface -->|"reads simulation"| node_scheduler
node_scheduler -.->|"manages processes"| node_process
node_scheduler -.->|"uses processors"| node_processor
node_processor -->|"specialized by"| node_fcfs
node_processor -->|"specialized by"| node_sjf
node_processor -->|"specialized by"| node_rr
node_processor -->|"specialized by"| node_edf
node_scheduler -->|"writes output"| node_statistics
node_interface -->|"prints lists"| node_linkedqueue
node_interface -->|"prints ready queues"| node_priorityqueue
node_linkedlist -->|"links nodes"| node_node
node_linkedqueue -->|"links nodes"| node_node
node_priorityqueue -->|"uses nodes"| node_node
node_linkedqueue -->|"implements"| node_queueadt
node_arraystack -->|"implements"| node_stackadt
node_process -->|"uses process data"| node_definitions

click node_entry "https://github.com/mo2hefny/process_scheduler/blob/master/main.cpp"
click node_interface "https://github.com/mo2hefny/process_scheduler/blob/master/UI/UI.cpp"
click node_scheduler "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_input "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_timestep "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_transitions "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_migration "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_statistics "https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp"
click node_process "https://github.com/mo2hefny/process_scheduler/blob/master/Process/Process.cpp"
click node_processor "https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Processor.cpp"
click node_fcfs "https://github.com/mo2hefny/process_scheduler/blob/master/Processors/First_Come_First_Serve.cpp"
click node_sjf "https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Shortest_Job_First.cpp"
click node_rr "https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Round_Robin.cpp"
click node_edf "https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Earliest_Deadline_First.cpp"
click node_definitions "https://github.com/mo2hefny/process_scheduler/blob/master/DEFS.h"
click node_linkedlist "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Linked%20List/LinkedList.h"
click node_node "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Node.h"
click node_linkedqueue "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/LinkedQueue.h"
click node_priorityqueue "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/PriorityQueue.h"
click node_queueadt "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/QueueADT.h"
click node_arraystack "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Stack/ArrayStack.h"
click node_stackadt "https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Stack/StackADT.h"

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_interface,node_user toneBlue
class node_scheduler,node_input,node_timestep,node_transitions,node_migration,node_statistics,node_process toneAmber
class node_processor,node_fcfs,node_sjf,node_rr,node_edf toneMint
class node_definitions,node_linkedlist,node_node,node_linkedqueue,node_priorityqueue,node_queueadt,node_arraystack,node_stackadt toneRose
```

## Components

### Application flow

- [Program entry](https://github.com/mo2hefny/process_scheduler/blob/master/main.cpp): `main.cpp`
- [Simulation UI](https://github.com/mo2hefny/process_scheduler/blob/master/UI/UI.cpp): `UI/UI.cpp`

### Simulation domain

- [Scheduler](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Input loading](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Timestep simulation](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Process transitions](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Migration and stealing](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Statistics and output](https://github.com/mo2hefny/process_scheduler/blob/master/Scheduler/Scheduler.cpp): `Scheduler/Scheduler.cpp`
- [Process state](https://github.com/mo2hefny/process_scheduler/blob/master/Process/Process.cpp): `Process/Process.cpp`

### Scheduling algorithms

- [Processor base](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Processor.cpp): `Processors/Processor.cpp`
- [FCFS scheduling](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/First_Come_First_Serve.cpp): `Processors/First_Come_First_Serve.cpp`
- [SJF scheduling](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Shortest_Job_First.cpp): `Processors/Shortest_Job_First.cpp`
- [Round Robin](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Round_Robin.cpp): `Processors/Round_Robin.cpp`
- [Deadline scheduling](https://github.com/mo2hefny/process_scheduler/blob/master/Processors/Earliest_Deadline_First.cpp): `Processors/Earliest_Deadline_First.cpp`

### Data structures

- [Domain definitions](https://github.com/mo2hefny/process_scheduler/blob/master/DEFS.h): `DEFS.h`
- [Linked list](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Linked%20List/LinkedList.h): `Data Structures/Linked List/LinkedList.h`
- [Linked node](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Node.h): `Data Structures/Node.h`
- [Linked queue](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/LinkedQueue.h): `Data Structures/Queue/LinkedQueue.h`
- [Priority queue](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/PriorityQueue.h): `Data Structures/Queue/PriorityQueue.h`
- [Queue interface](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Queue/QueueADT.h): `Data Structures/Queue/QueueADT.h`
- [Array stack](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Stack/ArrayStack.h): `Data Structures/Stack/ArrayStack.h`
- [Stack interface](https://github.com/mo2hefny/process_scheduler/blob/master/Data%20Structures/Stack/StackADT.h): `Data Structures/Stack/StackADT.h`

### Other components

- **User**

## Connections

- User → Program entry: starts (evidence: `main.cpp`)
- Program entry → Scheduler: creates (evidence: `main.cpp`)
- Scheduler → Input loading: loads input (evidence: `README.md`)
- Input loading → Timestep simulation: provides processes (evidence: `README.md`)
- Timestep simulation → Process transitions: advances states (evidence: `README.md`)
- Timestep simulation → Migration and stealing: handles migration (evidence: `README.md`)
- Timestep simulation → Statistics and output: collects results (evidence: `README.md`)
- Scheduler → Simulation UI: creates UI
- Simulation UI → Scheduler: reads simulation (evidence: `UI/UI.cpp`)
- Scheduler → Process state: manages processes
- Scheduler → Processor base: uses processors
- Processor base → FCFS scheduling: specialized by
- Processor base → SJF scheduling: specialized by
- Processor base → Round Robin: specialized by
- Processor base → Deadline scheduling: specialized by
- Scheduler → Statistics and output: writes output (evidence: `README.md`)
- Simulation UI → Linked queue: prints lists (evidence: `UI/UI.cpp`)
- Simulation UI → Priority queue: prints ready queues (evidence: `UI/UI.cpp`)
- Linked list → Linked node: links nodes (evidence: `Data Structures/Linked List/LinkedList.h`)
- Linked queue → Linked node: links nodes (evidence: `Data Structures/Queue/LinkedQueue.h`)
- Priority queue → Linked node: uses nodes (evidence: `Data Structures/Queue/PriorityQueue.h`)
- Linked queue → Queue interface: implements (evidence: `Data Structures/Queue/LinkedQueue.h`)
- Array stack → Stack interface: implements (evidence: `Data Structures/Stack/ArrayStack.h`)
- Process state → Domain definitions: uses process data
