Skip to content

A dynamic memory management visualizer built with React +Vite and TailwindCSS. It simulates allocation strategies

Notifications You must be signed in to change notification settings

CodeByAshuu/DMMV

Repository files navigation

Dynamic Memory Management Visualizer (DynAlloc)

A modern, interactive web application for visualizing dynamic memory allocation algorithms built with React, Vite, and TailwindCSS. Perfect for students, educators, and professionals learning about operating system memory management concepts.

๐Ÿš€ Features

Memory Visualization

  • Real-time Memory Layout: Visual representation of memory blocks with color-coded states
  • Interactive Blocks: Click on allocated blocks to deallocate them instantly
  • Smooth Animations: Engaging transitions for allocation and deallocation operations
  • Responsive Design: Optimized for mobile, tablet, and desktop viewing

Algorithm Implementation

  • First Fit: Allocates the first available block that fits
  • Best Fit: Finds the smallest block that accommodates the request
  • Worst Fit: Uses the largest available block for allocation
  • Real-time Comparison: Switch between algorithms and see immediate differences

Advanced Analytics

  • Performance Metrics: Track memory utilization, fragmentation levels, and efficiency
  • Live Statistics: Real-time updates of memory usage and allocation patterns
  • Visual Progress Bars: Intuitive display of memory health and performance
  • Fragmentation Analysis: Detailed breakdown of memory waste and optimization opportunities

User Experience

  • Modern UI: Clean, professional interface with dark theme and gradient accents
  • Intuitive Controls: Simple forms for process management and memory operations
  • Error Handling: Clear feedback for invalid operations and helpful suggestions
  • Educational Tooltips: Built-in explanations of algorithm behaviors and performance tips

๐Ÿ› ๏ธ Technology Stack

  • Frontend: React 18 with functional components and hooks
  • Build Tool: Vite for fast development and optimized builds
  • Styling: TailwindCSS with custom components and animations
  • Routing: React Router for navigation between pages
  • Icons: Lucide React for consistent, modern iconography

๐Ÿ“ฆ Installation & Setup

Prerequisites

  • Node.js 16+
  • npm or yarn

Quick Start

  1. Clone the repository

    git clone https://github.com/CodeByAshuu/DMMV.git
    cd DMMV
  2. Install dependencies

     npm install react@^18.3.1 react-dom@^18.3.1 react-router-dom@^7.8.1 lucide-react@^0.344.0
    
     npm install --save-dev @vitejs/plugin-react@^4.3.1 vite@^5.4.2 tailwindcss@^3.4.1 postcss@^8.4.35 autoprefixer@^10.4.18 eslint@^9.9.1 @eslint/js@^9.9.1 eslint-plugin-react-hooks@^5.1.0-rc.0 eslint-plugin-react-refresh@^0.4.11 globals@^15.9.0 @types/react@^18.3.5 @types/react-dom@^18.3.0

    Or

    npm install
  3. Start development server

    npm run dev
  4. Open your browser Navigate to http://localhost:5173 to see the application

Build for Production

npm run build

The build files will be generated in the dist/ or build directory, ready for deployment.

๐ŸŽฏ How to Use

Getting Started

  1. Navigate to Visualizer: Click "Start Visualizing" on the home page or use the navbar
  2. Choose Algorithm: Select from First Fit, Best Fit, or Worst Fit in the algorithm selector
  3. Add Processes: Use the allocation form to create processes with specific memory requirements
  4. Watch Magic Happen: See real-time visualization of memory allocation
  5. Analyze Performance: Review statistics panel for insights into algorithm efficiency

Process Management

  • Allocate Memory: Enter process ID and memory size, then click "Allocate"
  • Deallocate Memory: Either use the deallocation form or click directly on allocated blocks
  • Monitor Statistics: Track fragmentation, utilization, and other key metrics
  • Reset Memory: Use the reset button to start fresh with a clean memory state

Understanding the Visualization

  • Blue Blocks: Available free memory
  • Green Blocks: Allocated memory with process ID
  • Orange Blocks: Fragmented memory (small unusable blocks)

๐Ÿ—๏ธ Project Structure

src/
โ”œโ”€โ”€ components/          # Reusable UI components
โ”‚   โ”œโ”€โ”€ Navbar.jsx      # Navigation component
โ”‚   โ”œโ”€โ”€ Footer.jsx      # Footer with social links
โ”‚   โ”œโ”€โ”€ MemoryBlock.jsx # Individual memory block visualization
โ”‚   โ”œโ”€โ”€ ProcessForm.jsx # Forms for allocation/deallocation
โ”‚   โ”œโ”€โ”€ MemoryStats.jsx # Statistics dashboard
โ”‚   โ””โ”€โ”€ AlgorithmSelector.jsx # Algorithm selection and info
โ”œโ”€โ”€ pages/              # Main application pages
โ”‚   โ”œโ”€โ”€ Home.jsx        # Landing page with features
โ”‚   โ””โ”€โ”€ Visualizer.jsx  # Main visualization interface
โ”œโ”€โ”€ utils/              # Core logic and algorithms
โ”‚   โ”œโ”€โ”€ memoryManager.js # Memory management class
โ”‚   โ””โ”€โ”€ algorithms.js   # Allocation algorithm implementations
โ”œโ”€โ”€ styles/
โ”‚   โ””โ”€โ”€ index.css       # Global styles and Tailwind imports
โ”œโ”€โ”€ App.jsx             # Main application component
โ””โ”€โ”€ main.jsx           # Application entry point

๐Ÿงฎ Algorithm Details

First Fit

  • Time Complexity: O(n)
  • Strategy: Allocates the first block that fits
  • Pros: Fast execution, simple implementation
  • Cons: Can cause fragmentation at memory start
  • Best For: Real-time systems requiring quick allocation

Best Fit

  • Time Complexity: O(n)
  • Strategy: Finds the smallest block that accommodates the request
  • Pros: Minimizes memory waste, good utilization
  • Cons: Can create many small unusable fragments
  • Best For: Memory-constrained systems with varied allocation sizes

Worst Fit

  • Time Complexity: O(n)
  • Strategy: Uses the largest available block
  • Pros: Leaves large blocks for future allocations
  • Cons: May waste memory, poorest utilization
  • Best For: Systems with predictable, similar-sized requests

๐Ÿš€ Deployment

GitHub Pages

  1. Update vite.config.js with your repository name
  2. Run npm run build
  3. Deploy the dist/ folder to GitHub Pages

Vercel

  1. Connect your GitHub repository to Vercel
  2. Set build command: npm run build
  3. Set output directory: dist
  4. Deploy automatically on push

Other Platforms

The application builds to static files and can be deployed on any static hosting service like Netlify, Firebase Hosting, or AWS S3.

๐ŸŽ“ Educational Use

This visualizer is perfect for:

  • Computer Science Students: Understanding memory management concepts
  • Operating Systems Courses: Interactive demonstrations of allocation algorithms
  • Technical Interviews: Explaining memory management strategies
  • Self-Learning: Exploring system-level programming concepts

๐Ÿค Contributing

I welcome contributions! Please feel free to:

  • Report bugs or suggest features via GitHub issues
  • Submit pull requests for improvements
  • Share the project with students and educators
  • Provide feedback on educational effectiveness

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • Built with love for the computer science education community
  • Inspired by the need for interactive learning tools in systems programming

Happy Learning! ๐ŸŽ‰

Made with โค๏ธ by the CodeByAshuu(Sagar)

About

A dynamic memory management visualizer built with React +Vite and TailwindCSS. It simulates allocation strategies

Topics

Resources

Stars

Watchers

Forks