Skip to content

Latest commit

Β 

History

History
310 lines (229 loc) Β· 6.29 KB

File metadata and controls

310 lines (229 loc) Β· 6.29 KB

πŸŽ“ CPU Scheduling Visualization App

A full-stack web application for visualizing and analyzing CPU scheduling algorithms with real-time calculations and interactive Gantt charts.

Status: βœ… PRODUCTION READY | Real Data Only | Fully Documented


πŸš€ Quick Start

Run the Application

Double-click: run-software.bat

Opens: http://localhost:5173


πŸ“ Project Structure

cpu-scheduling-visualization/
β”‚

β”œβ”€β”€ frontend/                       (React Application)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ main.tsx
β”‚   β”‚   └── index.css
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   └── index.html
β”‚
β”œβ”€β”€ backend/                        (Express API)
β”‚   └── scheduler-api/
β”‚       β”œβ”€β”€ server.js
β”‚       β”œβ”€β”€ fcfs_json.exe
β”‚       β”œβ”€β”€ sjf_json.exe
β”‚       β”œβ”€β”€ rr_json.exe
β”‚       β”œβ”€β”€ priority_json.exe
β”‚       β”œβ”€β”€ fcfs.c
β”‚       β”œβ”€β”€ sjf.c
β”‚       β”œβ”€β”€ rr.c
β”‚       β”œβ”€β”€ priority.c
β”‚       └── package.json
β”‚
β”œβ”€β”€ run-software.bat                (Run the application)
β”œβ”€β”€ push-to-github.bat              (Push to GitHub)
β”œβ”€β”€ .gitignore
└── README.md                       (This file)

✨ Features

πŸ”„ Scheduling Algorithms

  • FCFS (First Come First Served)
  • SJF (Shortest Job First)
  • Round Robin (with configurable time quantum)
  • Priority Scheduling

πŸ“Š Visualization

  • Interactive Gantt Charts
  • Real-time Process Metrics
  • Waiting Time & Turnaround Time Calculations
  • Dark/Light Mode Support

πŸ’Ύ Export Options

  • Export Results as JSON
  • Export Results as CSV

🎨 User Interface

  • Modern, Responsive Design
  • Intuitive Process Input Form
  • Real-time Error Messages
  • Loading States

πŸ—οΈ Architecture

Frontend (Port 5173)          Backend (Port 3000)          C Algorithms
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  React + TS     │──POST────>β”‚  Express.js      │─spawn─>β”‚  C Programs  β”‚
β”‚  Vite           β”‚<──JSON────│  Node.js         β”‚<─JSON──│  (.exe)      β”‚
β”‚  Tailwind CSS   β”‚           β”‚                  β”‚         β”‚              β”‚
β”‚  Recharts       β”‚           β”‚  /fcfs           β”‚         β”‚  fcfs_json   β”‚
β”‚  Radix UI       β”‚           β”‚  /sjf            β”‚         β”‚  sjf_json    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚  /rr             β”‚         β”‚  rr_json     β”‚
                              β”‚  /priority       β”‚         β”‚  priority_json
                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ API Endpoints

All endpoints accept POST requests with JSON bodies.

FCFS Scheduling

POST http://localhost:3000/fcfs

SJF Scheduling

POST http://localhost:3000/sjf

Round Robin Scheduling

POST http://localhost:3000/rr

Priority Scheduling

POST http://localhost:3000/priority

πŸ› οΈ Technology Stack

Frontend

  • React 18.3.1
  • TypeScript
  • Vite 6.3.5
  • Tailwind CSS
  • Recharts (charting)
  • Radix UI (components)
  • Lucide React (icons)

Backend

  • Express.js 5.1.0
  • Node.js
  • C (scheduling algorithms)

πŸ“¦ Installation

Prerequisites

  • Node.js v16 or higher
  • npm or yarn
  • Windows OS (for .exe executables)
  • Git (for version control)

Setup

1. Install Backend Dependencies

cd backend/scheduler-api
npm install

2. Install Frontend Dependencies

cd frontend
npm install

πŸš€ Running the Application

Automated (Recommended)

Double-click: run-software.bat

Manual Start

Terminal 1 - Backend:

cd backend/scheduler-api
npm start

Terminal 2 - Frontend:

cd frontend
npm run dev

Then open: http://localhost:5173


πŸ“Š Usage Example

Step 1: Add Processes

  1. Enter Process ID: 1
  2. Enter Arrival Time: 0
  3. Enter Burst Time: 5
  4. Click "Add Process"

Step 2: Select Algorithm

  • Choose: FCFS

Step 3: Run Algorithm

  • Click "Run Algorithm"

Step 4: View Results

  • See Gantt Chart
  • View Process Metrics
  • Check Waiting/Turnaround Times

πŸ”’ Security

  • βœ… CORS properly configured
  • βœ… Input validation on backend
  • βœ… Error messages don't expose system details
  • βœ… Process isolation for C programs
  • βœ… No hardcoded credentials

πŸ› Troubleshooting

Backend won't start

  • Ensure C executables (.exe files) exist
  • Check that port 3000 is not in use
  • Verify Node.js is installed: node --version

Frontend won't connect to backend

  • Ensure backend is running on port 3000
  • Check browser console (F12) for CORS errors
  • Verify firewall isn't blocking localhost

Dependencies not installing

npm cache clean --force
rm -r node_modules package-lock.json
npm install

πŸš€ GitHub Deployment

Push to GitHub

Double-click: push-to-github.bat

Or manually:

git remote add origin https://github.com/YOUR-USERNAME/cpu-scheduling-visualization.git
git push -u origin master

See README.md for details.


βœ… Verification Checklist

  • Frontend running on port 5173
  • Backend running on port 3000
  • CORS enabled
  • All mock data removed
  • Real C algorithm execution
  • Error handling in place
  • Documentation complete
  • Ready for production

πŸŽ‰ Status

βœ… PRODUCTION READY

  • All features working
  • Real data only (no mock data)
  • Comprehensive documentation
  • Ready for deployment
  • Ready for collaboration

πŸ“ž Quick Links


πŸ“ License

This project is provided as-is for educational purposes.


Version: 1.0
Last Updated: November 11, 2025
Status: βœ… Production Ready


Happy Scheduling! πŸ“Š