A small Python project that simulates and detects deadlocks using a Wait-For Graph (WFG).
This repository includes both a command-line simulation and a simple Tkinter GUI for experimenting with resource allocation, process requests/releases and deadlock detection.
- Simulation-driven deadlock detector (see
main.py). - GUI to interactively create processes and request/release resources (see
gui_app.py). - A lightweight deadlock detection engine that finds cycles in a Wait-For Graph (
deadlock_detector.py).
Requirements: Python 3.8+ (no external dependencies are required by default).
This repository includes a requirements.txt at the project root. It is currently empty of runtime
dependencies because the project uses only Python's standard library. If third-party packages are added
in future, they will be listed in requirements.txt and can be installed with:
pip install -r requirements.txtFrom the project root you can run the simulation or start the GUI:
CLI simulation (sample run):
python main.pyGUI:
python gui_app.pyNotes:
setup.pyis included for packaging; you can usepip install -e .to install the package into your environment for development.
main.py— example simulation runner that demonstrates process/resource interaction and deadlock detection.gui_app.py— simple Tkinter application to manually create processes and request/release resources.resource_tracker.py— tracks which process owns which resources.process_monitor.py— API for creating processes and requesting/releasing resources.wfg_builder.py— builds the Wait-For Graph used for deadlock detection.deadlock_detector.py— core detection logic (cycle detection in the WFG).utils/— helper modules such aslogger.py.
- Some files (e.g.,
__main__.py) may not be fully wired to themainentrypoint — runningmain.pydirectly works for the included simulation example. - This repository contains example/demo code intended for experimentation and learning.
Feel free to open issues or PRs if you'd like this README expanded, a testsuite added, or the module packaging improved.
Add a license file if you want to open-source the project; no license is included by default.