Skip to content

CalmaCodes/Resource-Allocation-Graph-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšฆ Resource Allocation Graph Visualizer

An interactive Operating Systems project that demonstrates how processes and resources interact using a Resource Allocation Graph (RAG). The application visually simulates resource requests, allocations, deadlock detection, circular wait conditions, and recovery strategies in real time.


๐ŸŒ Live Demo

๐Ÿ”— Hosted Application: https://os-rag.vercel.app/


๐Ÿ“ธ Screenshots

Main Interface

Safe Scenario Preset

Deadlock Scenario Preset


๐Ÿ“Œ Project Overview

In modern operating systems, multiple processes compete for limited resources such as:

  • Memory Blocks
  • Files
  • Printers
  • I/O Devices
  • Semaphores
  • CPU Resources

Improper allocation of these resources can lead to Deadlock, where processes wait indefinitely and system progress stops.

This project was built to make these theoretical concepts easier to understand through an interactive visual simulator.


๐ŸŽฏ Objectives

  • Visualize process-resource interaction using graphs
  • Simulate resource requests and allocations dynamically
  • Detect deadlocks automatically
  • Highlight circular wait conditions
  • Demonstrate deadlock handling strategies
  • Provide an educational learning tool for OS students

๐Ÿง  Core Concepts Implemented

Resource Allocation Graph (RAG)

The graph contains two types of nodes:

  • ๐Ÿ”ต Process Nodes โ†’ Circular nodes
  • ๐ŸŸฆ Resource Nodes โ†’ Square nodes

Edge Types

  • Process โ†’ Resource = Request Edge
  • Resource โ†’ Process = Allocation Edge

Deadlock Condition

If a circular dependency exists in the graph, the system automatically detects a Deadlock State.


โœจ Features

๐ŸŽฎ Interactive Simulation

  • Add Processes dynamically
  • Add Resources dynamically
  • Drag nodes freely across canvas
  • Real-time graph rendering

๐Ÿ”— Connection Builder

  • Create Request Edges
  • Create Allocation Edges
  • Arrowhead directional flow

๐Ÿšจ Deadlock Detection

  • Automatic cycle detection
  • Culprit edges highlighted in red
  • Involved nodes glow red
  • Status panel updates instantly

๐ŸŽญ Scenario Presets

  • โœ… Safe Scenario
  • โŒ Deadlock Scenario

๐Ÿ“Š Analytics Dashboard

  • Total Processes
  • Total Resources
  • Total Edges
  • Current System State

๐Ÿ›  Recovery Strategies

Displays theoretical deadlock recovery approaches:

  • Process Termination
  • Resource Preemption
  • Rollback
  • Circular Wait Removal

๐Ÿ“ Utility Features

  • Live Logs
  • Reset Simulation
  • Responsive Premium UI

๐Ÿงฐ Tech Stack

  • React.js
  • Vite
  • Tailwind CSS
  • JavaScript
  • Framer Motion

๐Ÿ“ Project Structure

src/
 โ”ฃ components/
 โ”ƒ โ”ฃ LeftPanel.jsx
 โ”ƒ โ”ฃ RightPanel.jsx
 โ”ƒ โ”— GraphCanvas.jsx
 โ”ฃ utils/
 โ”ƒ โ”— deadlock.js
 โ”ฃ App.jsx
 โ”— main.jsx

โš™๏ธ How Deadlock Detection Works

The application internally models all nodes and edges as a directed graph.

Algorithm Flow

  1. Build adjacency list
  2. Traverse graph using DFS (Depth First Search)
  3. If a back-edge / cycle is found โ†’ Deadlock exists
  4. Highlight involved nodes and edges
  5. Update system status panel

๐Ÿ–ฅ Demo Workflow

โœ… Safe Scenario

  • No circular dependency exists
  • System remains safe
  • Resources can continue allocation

โŒ Deadlock Scenario

  • Processes wait for each other's resources
  • Circular wait occurs
  • Deadlock detected instantly

๐Ÿš€ Run Locally

git clone https://github.com/CalmaCodes/Resource-Allocation-Graph-Visualizer.git
cd Resource-Allocation-Graph-Visualizer
npm install
npm run dev

๐Ÿ”ฎ Future Enhancements

  • Bankerโ€™s Algorithm module
  • Resource instance counts
  • Export / Import scenarios for reproducibility
  • Step-by-step simulation mode
  • Process scheduling integration
  • Multi-user collaboration mode

๐Ÿ“š Educational Value

This project helps students understand:

  • Mutual Exclusion
  • Hold and Wait
  • No Preemption
  • Circular Wait
  • Deadlock Prevention
  • Deadlock Avoidance
  • Deadlock Detection
  • Deadlock Recovery

๐Ÿ‘ฅ Team Members

  • Somtirtha Acharya โ€” Project Development, Logic Integration, Deployment
  • Kajal Dahiya โ€” Testing, Documentation, Review
  • M.Bhargav Naidu โ€” Presentation, QA, Support

๐Ÿ”— Repository

GitHub Source Code:
https://github.com/CalmaCodes/Resource-Allocation-Graph-Visualizer.git


๐Ÿ“œ License

Created for academic and educational purposes.

About

Interactive OS project for visualizing resource allocation, deadlock detection, circular wait conditions, and recovery strategies using a modern graph-based interface

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors