Skip to content

Kavya-2k6/os-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive Deadlock Analyzer

An educational GUI desktop application that simulates process-resource interactions, detects deadlocks, and predicts unsafe states using Banker's Algorithm and Resource Allocation Graphs (RAG).

Features

  • Banker's Algorithm Integration: Dynamically calculates Safe/Unsafe states using the Max, Allocation, Need, and Available matrices.
  • Interactive Simulation: Step forward and backward through system states to analyze how decisions impact system safety.
  • Dynamic Resource Management: Add new processes and resources on the fly.
  • Resource Allocation Graph (RAG) Visualization: Real-time generation of bipartite directed graphs using NetworkX and Matplotlib to visualize allocations and requests.
  • Deadlock Detection: Advanced graph reduction algorithms detect cycles and definitive deadlocks in multi-instance environments.
  • Override Functionality: Bypass Banker's Algorithm to force resource allocations, deliberately creating unsafe states and circular waits to observe deadlock occurrences.

Tech Stack

  • Language: Python 3
  • GUI Framework: PyQt5
  • Graph Visualization: NetworkX & Matplotlib (embedded via FigureCanvasQTAgg)
  • Architecture: Model-View-Controller (MVC)

Installation

  1. Ensure you have Python 3 installed.
  2. Install the required dependencies:
    pip install PyQt5 numpy networkx matplotlib

Usage

  1. Clone the repository and navigate to the project directory.
  2. Run the main application:
    python main.py

Interface Overview

  • Left Panel (Controls): Create resources, add processes (with specific max claims), and simulate requests or releases. You can also bypass the Banker's Algorithm here by checking the force allocation box.
  • Right Panel (Visualization): Displays the dynamic system status (Safe, Unsafe, Deadlocked, etc.) and visualizes the Resource Allocation Graph. Processes are light blue circles; Resources are light green squares. Solid green arrows denote allocations, and dashed red arrows denote requests.
  • Bottom Panel (Matrices): View real-time updates to the Max Claim, Allocation, Need, and Available matrices.

Project Structure

  • main.py: The central controller that wires the UI and Backend Engine.
  • ui/main_window.py: The programmatic PyQt5 dashboard view.
  • views/canvas.py: The customized Matplotlib Canvas for NetworkX bipartite graph rendering.
  • engine/simulator.py: State manager handling step histories and Banker's logic integration.
  • engine/banker.py: Implementation of Banker's Algorithm for safety sequences.
  • engine/graph_utils.py: RAG construction, cycle detection, and graph-reduction-based deadlock detection.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages