This project implements and visualizes various disk scheduling algorithms using the analogy of elevators in a building. The primary algorithms include FCFS, SSTF, SCAN, LOOK, and their circular versions. By treating each request as a floor in a building, we demonstrate how these scheduling algorithms optimize the movement of the elevator (or disk head) to minimize the total distance traveled and improve efficiency.
Elevator algorithms help us understand how disk scheduling works in operating systems. This project simplifies these concepts by using a relatable analogy: elevators in a building. The project simulates how different scheduling algorithms like FCFS, SSTF, SCAN, LOOK, and their circular counterparts behave in an elevator system when servicing requests for different floors.
The elevator handles requests in the exact order they arrive, leading to potential inefficiencies if requests are far apart.
The elevator moves to the nearest floor requested from its current position, optimizing for minimal travel distance between stops.
The elevator moves in one direction, servicing requests, and then reverses direction once it hits the end of its range, ensuring that all requests are handled.
An optimized version of SCAN, where the elevator moves in one direction but only goes as far as the furthest request, avoiding unnecessary movement to the building's limits.
Similar to SCAN, but after reaching the highest requested floor, the elevator jumps back to the start (lowest floor) and continues in the same direction.
An optimized circular version of LOOK, where the elevator moves in one direction, services all requests, and jumps back to the first requested floor without traveling to extremes.
The total number of floors traveled by the elevator while servicing all requests.
The average number of floors between requests, provides an efficiency metric for each algorithm.
-
Clone the repository:
git clone https://github.com/devroopsaha744/Elevate.git cd Elevate
-
Analyze the Algorithms:
- Navigate to the
analysis
folder to explore detailed analysis of the algorithms. - Open
analysis/analysis.ipynb
using Jupyter Notebook to examine the code and visualizations of various metrics like total distance traveled and average seek time.
- Navigate to the
-
View Plots:
- Inside the
analysis/plots
folder, you'll find visual representations of how each algorithm performs, helping you understand their efficiency in terms of distance and time.
- Inside the
-
Explore Algorithm Logic:
- The
logic
folder contains the code for each scheduling algorithm. This is where you can dive into how FCFS, SSTF, SCAN, LOOK, and their variations are implemented.
- The
-
Watch Simulations:
- In the
animations
folder, you'll find simulation videos demonstrating how the elevator moves according to each algorithm, offering a visual representation of the algorithms in action.
- In the
-
Manim Visualizations:
- The
visualization
folder contains the Manim code used to generate the elevator scheduling animations. You can run the Manim scripts to create custom visualizations or tweak them according to your needs.
- The
For a deeper understanding of these algorithms and their real-world implications, check out my Medium article:
From Disks to Elevators: Applying Scheduling Algorithms for Optimal Movement
Contributions are welcome! Please submit a pull request or open an issue if you'd like to improve the project or add new features.
This project is licensed under the MIT License - see the LICENSE file for details.