GitHunt
WI

willardcsoriano/SRTF-Manual-5Job-Trace

An interactive web tool for simulating and manually verifying the Shortest Remaining Time First (SRTF) CPU scheduling algorithm with dynamic Gantt chart visualization and computed performance metrics.

SRTF Manual Trace (5 Jobs)

Live Demo
Status
License

A clean, interactive web tool designed to simulate and manually verify the Shortest-Remaining-Time-First (SRTF) CPU scheduling algorithm.
This project is built with a fully modular ES-module architecture, making the core logic, UI rendering, and app flow maintainable and scalable.


๐ŸŒ Live Demo

๐Ÿ‘‰ Try it here:

๐Ÿ”— https://willardcsoriano.github.io/SRTF-Manual-5Job-Trace/

Runs entirely in the browser โ€” no install needed.


๐ŸŽฏ Purpose

This tool was created for Modeling and Simulation Theory โ€“ ASS2.1 (Manual SRTF) to help students:

  • Understand preemptive shortest-job scheduling
  • Validate manual SRTF computations
  • Observe real-time CPU timeline execution
  • Analyze turnaround and waiting times

๐Ÿš€ Features

โœ” Full SRTF Scheduling Simulation

  • Preemptive shortest remaining time
  • Automatically detects and handles preemptions
  • CPU timeline updates dynamically

โœ” Rich Visualization

  • Gantt chart with color-coded process segments
  • Process Input Table (AT, BT)
  • Final Metrics Table (AT, BT, CT, TAT, WT)
  • Sortable columns
  • Average WT and TAT summary

โœ” Modular Architecture (ES Modules)


js/
โ”œโ”€โ”€ app.js        # Main controller
โ”œโ”€โ”€ core/         # Pure scheduling logic
โ”‚    โ”œโ”€โ”€ process.js
โ”‚    โ”œโ”€โ”€ utils.js
โ”‚    โ”œโ”€โ”€ srtf.js
โ”‚    โ””โ”€โ”€ metrics.js
โ””โ”€โ”€ ui/           # Rendering components
โ”œโ”€โ”€ inputTable.js
โ”œโ”€โ”€ metricsTable.js
โ”œโ”€โ”€ gantt.js
โ””โ”€โ”€ sort.js

โœ” Modern UI/UX

  • TailwindCSS styling
  • Responsive layout
  • MathJax for algorithm notation

๐Ÿง  Algorithm Explanation: SRTF

SRTF (Shortest Remaining Time First) is a preemptive version of SJF.

Key Principle

At any time t, the CPU selects the process with the smallest remaining burst time.

When Preemption Happens

If a new process arrives with a burst time shorter than the remaining time of the currently running process:


if BT_new < remaining_time_current:
preempt current
run new process

Performance Metrics

For each process P:


Turnaround Time (TAT) = Completion Time - Arrival Time
Waiting Time (WT) = TAT - Burst Time

This tool computes all metrics automatically.


๐Ÿ“ธ Screenshots (Preview)

image

Input & Instructions Section

image

Gantt Chart

image

Final Metrics Table

image

๐Ÿ› ๏ธ Setup for Local Development

Because this project uses ES Modules, you must run it from a local server.

  1. Open folder in VS Code
  2. Right-click index.html โ†’ Open with Live Server

Option 2 โ€” Python

python -m http.server 3000

Visit:

http://localhost:3000/

Option 3 โ€” Node http-server

npm install -g http-server
http-server .

๐Ÿ“‚ Folder Structure

SRTF-Manual-5Job-Trace/
โ”‚ index.html
โ”‚ favicon.png
โ”‚ styles.css
โ”‚ README.md
โ”‚
โ””โ”€โ”€ js/
    โ”œโ”€โ”€ app.js
    โ”œโ”€โ”€ core/
    โ”‚    process.js
    โ”‚    utils.js
    โ”‚    srtf.js
    โ”‚    metrics.js
    โ”‚
    โ””โ”€โ”€ ui/
         inputTable.js
         metricsTable.js
         gantt.js
         sort.js

๐Ÿงช How to Use

  1. Open the Live Demo (or run locally)

  2. Click Run Simulation & Generate Trace

  3. View:

    • Input Process Table
    • Gantt Chart
    • Final Metrics Table
    • Average WT & TAT

Arrival times are randomized for each session to encourage manual re-validation.


๐Ÿค Contributing

Contributions are welcome! You can help by:

  • Improving UI/UX
  • Adding new scheduling algorithms (FCFS, RR, Priority, etc.)
  • Adding export options (CSV, PDF, PNG)
  • Improving visualizations
  • Adding unit tests for srtf.js

๐Ÿ“„ License

This project is for educational use.
You may reuse parts for your own coursework or teaching.