A comprehensive CPU scheduling algorithm simulator with both Web GUI (React) and CLI interfaces. This project implements and visualizes multiple scheduling algorithms with interactive Gantt charts and automated metrics calculation.
- FCFS - First Come First Serve
- SJF - Shortest Job First (Non-preemptive)
- SRTF - Shortest Remaining Time First (Preemptive SJF)
- RR - Round Robin (configurable time quantum)
- Priority - Priority Scheduling (preemptive and non-preemptive)
- MLQ - Multi-Level Queue
- MLFQ - Multi-Level Feedback Queue
- π Interactive Gantt Charts - Visual timeline of process execution
- π Automated Metrics - Average waiting time, turnaround time, CPU utilization
- π Web GUI - Beautiful, responsive React-based interface
- π» CLI Interface - Command-line tool for automation and scripting
- βοΈ Configurable Parameters - Time quantum, priorities, queue levels
- π± Responsive Design - Works on desktop, tablet, and mobile
- Python 3.8 or higher
- Node.js 14 or higher
- npm or yarn
cd backend
pip install -r requirements.txtcd frontend
npm install- Start the Backend Server:
cd backend
python api.pyThe API server will start at http://localhost:5000
- Start the Frontend Development Server:
cd frontend
npm startThe web interface will open at http://localhost:3000
- Use the Interface:
- Add processes with their arrival time, burst time, priority, and queue level
- Select a scheduling algorithm
- Configure algorithm-specific parameters (time quantum, preemptive mode, etc.)
- Click "Run Simulation" to see the Gantt chart and metrics
Run simulations from the command line:
cd backend
python cli.py --algorithm <algorithm> --processes '<json_data>'FCFS:
python cli.py --algorithm fcfs --processes '[{"pid":1,"arrival_time":0,"burst_time":4},{"pid":2,"arrival_time":1,"burst_time":3}]'Round Robin with Time Quantum 3:
python cli.py --algorithm rr --time-quantum 3 --processes '[{"pid":1,"arrival_time":0,"burst_time":5},{"pid":2,"arrival_time":2,"burst_time":3}]'Priority Scheduling (Non-preemptive):
python cli.py --algorithm priority --processes '[{"pid":1,"arrival_time":0,"burst_time":4,"priority":2},{"pid":2,"arrival_time":1,"burst_time":3,"priority":1}]'Priority Scheduling (Preemptive):
python cli.py --algorithm priority --preemptive --processes '[{"pid":1,"arrival_time":0,"burst_time":4,"priority":2},{"pid":2,"arrival_time":1,"burst_time":3,"priority":1}]'Using a JSON file:
python cli.py --algorithm sjf --file processes.jsonMLFQ with custom time quantums:
python cli.py --algorithm mlfq --time-quantums "[2,4,8]" --processes '[{"pid":1,"arrival_time":0,"burst_time":10}]'The simulator automatically calculates:
- Average Waiting Time - Average time processes wait in ready queue
- Average Turnaround Time - Average time from arrival to completion
- CPU Utilization - Percentage of time CPU is actively executing processes
- Individual Process Metrics - Waiting time, turnaround time, response time per process
Multi-Algorithm-Scheduler-Simulator/
βββ backend/
β βββ scheduler.py # Core scheduling algorithms implementation
β βββ api.py # Flask REST API server
β βββ cli.py # Command-line interface
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ public/
β β βββ index.html # HTML template
β βββ src/
β β βββ components/ # React components
β β β βββ GanttChart.js
β β β βββ Metrics.js
β β β βββ ProcessInput.js
β β βββ utils/ # Utility functions
β β β βββ api.js
β β βββ styles/ # CSS stylesheets
β β β βββ App.css
β β βββ App.js # Main React component
β β βββ index.js # React entry point
β βββ package.json # Node.js dependencies
βββ README.md # This file
- Non-preemptive vs Preemptive scheduling
- Context switching
- Process states and transitions
- Scheduling criteria (CPU utilization, throughput, waiting time, etc.)
- Process Control Block (PCB)
- Ready queues
- Multi-level queues
- Priority queues
- Discrete event simulation
- Gantt chart generation
- Performance metrics calculation
Adjustable via GUI slider or --time-quantum CLI flag. Default: 2
Lower numbers indicate higher priority. Range: 0-β
Queue 0 = highest priority. Configure time quantums per queue.
The web interface features:
- Clean, modern design with gradient backgrounds
- Interactive process input forms
- Real-time Gantt chart visualization
- Color-coded process blocks
- Metric cards with key performance indicators
This is an educational project. Feel free to:
- Add more scheduling algorithms
- Improve the UI/UX
- Add more metrics
- Enhance visualizations
- Add unit tests
This project is for educational purposes as part of an Operating Systems course.
OS Project - Multi-Algorithm Scheduler Simulator
- Operating Systems concepts and algorithms
- React and Flask frameworks
- CPU scheduling theory and implementation