Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ CPU Scheduling Simulator & Performance Analyzer

License: MIT Node.js HTML5 CSS3 JavaScript

A modern, interactive, and responsive web application designed for operating systems analysis. Simulate, visualize, and compare CPU scheduling algorithms with interactive Gantt timelines, calculated performance metrics, and dynamic mathematical verdicts.

Created by: Joel & Hiyailen


📸 Application Screenshots

🏆 Side-by-Side Algorithm Comparison & Performance Verdict

Algorithm Comparison & Performance Verdict

📊 FCFS (First-Come, First-Served) Scheduling View

FCFS View

⚡ SJF (Shortest Job First / Preemptive SRTF) Scheduling View

SJF View

🎯 Priority Scheduling View

Priority View

🔄 Round Robin (RR) Scheduling View

Round Robin View


🌟 Key Features

  • 🚀 Supported Algorithms:
    • FCFS (First-Come, First-Served) — Non-preemptive scheduling order.
    • SJF (Shortest Job First) — Non-preemptive or Preemptive SRTF (Shortest Remaining Time First).
    • Priority Scheduling — Non-preemptive (default) & Preemptive modes with customizable priority ranking (Lower number = Higher priority, or vice versa).
    • Round Robin (RR) — Preemptive scheduling with a customizable Time Quantum ($Q$).
  • 📊 Interactive Execution Timeline (Gantt Chart):
    • Color-coded process blocks with staggered spring entrance animations.
    • Precise hover tooltips displaying start/end execution times and total duration.
    • CPU Idle state visualization with striped patterns.
  • 📈 Comprehensive Process Metrics:
    • Calculates Completion Time (CT), Turnaround Time (TAT), Waiting Time (WT), and Response Time (RT) per process.
    • Animated statistics cards for Average WT, Average TAT, Average RT, and CPU Utilization %.
  • 🏆 Side-by-Side Algorithm Comparison & Verdict Engine:
    • Runs all four algorithms on the exact same process dataset simultaneously.
    • Side-by-side metric comparison tiles featuring BEST performance highlight badges.
    • Dynamic Performance Verdict: Automatically generates plain-English analysis identifying which algorithm mathematically performed best for the given workload.
    • Chart.js Visual Analytics: Bar charts comparing Average WT, TAT, and RT across all algorithms.
  • 💡 Built-in Workload Presets:
    • Sample Default Batch
    • Convoy Effect (FCFS CPU-bound lag demonstration)
    • SRTF Advantage (Demonstration of preemptive shortest job efficiency)
    • Priority Starvation (Demonstrates priority queue lag)
    • Equal Arrival Times
  • 🎨 Monochromatic Modern Design:
    • High-contrast typography featuring Space Grotesk, Inter, and JetBrains Mono.
    • Fully responsive grid layout for desktop, laptop, and mobile screens.

⚙️ Mathematical Formulas

The simulator executes exact calculations based on standard Operating System principles:

$$\text{Turnaround Time (TAT)} = \text{Completion Time (CT)} - \text{Arrival Time (AT)}$$

$$\text{Waiting Time (WT)} = \text{Turnaround Time (TAT)} - \text{Burst Time (BT)}$$

$$\text{Response Time (RT)} = \text{First CPU Execution Time} - \text{Arrival Time (AT)}$$

$$\text{CPU Utilization (%)} = \left( \frac{\text{Total Busy CPU Time}}{\text{Total Execution Time}} \right) \times 100$$

$$\text{Average Metric} = \frac{\sum_{i=1}^{n} \text{Metric}_i}{n}$$


📂 Project Structure

OS Lab/
├── assets/             # Application UI screenshots
│   ├── fcfs-view.png
│   ├── sjf-view.png
│   ├── priority-view.png
│   ├── rr-view.png
│   └── comparison-verdict.png
├── index.html          # Main HTML structure, layout, and tabs
├── styles.css          # Monochromatic styling, CSS grid, and animations
├── server.js           # Lightweight Node.js static HTTP file server
├── package.json        # Project metadata and start scripts
└── js/
    ├── scheduler.js    # Core OS scheduling logic & metric calculator
    ├── charts.js       # Gantt chart renderer & Chart.js integration
    └── app.js          # App controller, event handlers, and animation logic

🛠️ Quick Start & Installation

Prerequisites

Make sure you have Node.js (v14 or higher) installed on your system.

Installation Steps

  1. Clone the Repository:

    git clone https://github.com/your-username/cpu-scheduling-simulator.git
    cd cpu-scheduling-simulator
  2. Run the Application: Start the built-in lightweight Node server:

    node server.js

    or using npm script:

    npm start
  3. Open in Browser: Navigate to http://localhost:8080/ in your web browser.


🤝 Authors & Credits

Developed with ❤️ for Operating Systems Lab by:

  • Joel
  • Hiyailen

📜 License

This project is licensed under the MIT License.

About

A modern web application to simulate and compare OS CPU scheduling algorithms (FCFS, SJF/SRTF, Priority, RR). Features interactive Gantt charts, CT/TAT/WT/RT metrics, Chart.js visual analytics, and dynamic mathematical verdicts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages