This project is a client-side web simulation of the Shortest Remaining Time First (SRTF) CPU scheduling algorithm.
It demonstrates how SRTF behaves under a randomized workload of 100 processes, allowing users to visually observe scheduling decisions, preemption behavior, and performance metrics directly in the browser.
The application is implemented as a static website — all simulation logic runs locally using JavaScript with no backend or server-side computation.
Live Demo: https://willardcsoriano.github.io/SRTF-100Job-Stochastic-Analysis/
The simulator is designed for:
- Operating Systems coursework
- Algorithm visualization
- Scheduling behavior experimentation
- Educational demonstration of preemptive CPU scheduling
Rather than performing large-scale research analysis, the project focuses on interactive learning and visualization of scheduling mechanics.
Each simulation run generates:
- 100 randomized processes
- Arrival Time (AT):
1–7 - Burst Time (BT):
1–10 - Preemptive execution using SRTF rules
At every time step, the scheduler selects the process with the shortest remaining execution time, preempting the current job whenever a shorter task arrives.
Because parameters are randomized, every execution produces a unique scheduling timeline.
-
Randomized 100-process workload generation
-
Accurate SRTF preemptive scheduling logic
-
Automatic computation of:
- Completion Time (CT)
- Turnaround Time (TAT)
- Waiting Time (WT)
- Average Waiting & Turnaround Time
-
Interactive sortable results table
-
Dynamic Gantt Chart visualization
-
Built-in algorithm explanations
-
Fully client-side execution
-
Responsive dashboard-style interface
- Processes enter the ready queue once
Arrival Time ≤ current time. - The scheduler selects the job with the smallest remaining burst time.
- Execution advances in single time units.
- Incoming shorter jobs trigger preemption.
- CPU activity is recorded in a Gantt timeline.
- Final performance metrics are calculated after completion.
Clone the repository:
git clone https://github.com/willardcsoriano/SRTF-100Job-Stochastic-Analysis.git
cd SRTF-100Job-Stochastic-AnalysisOpen directly in a browser:
index.htmlOr run a lightweight local server:
python -m http.server 8000Then visit:
http://localhost:8000
-
Open the application.
-
Click Run 100-Job Simulation.
-
View:
- Generated process table
- Computed averages
- Execution Gantt chart
-
Run again to generate a new randomized workload.
- HTML5
- CSS3
- JavaScript (ES Modules)
- MathJax (formula rendering)
- GitHub Pages (deployment)
SRTF-100Job-Stochastic-Analysis/
│
├── index.html
├── favicon.ico
├── README.md
├── LICENSE
│
├── assets/
│ └── icons/
│
├── styles/
│ └── styles.css
│
├── scripts/
│ │ main.js # application entry point
│ │
│ ├── engine/ # scheduling logic (pure logic)
│ │ ├── srtf.js
│ │ └── metrics.js
│ │
│ ├── models/
│ │ └── Process.js
│ │
│ ├── ui/
│ │ │ domEvents.js
│ │ │
│ │ ├── renderers/ # output visualizers
│ │ │ ├── ganttRenderer.js
│ │ │ ├── summaryRenderer.js
│ │ │ └── tableRenderer.js
│ │ │
│ │ └── components/ # reusable UI sections
│ │ ├── hero.js
│ │ ├── overview.js
│ │ ├── legend.js
│ │ ├── controls.js
│ │ └── resultsPlaceholder.js
│
└── docs/
└── screenshots/
Licensed under the MIT License. See LICENSE for details.