Disk_Scheduling_Algorithm

# πŸ’½ Disk Scheduling Simulator & OS Storage Architecture Lab ### *A Next-Generation Interactive Operating Systems Simulator & Hardware Physics Suite* [![GitHub stars](https://img.shields.io/github/stars/Priya-Ranjan-0201/Disk_Scheduling_Algorithm?style=for-the-badge&color=ffd700)](https://github.com/Priya-Ranjan-0201/Disk_Scheduling_Algorithm/stargazers) [![GitHub forks](https://img.shields.io/github/forks/Priya-Ranjan-0201/Disk_Scheduling_Algorithm?style=for-the-badge&color=6366f1)](https://github.com/Priya-Ranjan-0201/Disk_Scheduling_Algorithm/network/members) [![License: MIT](https://img.shields.io/badge/License-MIT-10b981?style=for-the-badge)](https://opensource.org/licenses/MIT) [![Pure Vanilla JS](https://img.shields.io/badge/Built%20With-Vanilla%20JS%20%7C%20HTML5%20%7C%20CSS3-f97316?style=for-the-badge)](#) [![Zero Dependencies](https://img.shields.io/badge/Dependencies-Zero%20(No%20npm%20needed)-06b6d4?style=for-the-badge)](#)
**[⚑ Live Demo](http://localhost:8000/project.html)** β€’ **[πŸ“– Documentation](#-complete-feature-matrix)** β€’ **[🧠 Algorithms](#-supported-scheduling-algorithms)** β€’ **[⏱️ Hardware Physics](#-hardware-drive-physics--latency-equations)** β€’ **[πŸ‘¨β€πŸ’» Developed By](#-developed--maintained-by)**

🌌 Overview

The Disk Scheduling Simulator & OS Storage Architecture Lab is an interactive, browser-based computer science laboratory designed to visualize, benchmark, and teach Operating System Storage Subsystems.

Bridging the gap between classical theoretical algorithms and real-world storage hardware, it simulates both Mechanical Magnetic Hard Disk Drives (HDDs) (with rotating platters and actuator arm kinematics) and NAND Flash NVMe Solid State Drives (SSDs) (with uniform zero-seek Flash Translation Layer controllers).

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚                         SIMULATOR ARCHITECTURE                          β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚ πŸŽ›οΈ CONFIG & SPECS β”‚     πŸ–₯️ MULTI-VIEW ENGINE      β”‚  πŸ“Š LIVE TELEMETRY  β”‚
  β”‚ β€’ 11 Schedulers   β”‚  β€’ 🎯 1D Linear Physical Track β”‚  β€’ Total Seek Cyl   β”‚
  β”‚ β€’ Direction Toggleβ”‚  β€’ πŸ“ˆ 2D Trajectory Seek Graphβ”‚  β€’ Seek Latency ms  β”‚
  β”‚ β€’ Drive RPM (5.4k-β”‚  β€’ πŸ’½ Concentric 2D Platter   β”‚  β€’ Rotational Delay β”‚
  β”‚   15k RPM)        β”‚  β€’ πŸ’½ 3D Cylinder Multi-Stack β”‚  β€’ Access Time ms   β”‚
  β”‚ β€’ HDD vs. SSD Modeβ”‚  β€’ ⚑ NVMe SSD NAND Die Grid  β”‚  β€’ Head Reversals   β”‚
  β”‚ β€’ Preset Workloadsβ”‚  β€’ 🐧 Linux Kernel Multi-Queueβ”‚  β€’ Live Progress    β”‚
  β”‚ β€’ Live I/O Stream β”‚  β€’ πŸ’» In-Browser JS Sandbox   β”‚  β€’ Step Math Proof  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌟 Complete Feature Matrix

πŸŽ›οΈ 1. Eleven Scheduling & Linux Kernel Algorithms


πŸ–₯️ 2. Seven Interactive Multi-Dimensional Visualizers

Mode Name Visual Experience & Physical Details
🎯 1D Linear Track High-DPI physical track with glowing magnetic head pointer (H), color-coded request nodes, seek arcs, and interactive tooltips.
πŸ“ˆ 2D Seek Graph OS textbook-style coordinate chart plotting Time Steps ($Y$-axis, top-to-bottom) vs. Cylinder Number ($X$-axis, left-to-right).
πŸ’½ Concentric 2D Platter Kinetic rotating magnetic platter ($0 \to \text{Max}$) with a mechanical actuator arm pivoting its read/write head tip over tracks.
πŸ’½ 3D Cylinder Stack Isometric stack of 3 platters (6 surfaces: Head 0 to Head 5) with a synchronized multi-head actuator comb demonstrating CHS addressing.
⚑ NVMe SSD Flash Array 4-channel, 16-die NAND Flash cell array demonstrating Flash Translation Layer (FTL) wear-leveling and zero mechanical seek penalty.
🐧 Linux Kernel Lab Real-time multi-queue visualization showing Read FIFO, Write FIFO, and Sorted Dispatcher queues.
πŸ’» In-Browser JS Sandbox Integrated Monaco-style JavaScript code editor allowing students to write, execute, and test their own custom scheduling algorithms.

⚑ 3. Storage Hardware Architecture: Mechanical HDD vs. NVMe SSD

Toggle between πŸ’½ Mechanical HDD and ⚑ NVMe SSD with one click:


πŸ“ 4. CHS ↔ LBA Translation Calculator

Built-in live mathematical translator converting between Cylinder-Head-Sector (CHS) and Logical Block Addressing (LBA): \(\text{LBA} = (C \times \text{HeadsPerCyl} + H) \times \text{SectorsPerTrack} + (S - 1)\)


🎞️ 5. Interactive Drag-to-Scrub Timeline & Voice Narration


πŸŽ“ 6. Gamified OS Exam Quiz Arena


πŸ“„ 7. Homework Solution & Data Export Suite


πŸŒ“ 8. Dual Theme Engine


🧠 Supported Scheduling Algorithms Comparison

Algorithm Type Time Complexity Starvation Risk Directional Best Use Case
FCFS Classical $\mathcal{O}(N)$ None (100% Fair) No Light, sequential workloads
SSTF Classical $\mathcal{O}(N^2)$ High (Boundary Starvation) No Batch workloads with clustered requests
SCAN Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) High-load shared HDD servers
C-SCAN Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) Systems requiring uniform wait times
LOOK Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) General-purpose desktop HDDs
C-LOOK Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) High-throughput server workloads
F-SCAN Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) High dynamic arrival environments
N-Step SCAN Classical $\mathcal{O}(N \log N)$ None Yes (β†— / ↙) Systems prone to arm stickiness
Linux Deadline Linux Kernel $\mathcal{O}(N \log N)$ Guaranteed None Yes Real-time & database servers (MySQL)
Linux CFQ Linux Kernel $\mathcal{O}(P \times N)$ None Round-Robin Multi-user & desktop Linux systems
Linux NOOP Linux Kernel $\mathcal{O}(N)$ None No NVMe SSDs, Flash, & Virtual Disks

⏱️ Hardware Drive Physics & Latency Equations

Disk access time is calculated using the official Operating Systems physics formulation:

\[\text{Total Access Time } (T_{\text{access}}) = T_{\text{seek}} + T_{\text{rotational}} + T_{\text{transfer}}\]

1. Seek Time ($T_{\text{seek}}$)

The time required for the mechanical actuator arm to position the read/write head over the desired cylinder track: \(T_{\text{seek}} = T_{\text{startup}} + (\Delta C \times \text{Seek Rate})\)

2. Average Rotational Latency ($T_{\text{rotational}}$)

The average time for the requested disk sector to rotate under the read/write head (equivalent to half a rotation): \(T_{\text{rotational}} = \frac{1}{2} \times \left(\frac{60}{\text{RPM}}\right) \times 1000\text{ ms}\)

Spindle Speed (RPM) Category Average Rotational Delay
5,400 RPM Laptop / Power-Saving HDD 5.56 ms
7,200 RPM Desktop Standard HDD 4.17 ms
10,000 RPM VelociRaptor High-Performance 3.00 ms
15,000 RPM Enterprise SAS / Server HDD 2.00 ms

⌨️ Keyboard Shortcuts

Shortcut Action
Space Play / Pause animation playback
← Previous Step (Step backward)
β†’ Next Step (Step forward)
Home Jump to Start (Initial head position)
End Jump to End (Complete simulation)
R Reset simulation state
T Toggle Theme (Dark Obsidian ⇄ Light Academic)
V Toggle AI Voice Narration
Canvas Click Inject I/O Request at clicked cylinder/sector

πŸš€ How to Run Locally

Because the project is built with Pure Vanilla Web Technologies, zero build tools or npm package installations are required.

Method 1: Local HTTP Server (Python)

python -m http.server 8000

Open http://localhost:8000/project.html in your browser.

Method 2: Direct File Open

Double click project.html directly in any modern web browser.


πŸ‘¨β€πŸ’» Developed & Maintained By

### **PRIYA RANJAN** *Full-Stack Engineer & Systems Architecture Enthusiast* [![GitHub](https://img.shields.io/badge/GitHub-Priya--Ranjan--0201-181717?style=for-the-badge&logo=github)](https://github.com/Priya-Ranjan-0201) [![Repository](https://img.shields.io/badge/Repository-Disk__Scheduling__Algorithm-6366f1?style=for-the-badge&logo=git)](https://github.com/Priya-Ranjan-0201/Disk_Scheduling_Algorithm)
**Crafted with ❀️ and precision for Operating Systems education and computer engineering students worldwide.**

πŸ“œ License

This project is licensed under the MIT License β€” see the LICENSE file for full details.


⭐ If you find this project helpful for your Operating Systems studies or coursework, please consider starring the repository!