An interactive Operating Systems learning platform for visualizing, simulating, and practicing deadlock avoidance, detection, and recovery.
Deadlock Defender is a web-based educational application designed to make core OS deadlock concepts easier to understand through interactive tools, guided modules, and AI-assisted practice. Instead of learning only through static textbook examples, users can explore dynamic simulations, modify system states, and observe how processes and resources interact in real time.
The platform combines conceptual learning with hands-on experimentation through modules such as the Resource Allocation Graph Simulator, Banker’s Algorithm Simulator, Deadlock Detection & Recovery, scenario-based games, and an adaptive AI quiz. The application is built with Next.js, TypeScript, Firebase, Tailwind CSS, shadcn/ui, and Genkit with Gemini-powered AI flows.
- Interactive dashboard for accessing all learning modules
- Introductory learning module for processes, resources, and deadlock basics
- Deadlock prevention module with guided concept explanations
- Resource Allocation Graph Simulator for visualizing request/assignment edges and cycle detection
- Banker’s Algorithm Simulator for safe-state checking and resource allocation analysis
- Deadlock Detection & Recovery module for identifying deadlocked processes and testing recovery strategies
- Game Scenarios such as:
- Printer Queue Jam
- Database Connection Overload
- Manufacturing Assembly Race
- Adaptive AI Quiz that changes difficulty based on learner performance
- AI-generated safe, unsafe, deadlocked, and random practice inputs
- Responsive dark-themed UI with sidebar navigation and loading states
Deadlock Defender uses Genkit + Gemini to support dynamic learning experiences.
adaptive-learning-path.ts— adjusts difficulty based on quiz performancegenerate-deadlock-scenario.ts— generates matrix-based random, safe, or deadlocked statesgenerate-rag-scenario.ts— generates safe or cyclic resource allocation graphsgenerate-scenario-state.ts— creates scenario-specific state variations for games
These flows help the app produce fresh inputs for repeated practice instead of relying on only hardcoded examples.
- Next.js 15
- React 18
- TypeScript
- Tailwind CSS
- shadcn/ui
- Radix UI
- Framer Motion
- Firebase Firestore
- Firebase Authentication
- Genkit
- Google Gemini 2.5 Flash
src/
├── app/
│ ├── page.tsx
│ ├── adaptive-quiz/
│ ├── learn/
│ │ ├── basics/
│ │ └── prevention/
│ ├── scenarios/
│ │ ├── page.tsx
│ │ └── [id]/
│ └── tools/
│ ├── bankers-algorithm/
│ ├── detection-recovery/
│ └── rag-simulator/
├── ai/
│ ├── dev.ts
│ ├── genkit.ts
│ └── flows/
├── components/
│ ├── icons/
│ ├── layout/
│ └── ui/
├── firebase/
├── hooks/
└── lib/Make sure you have the following installed or configured:
- Node.js
- npm
- Firebase project
- Gemini / Google AI access for Genkit-based flows
git clone <your-repo-url>
cd deadlock-defender
npm installCreate a .env.local file and add:
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=If you are using Genkit and Gemini locally, also add the required Google AI credentials.
npm run devnpm run genkitdevnpm run genkitwatchnpm run dev # Start Next.js dev server
npm run genkitdev # Start Genkit dev server
npm run genkitwatch # Start Genkit in watch mode
npm run build # Create production build
npm run start # Start production server
npm run lint # Run linting
npm run typecheck # Run TypeScript checksThe app stores scenario data in the scenarios collection.
Related files:
src/lib/scenarios.ts— scenario seed datasrc/lib/seed.ts— helper for seeding Firestorefirestore.rules— Firestore access rules
Note: The current Firestore rules are open for development and testing. Restrict read/write access before using the project in production.
This project is best deployed on Vercel for full Next.js compatibility, especially when using dynamic functionality and AI-assisted features.
Before deployment:
- Add all Firebase and AI-related environment variables
- Verify Firestore rules for production safety
- Ensure Genkit / Gemini configuration is properly set
- Secure Firestore rules for production
- Add learner progress persistence
- Expand scenario library
- Add more analytics for adaptive learning
- Improve production deployment of AI-backed features
This project is intended for educational and academic use.