A comprehensive, interactive web application that simulates and visualizes various CPU scheduling algorithms with real-time Gantt charts and performance metrics.
This project implements five fundamental CPU scheduling algorithms with an intuitive web interface, featuring a professional video background and comprehensive visualization tools. Perfect for students, educators, and professionals studying operating systems concepts.
- FCFS (First-Come, First-Served) - Non-preemptive scheduling based on arrival time
- SJF (Shortest Job First) - Non-preemptive scheduling prioritizing shortest burst time
- SRTF (Shortest Remaining Time First) - Preemptive version of SJF
- Round Robin (RR) - Time-quantum based preemptive scheduling
- Priority Scheduling (Preemptive) - Priority-based preemptive scheduling
- Interactive Gantt Charts - Visual timeline of process execution
- Real-time Performance Metrics - Average turnaround time and waiting time
- Dynamic Form Inputs - Context-aware input fields based on selected algorithm
- Professional Video Background - Full-screen looping animation
- Responsive Design - Works seamlessly on desktop, tablet, and mobile
- Dark Theme - Professional dark interface with excellent contrast
- Color-coded Gantt Charts - Each process has a unique color
- Process Timeline - Visual representation of execution order
- Performance Summary - Statistical analysis of algorithm efficiency
- Process Management Table - Easy addition and removal of processes
- Frontend Framework: Next.js 14 with React 18
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI primitives
- Icons: Lucide React
- Build Tool: Next.js built-in bundler
- Node.js 18 or higher
- npm or pnpm package manager
-
Clone the repository
git clone https://github.com/gagan771/OS.git cd OS -
Install dependencies
npm install # or pnpm install -
Run the development server
npm run dev # or pnpm dev -
Open your browser Navigate to http://localhost:3000
npm run build
npm start- Select your desired algorithm from the dropdown
- Fill in process details:
- Process ID: Unique identifier (e.g., P1, P2)
- Arrival Time: When the process arrives in the system
- Burst Time: CPU execution time required
- Priority: Only for Priority Scheduling (lower number = higher priority)
- Click "Add Process" to add to the simulation
- Round Robin: Set the time quantum (default: 2)
- Priority Scheduling: Assign priority values (1 = highest priority)
- Click "Run Simulation" to execute the selected algorithm
- View the Gantt chart showing process execution timeline
- Analyze performance metrics in the results table
- Completion Time: When each process finishes execution
- Turnaround Time: Total time from arrival to completion
- Waiting Time: Time spent waiting in the ready queue
- Average Metrics: Overall algorithm performance
Characteristics:
โ
Simple implementation
โ
Fair scheduling
โ Convoy effect with long processes
โ Poor average waiting time
Characteristics:
โ
Minimizes average waiting time
โ
Optimal for non-preemptive scheduling
โ Starvation of long processes
โ Requires knowledge of burst times
Characteristics:
โ
Optimal average waiting time
โ
Preemptive nature prevents convoy effect
โ Higher context switching overhead
โ Starvation possible
Characteristics:
โ
Fair time sharing
โ
No starvation
โ
Good response time
โ Higher turnaround time for short processes
Characteristics:
โ
Allows importance-based scheduling
โ
Suitable for real-time systems
โ Starvation of low-priority processes
โ Priority inversion possible
Process | Arrival Time | Burst Time | Priority
P1 | 0 | 6 | 2
P2 | 1 | 8 | 1
P3 | 2 | 7 | 3
P4 | 3 | 3 | 2
Process | Completion | Turnaround | Waiting
P1 | 6 | 6 | 0
P2 | 14 | 13 | 5
P3 | 21 | 19 | 12
P4 | 24 | 21 | 18
Average Turnaround Time: 14.75
Average Waiting Time: 8.75
OS/
โโโ app/
โ โโโ globals.css # Global styles
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Main application
โโโ components/
โ โโโ ui/ # Reusable UI components
โ โโโ theme-provider.tsx # Theme configuration
โโโ lib/
โ โโโ utils.ts # Utility functions
โโโ public/ # Static assets
โโโ styles/ # Additional styles
- Algorithm Implementations: Five scheduling algorithms with comprehensive logic
- UI Components: Form inputs, tables, charts, and buttons
- State Management: React hooks for process management and results
- Validation: Input validation and error handling
The project includes comprehensive test suites:
# Run production test suite
node production-test-suite.js
# Run specific algorithm tests
node test-priority-scheduling.js
node test-rr-fix.js- โ 80+ Test Cases across all algorithms
- โ Edge Case Testing (single process, concurrent arrivals, time gaps)
- โ Mathematical Validation (formulas, calculations)
- โ Gantt Chart Integrity (no overlaps, correct timing)
- โ Input Validation (boundary conditions)
- โ Chrome 60+
- โ Firefox 55+
- โ Safari 12+
- โ Edge 79+
Modify the PROCESS_COLORS array in page.tsx:
const PROCESS_COLORS = [
"#3b82f6", "#ef4444", "#10b981", // Add your colors
]Replace the video URL in the video element:
<source src="your-video-url.mp4" type="video/mp4" />Adjust default values:
const [timeQuantum, setTimeQuantum] = useState<number>(2) // Round Robin
const [algorithm, setAlgorithm] = useState<Algorithm>("FCFS") // Default algorithmThis simulator is perfect for:
- Operating Systems Courses - Visual learning of CPU scheduling
- Algorithm Analysis - Comparing performance metrics
- Research Projects - Baseline implementation for extensions
- Self-Study - Interactive learning experience
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Maintain test coverage for new features
- Update documentation for algorithm changes
- Ensure responsive design compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
Gagan - @gagan771
- Pexels for the professional video background
- Radix UI for accessible component primitives
- Tailwind CSS for utility-first styling
- Lucide for beautiful icons
- Operating Systems community for algorithm specifications
- Load Time: < 2 seconds on standard connections
- Bundle Size: Optimized for production deployment
- Memory Usage: Efficient algorithm implementations
- Responsiveness: 60fps animations and interactions
- Multi-level Queue Scheduling
- Multi-level Feedback Queue
- Real-time scheduling algorithms
- Process synchronization visualization
- Export results to PDF/CSV
- Algorithm comparison mode
- Interactive tutorial mode
โญ Star this repository if it helped you learn CPU scheduling algorithms! โญ
Demo โข Documentation โข Issues โข Discussions