app.py: Flask web server and form handlingmemory_algorithms.py: all seven allocation algorithmstemplates/index.html: frontend form and resultsstatic/style.css: page stylingstatic/script.js: shows relevant input fields for each algorithm
Use Python 3.10+.
pip install flask
python app.pyOpen the local URL printed in the terminal, usually http://127.0.0.1:5000.
- Choose one of the seven algorithms.
- Enter process sizes as comma-separated values, such as
212, 417, 112, 426. - For Equal, Proportional, or Priority, enter total available memory.
- For First Fit, Best Fit, Worst Fit, or Next Fit, enter block sizes, e.g.
100, 500, 200, 300, 600. - For Priority, optionally enter one priority per process, e.g.
1, 2, 3, 1. Smaller number means higher priority. - Click Run Simulation.
No database or separate JavaScript API server is required. Flask receives the form submission and runs the Python functions.
- Equal: each process is offered an equal share, capped at its request; unused shares are not redistributed.
- Proportional: when total demand exceeds memory, memory is shared in proportion to requested sizes.
- Priority: lower numeric priority is considered first; processes get their full request or zero.
- Contiguous placement: each block is a free hole; allocating a process reduces that hole by the process size.
- Next Fit resumes searching from the last successful allocation's block and searches circularly.