Skip to content

CastTheBuzz/Disk-Scheduling-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Disk Scheduling Algorithms Simulator

📌 Overview

This project is a Disk Scheduling Algorithms Simulator implemented in Python.
It demonstrates and compares different disk scheduling algorithms used in operating systems to optimize disk head movement and reduce seek time.

The simulator calculates the service order of disk requests, computes the total seek distance, and visualizes the head movement using graphs.

This project is intended for educational purposes, particularly for Operating Systems courses.


📂 Project Structure

Implementation/ │ ├── algorithms/ │ ├── fcfs.py │ ├── sstf.py │ ├── scan.py │ ├── cscan.py │ ├── look.py │ └── clook.py │ ├── utils/ │ ├── graph.py │ ├── plot.py │ └── seek_distance.py │ ├── main.py └── README.md


⚙️ Implemented Algorithms

1. FCFS (First Come First Serve)

  • Services requests in arrival order.
  • Simple and fair.
  • Can result in high total seek time.

2. SSTF (Shortest Seek Time First)

  • Selects the request closest to the current head position.
  • Reduces total seek time.
  • May cause starvation.

3. SCAN (Elevator Algorithm)

  • Moves in one direction servicing requests.
  • Reverses direction at the end of the disk.

4. C-SCAN (Circular SCAN)

  • Moves in one direction only.
  • Jumps back to the beginning after reaching the end.

5. LOOK

  • Similar to SCAN.
  • Travels only as far as the last request instead of the disk boundary.

6. C-LOOK

  • Circular version of LOOK.
  • Jumps from the last request directly to the first request.

🧮 Seek Distance Calculation

Total seek distance is calculated using:

| current_position - next_position |

The total seek time is the sum of all individual head movements.

Implemented in: utils/seek_distance.py


📊 Visualization

The simulator provides graphical visualization of disk head movement:

  • X-axis: Order of execution
  • Y-axis: Track positions
  • Displays total head movement visually

Visualization modules: utils/graph.py
utils/plot.py


▶️ How to Run

  1. Clone the repository:

git clone
cd Implementation

  1. Install required dependencies:

pip install matplotlib

  1. Run the program:

python main.py


🛠 Requirements

  • Python 3.x
  • matplotlib

📌 Example Input

Initial Head Position: 50
Disk Size: 200
Request Queue: 95, 180, 34, 119, 11, 123, 62, 64

The program will output:

  • Service order
  • Total seek distance
  • Graphical visualization

🎯 Purpose

This project helps in understanding:

  • Disk scheduling techniques
  • Seek time optimization
  • Algorithm efficiency comparison
  • Trade-offs between fairness and performance

🚀 Future Improvements

  • Graphical User Interface (GUI)
  • Real-time animation
  • Algorithm comparison table
  • Export results to CSV
  • Performance benchmarking

👨‍💻 Author

Developed for Operating Systems coursework.


📜 License

This project is intended for educational purposes only.

About

An implementation to visualize multiple disk scheduling algorithms for comparison

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages