Skip to content

AnuragSingh2jz/cpu_schedular_OS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 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! 📊

About

made for learning purpose

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors