Skip to content

sani3055/Memory-Allocation-Visualizer-OS-Project-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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:

โ–ถ๏ธ Play โ€” Run global animation for all algorithms.

โธ๏ธ 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+ โš ๏ธ Partial Support

โœ… 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors