CPU Chronicles

CPU Scheduling Algorithm Visualization

Overview

CPU Chronicles is an interactive, web-based tool designed to simulate and visualize various CPU scheduling algorithms. It allows users to input custom processes with specific attributes — such as arrival time and burst time — and observe how those processes are scheduled based on the selected algorithm. The primary goal is to provide an educational platform that aids in understanding the intricacies of CPU scheduling in operating systems.

Key Objectives

  • Educational Tool : Facilitate learning by providing a hands-on experience with CPU scheduling algorithms.
  • Visualization : Offer real-time visual representations of process scheduling to enhance comprehension.
  • User Interaction : Allow users to customize process parameters (arrival time, burst time, etc.) and observe outcomes dynamically.

Supported Scheduling Algorithms

  1. First Come First Serve (FCFS): Processes are scheduled in the order they arrive.
  2. Shortest Job First (SJF): Processes with the shortest burst time are scheduled first.
  3. Round Robin (RR): Each process is assigned a fixed time slot in a cyclic order.
  4. Shortest Remaining Time First (SRTF): Preemptive version of SJF; the process with the shortest remaining time is scheduled next.

Technologies

Features

  • Interactive Process Input: A dynamic form allows users to add or remove processes with real-time validation, making it easy to test different scheduling scenarios quickly.
Interactive Process Input Form
Users can input multiple processes with different parameters like arrival and burst times.
  • Algorithm Selection: Choose between FCFS, SJF, RR, or SRTF. Selecting an algorithm instantly updates the simulation, offering quick comparisons.
Algorithm Selection Dropdown
Users can switch between different scheduling algorithms using a simple dropdown menu.
  • Real-Time Visualization: The Gantt chart updates live as you add or remove processes, with color-coded bars for easy interpretation. Works seamlessly on all screen sizes.
Gantt Chart Visualization
Color-coded Gantt chart updates in real-time to reflect current scheduling state.
  • Performance Metrics: Calculates average waiting time, turnaround time, and response time. Results are compared across algorithms to identify performance trade-offs.
Performance Metrics
Metrics section showing calculated averages and comparisons.

Development and Challenges

The development of the CPU Chronicles involved several phases, each presenting unique challenges:

  • Algorithm Implementation: Complex logic handling for SRTF preemption, real-time time progression, and accurate state synchronization.
  • User Interface Design: Dynamic forms for process input, responsive Gantt chart layout, and dark/light theme toggling.
  • State Management: Synchronizing global state (process list, selected algorithm) across components using Context API.
  • Performance Optimization: Debouncing inputs and minimizing re-renders to ensure smooth visualization even with many processes.
  • Accessibility and UX: Keyboard navigation for forms, screen-reader friendly labels, and seamless theme transitions.

Conclusion

The CPU Chronicles serves as a valuable educational tool, bridging the gap between theoretical concepts and practical understanding of CPU scheduling algorithms. By providing an interactive platform with real-time visualization and performance metrics, it enhances the learning experience for students and enthusiasts in the field of operating systems.