Memory Allocation Visualizer
Author: Sanidhya Bhandari Course Project: Operating Systems โ Dynamic Memory Allocation (DA1) Mode: Offline, Browser-Based Visualization
๐ Overview
The Memory Allocation Visualizer is an interactive, browser-based tool designed to simulate and visualize memory allocation algorithms โ First Fit, Best Fit, and Worst Fit โ side-by-side under a unified global control system.
It helps learners understand how memory blocks are allocated to processes dynamically, with animated visualizations, real-time comparison, and intuitive UI controls โ all in a dark-themed modern interface.
The project runs entirely offline (no dependencies or servers required).
๐ Features ๐ฌ Real-Time Animation
Smooth visual representation of block allocation and fragmentation.
Stepwise or automated animation modes for better conceptual clarity.
๐งฉ Algorithm Comparison
Displays First Fit, Best Fit, and Worst Fit simultaneously.
Uses a unified control panel to run, pause, or step all algorithms in sync.
Enables learners to visually compare efficiency and fragmentation in one view.
๐งฑ Interactive Input
Add or remove memory blocks and processes dynamically.
Adjustable animation speed and reset functionality for experimentation.
๐ธ Export Visualization
Capture and download a labeled PNG snapshot showing the three algorithmsโ final states side by side.
๐ก Educational Focus
Built to enhance understanding of memory partitioning and allocation strategies in Operating Systems.
Clean, modular JavaScript architecture with comprehensive comments for learning and reuse.
โ๏ธ How to Run Locally 1๏ธโฃ Setup
Download or unzip the provided source package.
Open the folder and locate index.html.
Double-click index.html to open in your preferred browser (Chrome, Edge, or Firefox).
No internet or installation required.
2๏ธโฃ Input Data
In the Memory Blocks section, enter sizes (in KB) one at a time and click Add Block.
In the Processes section, enter process sizes and click Add Process.
Example input:
Blocks: 100, 500, 200, 300, 600 Processes: 212, 417, 112
3๏ธโฃ Run Simulation
Click Run All Fits to instantly compute and visualize allocations.
Use:
โธ๏ธ Pause โ Stop ongoing animation.
โฉ Step Forward โ Move one allocation step manually.
โช Step Backward โ Undo last allocation.
๐ Reset โ Clear all data and start over.
๐ผ๏ธ Export PNG โ Save final visualization as an image.
๐งฎ Algorithms Implemented ๐น First Fit
Allocates the first available memory block that is large enough for the process.
๐น Best Fit
Finds the smallest available block that fits the process, minimizing wasted space.
๐น Worst Fit
Allocates the largest available block to maximize leftover space for future processes.
Each algorithm operates independently through isolated state managers, ensuring accurate side-by-side comparison.
๐จ Visualization Details Element Meaning ๐ฉ Colored Block Allocated memory block (color-coded per process ID) โซ Dark Block Free/unallocated block ๐งพ Label Format Process โ Block (Size) ๐ Canvas Layout Three synchronized views: First Fit, Best Fit, Worst Fit
Color Coding: Each process is assigned a unique color dynamically for clear differentiation.
Animation Logic: Blocks fill from left to right, visually representing the allocation step progression.
๐งฐ File Structure memory-visualizer/ โ โโโ index.html # Main application UI โโโ style.css # Dark theme and layout styling โ โโโ js/ โ โโโ utils.js # Shared helper utilities โ โโโ algorithms.js # Core allocation logic (First/Best/Worst Fit) โ โโโ animation.js # Rendering and canvas-based animation logic โ โโโ ui.js # User interface event binding and DOM rendering โ โโโ app.js # Main controller connecting UI, logic, and animation โ โโโ README.md # Project documentation (this file) โโโ Execution_Guide.md # Setup & usage documentation
๐ Browser Compatibility
Browser Minimum Version Tested
Google Chrome 90+ โ
Microsoft Edge 90+ โ
Mozilla Firefox 88+ โ
Safari 15+
โ Recommended: Google Chrome (latest) for best performance and animation smoothness.
๐งญ Learning Outcomes
Understand dynamic memory allocation strategies.
Observe internal fragmentation and allocation efficiency.
Analyze the trade-offs between allocation methods interactively.
Gain hands-on experience in modular JS architecture and canvas-based visualization.
๐ท Example Demonstration Input: Memory Blocks: 100, 500, 200, 300, 600 Processes: 212, 417, 112,426
Expected Visualization:
Each algorithm successfully allocates processes into different block arrangements.
โRun All Fitsโ instantly generates a three-column visual comparison.
The PNG Export will display all three labeled panels (First, Best, Worst Fit) in one image.
๐งโ๐ป Developer Notes
Developed and tested by Sanidhya Bhandari, VIT Vellore.
Designed for educational and demonstration purposes under Operating Systems - Dynamic Allocation.
Modular, maintainable, and compatible with modern browsers.