🎓 CPU Scheduling Visualizer
An interactive educational tool to learn and compare CPU scheduling algorithms with beautiful visualizations and gamification elements.
Interactive Learning
Hands-on experience with drag-and-drop process management
Real-time Visualization
Watch algorithms execute with animated Gantt charts
Gamification
Achievements, scoring, and challenges to keep you engaged
Performance Metrics
Compare algorithms with detailed statistics
🔍 Algorithms Explained
FCFS (First Come First Serve)
Concept: Processes are executed in the order they arrive - simple but not optimal.
1. Sort processes by arrival time 2. Execute each process to completion 3. Move to next process in queue
Pros: Simple, fair, easy to implement
Cons: Can lead to convoy effect, longer average waiting time
SJF (Shortest Job First)
Concept: At each decision point, select the process with the shortest burst time - more efficient!
1. Sort processes by arrival time 2. At each time unit: - Add arrived processes to ready queue - Select process with shortest burst time - Execute to completion 3. Repeat until all processes complete
Pros: Minimizes average waiting time, optimal algorithm
Cons: Requires knowing burst time, can cause starvation
✨ Key Features
🎯 Interactive Process Management
- Add custom processes with ID, arrival time, and burst time
- Drag and drop to reorder processes
- Delete processes with one click
- Load example scenarios instantly
- Choose from 3 difficulty levels
📊 Visualization & Animation
- Side-by-side algorithm comparison
- Animated Gantt charts with color coding
- Real-time timeline updates
- Progress bar showing simulation status
- Particle effects on process completion
📈 Performance Metrics
- Completion Time (CT)
- Turnaround Time (TAT = CT - Arrival)
- Waiting Time (WT = TAT - Burst)
- Average TAT and WT
- Percentage improvement comparison
🎮 Gamification Elements
- Story mode with narrative
- Prediction challenges
- Interactive quizzes
- Scoring system
- Achievement badges
- Local leaderboard
🎨 UI/UX Features
- Beautiful gradient design
- Dark mode support
- Smooth animations
- Sound effects
- Mobile responsive
- Export results
🚀 How to Use
Launch the Application
Open index.html in your browser. The story mode modal will greet you!
Add Processes
Choose from three options:
- Manual: Enter Process ID, Arrival Time, and Burst Time
- Example: Click "Load Example" for a predefined scenario
- Level: Select Easy, Medium, or Hard difficulty
Make a Prediction
Before starting, predict which algorithm (FCFS or SJF) will have lower average waiting time. Correct predictions earn +10 points!
Run the Simulation
Click Start to begin. Use the controls:
- Pause/Resume: Control playback
- Speed Slider: Adjust animation speed
- Step Forward: Advance one time unit
Analyze Results
Review the metrics, comparison, and answer the quiz question for +5 bonus points!
💡 Example Scenarios
Scenario 1: SJF Advantage
| Process | Arrival Time | Burst Time |
|---|---|---|
| P1 | 0 | 8 |
| P2 | 1 | 4 |
| P3 | 2 | 2 |
| P4 | 3 | 1 |
Result: SJF significantly outperforms FCFS by executing shorter jobs first!
❓ Frequently Asked Questions
Q: Why can't I start the simulation?
A: You must make a prediction (click FCFS or SJF button) and have at least one process added before starting.
Q: How do I unlock achievements?
A: Complete 5 simulations for "Quick Learner", achieve avg WT < 5 for "Efficiency Expert", and show 50%+ improvement for "Time Saver".
Q: Can I use this for my course?
A: Absolutely! This tool is designed for educational purposes and is perfect for OS courses.
Q: Why doesn't SJF always win?
A: In rare cases with specific arrival patterns, FCFS might perform similarly. SJF is theoretically optimal for minimizing average waiting time.