Skip to content

naithick/sjf-cpu-scheduling-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฏ SJF CPU Scheduling Visualizer

An interactive web application for learning and visualizing the Shortest Job First (SJF) CPU Scheduling Algorithm

[![Live Demo](https://img.shield---

๐Ÿ“ Project Structureo### Perfect For:


๐Ÿ“– Table of Contentsduling Visualizer

An interactive web application for learning and visualizing the Shortest Job First (SJF) CPU Scheduling Algorithm

[Live Demo](https://sjf-cpu-scheduling-visualizer.vercel## ๐Ÿ†˜ Support

Found a bug? Have a suggestion?


๏ฟฝ Table of Contents


๐ŸŒŸ Overview

This project is an educational tool designed to help students and educators understand CPU scheduling algorithms, specifically comparing SJF (Shortest Job First) with FCFS (First Come First Serve).

Why This Project?

  • ๐Ÿ“Š Visual Learning: See algorithms execute step-by-step
  • ๐Ÿ”„ Side-by-Side Comparison: Understand why SJF is more efficient
  • ๐ŸŽฎ Interactive: Make predictions and test your knowledge
  • ๐Ÿ“ฑ Modern UI: Beautiful gradient design with dark mode
  • ๐ŸŽ“ Educational: Perfect for OS coursework and presentations

โœจ Features

๐ŸŽฌ Dual Animation Modes

  • Standard Mode: Quick side-by-side visualization
  • Real-Time Mode: Step-by-step execution with detailed logging

๐Ÿ“Š Visual Elements

  • โœ… Gantt Chart Visualization: See process execution timeline
  • โœ… Process Queue Display: Real-time ready queue status
  • โœ… Flowchart Diagram: Algorithm decision-making flow
  • โœ… Performance Metrics: Average Wait Time, Turnaround Time, CPU Utilization
  • โœ… Dynamic Animations: Spinning gear on executing process, glowing timeline marker

๐ŸŽฎ Interactive Learning

  • ๐Ÿ“ Quiz System: 3 questions to test your understanding
  • ๐ŸŽฏ Prediction Game: Guess which algorithm performs better
  • ๐Ÿ“š 4 Example Scenarios: From basic to complex cases
  • ๐Ÿ’ก Algorithm Insights: Educational tips and best practices

๐ŸŽจ Modern Design

  • ๐ŸŒˆ Gradient UI: Purple-pink theme with glassmorphism
  • ๐ŸŒ™ Dark Mode: Eye-friendly dark theme toggle
  • ๐Ÿ“ฑ Responsive: Works on desktop, tablet, and mobile
  • โšก Smooth Animations: 60fps performance with particle effects

๐Ÿ“– Documentation

  • ๐Ÿ“„ Built-in Docs Page: Comprehensive guide accessible via "Docs" button
  • ๐Ÿ“Š Performance Dashboard: Real-time analytics and charts
  • ๐Ÿ”Š Sound Effects: Audio feedback for interactions (optional)

๐Ÿš€ Live Demo

๐Ÿ‘‰ Try it now!

Experience the interactive visualizer with:

  • โœจ Side-by-side FCFS vs SJF comparison
  • ๐ŸŽฌ Real-time step-by-step animation
  • ๐Ÿ“ Interactive quiz system
  • ๐ŸŒ™ Beautiful dark mode
  • ๐Ÿ“Š Performance analytics dashboard

๐Ÿ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • No installation or build process required!

Installation

  1. Clone the repository

    git clone https://github.com/NAITHICK/sjf-cpu-scheduling-visualizer.git
    cd sjf-cpu-scheduling-visualizer
  2. Open in browser

    # Option 1: Double-click index.html
    
    # Option 2: Use Python server
    python -m http.server 8000
    # Then open http://localhost:8000
    
    # Option 3: Use Node.js server
    npx http-server -p 8000
    # Then open http://localhost:8000
  3. Start learning!

    • No dependencies to install
    • No build process needed
    • Just open and use!

๐Ÿ“š How to Use

Quick Start (3 Steps)

  1. Load an Example

    • Click one of the 4 example buttons (Basic, SJF Advantage, etc.)
    • Or manually add processes with arrival time and burst time
  2. Choose Animation Mode

    • Standard: Fast comparison of both algorithms
    • Real-Time: Slow step-by-step execution with logging
  3. Start Simulation

    • Make a prediction (optional)
    • Click "Start Simulation"
    • Watch the magic happen!

Advanced Features

Adding Custom Processes

Process Name: P1
Arrival Time: 0 (when process arrives)
Burst Time: 5 (CPU time needed)

Understanding the Output

  • Gantt Chart: Visual timeline of process execution
  • Metrics Table: Wait Time, Turnaround Time for each process
  • Averages: Compare FCFS vs SJF efficiency
  • Improvement: See how much better SJF performs

Quiz System

  • Complete a simulation to unlock quiz
  • Answer 3 multiple-choice questions
  • Get instant feedback with explanations
  • Track your score!

๐Ÿ› ๏ธ Technologies

Core

  • HTML5: Semantic structure
  • CSS3: Modern styling with custom properties
  • JavaScript (ES6+): Vanilla JS, no frameworks

APIs & Features

  • Canvas API: Charts and particle effects
  • Web Audio API: Sound effects
  • LocalStorage: Save preferences and scores
  • CSS Animations: 60fps smooth transitions

Design

  • Font: Inter (Google Fonts)
  • Icons: Font Awesome 6
  • Colors: Purple-Pink gradient theme
  • Effects: Glassmorphism, backdrop-filter, box-shadows

๏ฟฝ Project Structure

sjf-visualizer/
โ”‚
โ”œโ”€โ”€ index.html          # Main application page
โ”œโ”€โ”€ docs.html           # Documentation page
โ”œโ”€โ”€ style.css           # Main stylesheet
โ”œโ”€โ”€ docs-style.css      # Documentation styles
โ”œโ”€โ”€ script.js           # Core application logic
โ”œโ”€โ”€ vercel.json         # Deployment configuration
โ””โ”€โ”€ README.md           # This file

Key Files

File Purpose Lines
index.html Main UI with all sections ~210
script.js SJF/FCFS algorithms, animations, quiz ~1100
style.css Modern gradient design, dark mode ~1480
docs.html Comprehensive documentation ~200

๐ŸŽ“ Educational Use

Perfect For:

  • ๐Ÿ“˜ Operating Systems Courses: Visualize CPU scheduling
  • ๏ฟฝโ€๐Ÿซ Teachers: Demonstrate algorithm efficiency
  • ๐Ÿ‘จโ€๐ŸŽ“ Students: Study for exams with interactive learning
  • ๐Ÿ“Š Presentations: Concept map visualization
  • ๐Ÿ’ป Self-Learning: Understand scheduling algorithms

Learning Outcomes:

  1. Understand how SJF and FCFS algorithms work
  2. Compare algorithm efficiency with real examples
  3. Calculate Wait Time and Turnaround Time
  4. Recognize when SJF outperforms FCFS
  5. Learn about non-preemptive scheduling

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Ideas for Contributions:

  • Add more scheduling algorithms (Round Robin, Priority)
  • Add more quiz questions
  • Improve mobile responsiveness
  • Add multi-language support
  • Create video tutorials

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

You are free to:

  • โœ… Use for personal learning
  • โœ… Use for educational purposes
  • โœ… Modify and distribute
  • โœ… Use commercially

๐Ÿ‘จโ€๐Ÿ’ป Author

Created for Operating Systems Coursework


๐Ÿ™ Acknowledgments

  • Operating Systems concepts from textbooks and courses
  • Inspiration from various CPU scheduling visualizers
  • Modern UI design trends and best practices
  • Open-source community for tools and resources

๐Ÿ“ž Support

Found a bug? Have a suggestion?


Made with โค๏ธ for Computer Science Education

โฌ† Back to Top

Releases

No releases published

Packages

No packages published